[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Dec 3 04:50:38 PST 2012
dbaccess/source/ui/inc/TableConnectionData.hxx | 3 -
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 45 ++++++++++++++-------
2 files changed, 34 insertions(+), 14 deletions(-)
New commits:
commit 1cac399e063827349c340cafdec8dc0756f90f1b
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sun Dec 2 18:32:38 2012 +0100
fdo#42165 make nested joins as per strict ANSI SQL
Change-Id: I605d3811b27c33e35670306bb03b5a796ab72bc0
Reviewed-on: https://gerrit.libreoffice.org/1225
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
index 79ccd80..291529f 100644
--- a/dbaccess/source/ui/inc/TableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -87,7 +87,8 @@ namespace dbaui
void normalizeLines();
// loescht die Liste der ConnLines, bei bUseDefaults == sal_True werden danach MAX_CONN_COUNT neue Dummy-Linien eingefuegt
- OConnectionLineDataVec* GetConnLineDataList(){ return &m_vConnLineData; }
+ const OConnectionLineDataVec* GetConnLineDataList() const { return &m_vConnLineData; }
+ OConnectionLineDataVec* GetConnLineDataList() { return &m_vConnLineData; }
inline TTableWindowData::value_type getReferencingTable() const { return m_pReferencingTable; }
inline TTableWindowData::value_type getReferencedTable() const { return m_pReferencedTable; }
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 6b91252..7b33375 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -299,14 +299,14 @@ namespace
}
//------------------------------------------------------------------------------
::rtl::OUString BuildJoinCriteria( const Reference< XConnection>& _xConnection,
- OConnectionLineDataVec* pLineDataList,
- OQueryTableConnectionData* pData)
+ const OConnectionLineDataVec* pLineDataList,
+ const OQueryTableConnectionData* pData)
{
::rtl::OUStringBuffer aCondition;
if ( _xConnection.is() )
{
- OConnectionLineDataVec::iterator aIter = pLineDataList->begin();
- OConnectionLineDataVec::iterator aEnd = pLineDataList->end();
+ OConnectionLineDataVec::const_iterator aIter = pLineDataList->begin();
+ OConnectionLineDataVec::const_iterator aEnd = pLineDataList->end();
try
{
const Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData();
@@ -401,7 +401,7 @@ namespace
::rtl::OUString BuildJoin( const Reference< XConnection>& _xConnection,
const ::rtl::OUString& rLh,
const ::rtl::OUString& rRh,
- OQueryTableConnectionData* pData)
+ const OQueryTableConnectionData* pData)
{
String aErg(rLh);
@@ -439,9 +439,9 @@ namespace
}
//------------------------------------------------------------------------------
::rtl::OUString BuildJoin( const Reference< XConnection>& _xConnection,
- OQueryTableWindow* pLh,
- OQueryTableWindow* pRh,
- OQueryTableConnectionData* pData
+ const OQueryTableWindow* pLh,
+ const OQueryTableWindow* pRh,
+ const OQueryTableConnectionData* pData
)
{
bool bForce = pData->GetJoinType() == CROSS_JOIN || pData->isNatural();
@@ -450,20 +450,39 @@ namespace
//------------------------------------------------------------------------------
::rtl::OUString BuildJoin( const Reference< XConnection>& _xConnection,
const ::rtl::OUString &rLh,
- OQueryTableWindow* pRh,
- OQueryTableConnectionData* pData
+ const OQueryTableWindow* pRh,
+ const OQueryTableConnectionData* pData
)
{
return BuildJoin(_xConnection,rLh,BuildTable(_xConnection,pRh),pData);
}
//------------------------------------------------------------------------------
::rtl::OUString BuildJoin( const Reference< XConnection>& _xConnection,
- OQueryTableWindow* pLh,
+ const OQueryTableWindow* pLh,
const ::rtl::OUString &rRh,
- OQueryTableConnectionData* pData
+ const OQueryTableConnectionData* pData
)
{
- return BuildJoin(_xConnection,BuildTable(_xConnection,pLh),rRh,pData);
+ // strict ANSI SQL:
+ // - does not support any bracketing of JOINS
+ // - supports nested joins only in the LEFT HAND SIDE
+ // In this case, we are trying to build a join with a nested join
+ // in the right hand side.
+ // So switch the direction of the join and both hand sides.
+ OQueryTableConnectionData data(*pData);
+ switch (data.GetJoinType())
+ {
+ case LEFT_JOIN:
+ data.SetJoinType(RIGHT_JOIN);
+ break;
+ case RIGHT_JOIN:
+ data.SetJoinType(LEFT_JOIN);
+ break;
+ default:
+ // the other join types are symmetric, so nothing to change
+ break;
+ }
+ return BuildJoin(_xConnection, rRh, BuildTable(_xConnection,pLh), &data);
}
//------------------------------------------------------------------------------
void GetNextJoin( const Reference< XConnection>& _xConnection,
More information about the Libreoffice-commits
mailing list