[Libreoffice-commits] .: 3 commits - dbaccess/source

Jan Holesovsky kendy at kemper.freedesktop.org
Sun Oct 24 09:45:42 PDT 2010


 dbaccess/source/core/api/KeySet.cxx        |   13 +++++++------
 dbaccess/source/core/api/KeySet.hxx        |    3 ++-
 dbaccess/source/core/api/OptimisticSet.cxx |    5 ++++-
 dbaccess/source/core/api/RowSetCache.cxx   |    2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit d10a4b873926455cd2df7d82ea3ccfe3a1b91281
Merge: 72cc77c... 2ac71a6...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun Oct 24 15:26:09 2010 +0200

    Merge commit 'ooo/OOO330_m12'

commit 2ac71a6dcdee4119c7b302faecbfd49c1b79652b
Merge: c07e734... 00c826f...
Author: Kurt Zenker <kz at openoffice.org>
Date:   Wed Oct 20 16:41:18 2010 +0200

    CWS-TOOLING: integrate CWS dba33k

commit 00c826fce4b50f97f85ae0cf87a897be3b36cfa6
Author: Ocke.Janssen <Ocke.Janssen at oracle.com>
Date:   Mon Oct 18 12:38:57 2010 +0200

    dba33k: #i114026# check if key columns from all tables are involved

diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 1f20fd1..29c906b 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -200,7 +200,8 @@ void OKeySet::initColumns()
 void OKeySet::findTableColumnsMatching_throw(   const Any& i_aTable,
                                                 const ::rtl::OUString& i_rUpdateTableName,
                                                 const Reference<XDatabaseMetaData>& i_xMeta,
-                                                const Reference<XNameAccess>& i_xQueryColumns)
+                                                const Reference<XNameAccess>& i_xQueryColumns,
+                                                ::std::auto_ptr<SelectColumnsMetaData>& o_pKeyColumnNames)
 {
     // first ask the database itself for the best columns which can be used
     Sequence< ::rtl::OUString> aBestColumnNames;
@@ -242,17 +243,17 @@ void OKeySet::findTableColumnsMatching_throw(   const Any& i_aTable,
         sUpdateTableName = dbtools::composeTableName( i_xMeta, sCatalog, sSchema, sTable, sal_False, ::dbtools::eInDataManipulation );
     }
 
-    ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sUpdateTableName,(*m_pKeyColumnNames),true);
+    ::dbaccess::getColumnPositions(i_xQueryColumns,aBestColumnNames,sUpdateTableName,(*o_pKeyColumnNames),true);
     ::dbaccess::getColumnPositions(i_xQueryColumns,xTblColumns->getElementNames(),sUpdateTableName,(*m_pColumnNames),true);
     ::dbaccess::getColumnPositions(i_xQueryColumns,aParameterColumns,sUpdateTableName,(*m_pParameterNames),true);
 
-    if ( m_pKeyColumnNames->empty() )
+    if ( o_pKeyColumnNames->empty() )
     {
         ::dbtools::throwGenericSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not find any key column." ) ), *this );
     }
 
-    for (   SelectColumnsMetaData::const_iterator keyColumn = m_pKeyColumnNames->begin();
-            keyColumn != m_pKeyColumnNames->end();
+    for (   SelectColumnsMetaData::const_iterator keyColumn = o_pKeyColumnNames->begin();
+            keyColumn != o_pKeyColumnNames->end();
             ++keyColumn
         )
     {
@@ -298,7 +299,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::O
     Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
     Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
     const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
-    findTableColumnsMatching_throw(makeAny(m_xTable),m_sUpdateTableName,xMeta,xQueryColumns);
+    findTableColumnsMatching_throw(makeAny(m_xTable),m_sUpdateTableName,xMeta,xQueryColumns,m_pKeyColumnNames);
 
     // the first row is empty because it's now easier for us to distinguish	when we are beforefirst or first
     // without extra varaible to be set
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 631c223..072440c 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -145,7 +145,8 @@ namespace dbaccess
         void findTableColumnsMatching_throw( const ::com::sun::star::uno::Any& i_aTable,
                                              const ::rtl::OUString& i_rUpdateTableName,
                                              const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& i_xMeta,
-                                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns);
+                                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns,
+                                             ::std::auto_ptr<SelectColumnsMetaData>& o_pKeyColumnNames);
         ::rtl::OUStringBuffer createKeyFilter();
         void tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch);
         void executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const ::rtl::OUString& i_sSQL,const ::rtl::OUString& i_sTableName,const ::std::vector<sal_Int32>& _aIndexColumnPositions = ::std::vector<sal_Int32>());
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 8325133..091ea08 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -124,6 +124,7 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
     initColumns();
 
     Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
+    bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
     Reference<XColumnsSupplier> xQueryColSup(m_xComposer,UNO_QUERY);
     const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
     const Reference<XTablesSupplier> xTabSup(m_xComposer,UNO_QUERY);
@@ -133,7 +134,9 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const ::
     const ::rtl::OUString* pTableNameEnd = pTableNameIter + aTableNames.getLength();
     for( ; pTableNameIter != pTableNameEnd ; ++pTableNameIter)
     {
-        findTableColumnsMatching_throw(xTables->getByName(*pTableNameIter),*pTableNameIter,xMeta,xQueryColumns);
+        ::std::auto_ptr<SelectColumnsMetaData> pKeyColumNames(new SelectColumnsMetaData(bCase));
+        findTableColumnsMatching_throw(xTables->getByName(*pTableNameIter),*pTableNameIter,xMeta,xQueryColumns,pKeyColumNames);
+        m_pKeyColumnNames->insert(pKeyColumNames->begin(),pKeyColumNames->end());
     }
 
     // the first row is empty because it's now easier for us to distinguish	when we are beforefirst or first
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 73c6712..eda4632 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -188,7 +188,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
                 }
                 catch(const Exception&)
                 {
-                    DBG_UNHANDLED_EXCEPTION();
+                    // DBG_UNHANDLED_EXCEPTION();
                 }
                 m_pCacheSet = NULL;
                 m_xCacheSet.clear();


More information about the Libreoffice-commits mailing list