[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 51 + 1 file changed, 33 insertions(+), 18 deletions(-) New commits: commit 591939d9f2e76853e27bd77bdf1606e263a2ddf0 Author: Lionel Elie Mamane lio...@mamane.lu Date: Fri Jan 18 18:44:22 2013 +0100 mark *all* tables of a nested join as added Else, if the n^{th} (with n2) table also appears in a (non-NATURAL) INNER JOIN, it is repeated later, leading to an error from the database engine Change-Id: I03e0f0ef51f45be9d7ddfa63a9dbe09dc500f8dd Reviewed-on: https://gerrit.libreoffice.org/1764 Reviewed-by: Miklos Vajna vmik...@suse.cz Tested-by: Miklos Vajna vmik...@suse.cz diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 7b33375..e1d7427 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -485,10 +485,29 @@ namespace return BuildJoin(_xConnection, rRh, BuildTable(_xConnection,pLh), data); } //-- +typedef ::std::map ::rtl::OUString,sal_Bool,::comphelper::UStringMixLess tableNames_t; + //-- +void addConnectionTableNames( const Reference XConnection _xConnection, + const OQueryTableConnection* const pEntryConn, + tableNames_t _rTableNames ) +{ +// insert tables into table list to avoid double entries +const OQueryTableWindow* const pEntryTabFrom = static_castOQueryTableWindow*(pEntryConn-GetSourceWin()); +const OQueryTableWindow* const pEntryTabTo = static_castOQueryTableWindow*(pEntryConn-GetDestWin()); + +::rtl::OUString sTabName(BuildTable(_xConnection,pEntryTabFrom)); +if(_rTableNames.find(sTabName) == _rTableNames.end()) +_rTableNames[sTabName] = sal_True; +sTabName = BuildTable(_xConnection,pEntryTabTo); +if(_rTableNames.find(sTabName) == _rTableNames.end()) +_rTableNames[sTabName] = sal_True; +} + //-- void GetNextJoin( const Reference XConnection _xConnection, OQueryTableConnection* pEntryConn, OQueryTableWindow* pEntryTabTo, -::rtl::OUString aJoin) +::rtl::OUString aJoin, +tableNames_t _rTableNames) { OQueryTableConnectionData* pEntryConnData = static_castOQueryTableConnectionData*(pEntryConn-GetData().get()); if ( pEntryConnData-GetJoinType() == INNER_JOIN !pEntryConnData-isNatural() ) @@ -496,15 +515,18 @@ namespace if(aJoin.isEmpty()) { +addConnectionTableNames(_xConnection, pEntryConn, _rTableNames); OQueryTableWindow* pEntryTabFrom = static_castOQueryTableWindow*(pEntryConn-GetSourceWin()); aJoin = BuildJoin(_xConnection,pEntryTabFrom,pEntryTabTo,pEntryConnData); } else if(pEntryTabTo == pEntryConn-GetDestWin()) { +addConnectionTableNames(_xConnection, pEntryConn, _rTableNames); aJoin = BuildJoin(_xConnection,aJoin,pEntryTabTo,pEntryConnData); } else if(pEntryTabTo == pEntryConn-GetSourceWin()) { +addConnectionTableNames(_xConnection, pEntryConn, _rTableNames); aJoin = BuildJoin(_xConnection,pEntryTabTo,aJoin,pEntryConnData); } @@ -523,7 +545,7 @@ namespace // exists there a connection to a OQueryTableWindow that holds a connection that has been already visited JoinCycle(_xConnection,pNext,pEntryTab,aJoin); if(!pNext-IsVisited()) -GetNextJoin(_xConnection,pNext,pEntryTab,aJoin); +GetNextJoin(_xConnection, pNext, pEntryTab, aJoin, _rTableNames); } } @@ -541,7 +563,7 @@ namespace // exists there a connection to a OQueryTableWindow that holds a connection that has been already visited JoinCycle(_xConnection,pNext,pEntryTab,aJoin); if(!pNext-IsVisited()) -GetNextJoin(_xConnection,pNext,pEntryTab,aJoin); +GetNextJoin(_xConnection, pNext, pEntryTab, aJoin, _rTableNames); } } } @@ -1024,7 +1046,7 @@ namespace //-- void searchAndAppendName(const Reference XConnection _xConnection, const OQueryTableWindow* _pTableWindow, - ::std::map
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
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 lio...@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 caol...@redhat.com Reviewed-by: Caolán McNamara caol...@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, -
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/core/api/SingleSelectQueryComposer.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit af7141ee109ea9fa73866d3663ef5f1b73dfc30a Author: Lionel Elie Mamane lio...@mamane.lu Date: Thu Nov 1 09:56:58 2012 +0100 Don't abort when column has no (Catalog|Schema|Table)Name Especially since the rest of the function is prepared to handle no/empty (Catalog|Schema|Table)Name. Change-Id: Ic0bb59ead5789e671c90887ef850588f4924f5e7 Reviewed-on: https://gerrit.libreoffice.org/968 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 01d8cbd..7b1cd80 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -1301,9 +1301,12 @@ sal_Bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode * pCon if(m_pTables m_pTables-getCount() 1) { ::rtl::OUString aCatalog,aSchema,aTable,aComposedName,aColumnName; -column-getPropertyValue(PROPERTY_CATALOGNAME) = aCatalog; -column-getPropertyValue(PROPERTY_SCHEMANAME) = aSchema; -column-getPropertyValue(PROPERTY_TABLENAME)= aTable; + if(column-getPropertySetInfo()-hasPropertyByName(PROPERTY_CATALOGNAME)) +column-getPropertyValue(PROPERTY_CATALOGNAME) = aCatalog; + if(column-getPropertySetInfo()-hasPropertyByName(PROPERTY_SCHEMANAME)) +column-getPropertyValue(PROPERTY_SCHEMANAME) = aSchema; +if(column-getPropertySetInfo()-hasPropertyByName(PROPERTY_TABLENAME)) +column-getPropertyValue(PROPERTY_TABLENAME)= aTable; column-getPropertyValue(PROPERTY_NAME) = aColumnName; Sequence ::rtl::OUString aNames(m_pTables-getElementNames()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/core/api/RowSet.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 77e0a04561f271d87a14d6a8b6bfe20c93ef7e5d Author: Lionel Elie Mamane lio...@mamane.lu Date: Thu Sep 13 16:24:38 2012 +0200 fdo#37529 clear DataColumns read-only information when we clear DataColumns Change-Id: I6f3b4f1646df1244d97ae98f56ba054bc26e3314 Reviewed-on: https://gerrit.libreoffice.org/608 Reviewed-by: Michael Stahl mst...@redhat.com Tested-by: Michael Stahl mst...@redhat.com diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index afad13c..06a84a8 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -569,6 +569,8 @@ void ORowSet::freeResources( bool _bComplete ) // the columns must be disposed before the querycomposer is disposed because // their owner can be the composer TDataColumns().swap(m_aDataColumns);// clear and resize capacity +::std::vectorbool().swap(m_aReadOnlyDataColumns); + m_xColumns = NULL; if ( m_pColumns ) m_pColumns-disposing(); @@ -1250,6 +1252,7 @@ void ORowSet::impl_setDataColumnsWriteable_throw() void ORowSet::impl_restoreDataColumnsWriteable_throw() { +assert(m_aDataColumns.size() == m_aReadOnlyDataColumns.size() || m_aReadOnlyDataColumns.size() == 0 ); TDataColumns::iterator aIter = m_aDataColumns.begin(); ::std::vectorbool, std::allocatorbool ::iterator aReadIter = m_aReadOnlyDataColumns.begin(); for(;aReadIter != m_aReadOnlyDataColumns.end();++aIter,++aReadIter) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/core/api/KeySet.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit f80d0c180c7e98caf211059f54873001f9e0a64e Author: Lionel Elie Mamane lio...@mamane.lu Date: Fri Aug 31 18:14:59 2012 +0200 fdo#53557: use metadata's idea of column count to allocate a row m_pColumnNames contains only the columns that come straight from a table, not calculated columns Change-Id: I2706790e8c1447d1c4e144bbdef773deeca3e2e8 Reviewed-on: https://gerrit.libreoffice.org/522 Reviewed-by: Michael Meeks michael.me...@suse.com Tested-by: Michael Meeks michael.me...@suse.com diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index d9f4133..2797af9 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1441,11 +1441,12 @@ sal_Bool OKeySet::fetchRow() bRet = m_xDriverSet-next(); if ( bRet ) { +const int cc = m_xSetMetaData-getColumnCount(); + ORowSetRow aKeyRow = new connectivity::ORowVector ORowSetValue ((*m_pKeyColumnNames).size() + m_pForeignColumnNames-size()); -ORowSetRow aFullRow = new connectivity::ORowVector ORowSetValue (m_pColumnNames-size()); +ORowSetRow aFullRow = new connectivity::ORowVector ORowSetValue (cc); // Fetch the columns only once and in order, to satisfy restrictive backends such as ODBC -const int cc = m_xSetMetaData-getColumnCount(); connectivity::ORowVector ORowSetValue ::Vector::iterator aFRIter = aFullRow-get().begin(); // Column 0 is reserved for the bookmark; unused here. ++aFRIter; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/ui/dlg/queryfilter.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit 5b43272845878243ce94c1170776ec87c19ad6fd Author: Lionel Elie Mamane lio...@mamane.lu Date: Thu Aug 30 05:55:35 2012 +0200 fdo#53887 convert filter value as LIKE pattern only on (NOT) LIKE Change-Id: I24d1f3af5d428e735a94fc9a69960244d0225513 Reviewed-on: https://gerrit.libreoffice.org/513 Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com Reviewed-by: Andras Timar ati...@suse.com Tested-by: Andras Timar ati...@suse.com diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index a639828..0f0d248 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -370,7 +370,9 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox _rField,const ListBox _rCom if ( SQLFilterOperator::SQLNULL != _rFilter.Handle _rFilter.Handle != SQLFilterOperator::NOT_SQLNULL ) { String sPredicateValue = m_aPredicateInput.getPredicateValue( _rValue.GetText(), getMatchingColumn( _rValue ), sal_False ); -::Replace_OS_PlaceHolder( sPredicateValue ); +if ( _rFilter.Handle == SQLFilterOperator::LIKE || + _rFilter.Handle == SQLFilterOperator::NOT_LIKE ) +::Replace_OS_PlaceHolder( sPredicateValue ); _rFilter.Value = ::rtl::OUString(sPredicateValue); } return bHaving; @@ -486,7 +488,9 @@ void DlgFilterCrit::SetLine( sal_uInt16 nIdx,const PropertyValue _rItem,sal_Boo ::rtl::OUString aCondition; _rItem.Value = aCondition; String aStr = aCondition.getStr(); -::Replace_SQL_PlaceHolder(aStr); +if ( _rItem.Handle == SQLFilterOperator::LIKE || + _rItem.Handle == SQLFilterOperator::NOT_LIKE ) +::Replace_SQL_PlaceHolder(aStr); aStr.EraseTrailingChars(); Reference XPropertySet xColumn = getColumn( _rItem.Name ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/ui/dlg/queryfilter.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0ada624c20b44bdc2bea751a6c2f6e47af0ae4f1 Author: Lionel Elie Mamane lio...@mamane.lu Date: Tue Aug 21 17:23:34 2012 +0200 fdo#46480 do not double-escape (e.g. date) literals as strings Change-Id: I50d3f1002468d41d5b5882de170699d44fe5223c Reviewed-on: https://gerrit.libreoffice.org/443 Reviewed-by: Andras Timar ati...@suse.com Tested-by: Andras Timar ati...@suse.com diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 9d481ac..a639828 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -369,7 +369,7 @@ sal_Bool DlgFilterCrit::getCondition(const ListBox _rField,const ListBox _rCom _rFilter.Handle = GetOSQLPredicateType( _rComp.GetSelectEntry() ); if ( SQLFilterOperator::SQLNULL != _rFilter.Handle _rFilter.Handle != SQLFilterOperator::NOT_SQLNULL ) { -String sPredicateValue = m_aPredicateInput.getPredicateValue( _rValue.GetText(), getMatchingColumn( _rValue ), sal_True ); +String sPredicateValue = m_aPredicateInput.getPredicateValue( _rValue.GetText(), getMatchingColumn( _rValue ), sal_False ); ::Replace_OS_PlaceHolder( sPredicateValue ); _rFilter.Value = ::rtl::OUString(sPredicateValue); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/core/api/RowSetCache.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f2202ff952aefec7da78c45262d5004f31815270 Author: Lionel Elie Mamane lio...@mamane.lu Date: Tue Aug 21 14:43:52 2012 +0200 m_nEndPos==m_nStartPos is OK: empty window (for example, empty table) Change-Id: I5525eb750dfbed282fea272de4a736e6c70e51a9 Reviewed-on: https://gerrit.libreoffice.org/442 Reviewed-by: Andras Timar ati...@suse.com Tested-by: Andras Timar ati...@suse.com diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index fd2fe1f..3426ffd 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -857,7 +857,7 @@ sal_Bool ORowSetCache::fillMatrix(sal_Int32 _nNewStartPos, sal_Int32 _nNewEndP sal_Bool ORowSetCache::moveWindow() { OSL_ENSURE(m_nStartPos = 0,ORowSetCache::moveWindow: m_nStartPos is less than 0!); -OSL_ENSURE(m_nEndPos m_nStartPos,ORowSetCache::moveWindow: m_nStartPos not smaller than m_nEndPos); +OSL_ENSURE(m_nEndPos = m_nStartPos,ORowSetCache::moveWindow: m_nStartPos not smaller than m_nEndPos); OSL_ENSURE(m_nEndPos-m_nStartPos = m_nFetchSize,ORowSetCache::moveWindow: m_nStartPos and m_nEndPos too far apart); if ( m_nStartPos m_nPosition m_nPosition = m_nEndPos ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-3-6' - dbaccess/source
dbaccess/source/core/api/RowSetCache.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c7b0f9fa41789b3b514b81bae32cf5c39aa6fa34 Author: Lionel Elie Mamane lio...@mamane.lu Date: Thu Aug 2 11:58:55 2012 +0200 nPos is 1-based, so allowed to be equal to row count Change-Id: Idb37cd23a58816bd16c725fda49a2f9875450e79 diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 05a88d0..fd2fe1f 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -1051,7 +1051,7 @@ sal_Bool ORowSetCache::moveWindow() else if(!m_bRowCountFinal) m_nRowCount = std::max(nPos+1, m_nRowCount); //+1 because we successfully moved to row after nPos else -OSL_ENSURE(m_nRowCount nPos, Final m_nRowCount is smaller than row I moved to!); +OSL_ENSURE(m_nRowCount = nPos, Final m_nRowCount is smaller than row I moved to!); } else { // the end was reached before or at end() so we can set the start before or at nNewStartPos ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits