Commits

Anonymous committed ea18a7b Merge

CWS-TOOLING: integrate CWS dba33k

Comments (0)

Files changed (5)

dbaccess/source/core/api/KeySet.cxx

 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;
         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
         )
 	{
     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

dbaccess/source/core/api/KeySet.hxx

         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>());

dbaccess/source/core/api/OptimisticSet.cxx

 	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);
     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

dbaccess/source/core/api/RowSetCache.cxx

                 }
                 catch(const Exception&)
                 {
-                    DBG_UNHANDLED_EXCEPTION();
+                    // DBG_UNHANDLED_EXCEPTION();
                 }
                 m_pCacheSet = NULL;
                 m_xCacheSet.clear();

forms/source/component/ListBox.cxx

         DBG_ASSERT( m_eListSourceType != ListSourceType_VALUELIST, "OListBoxModel::loadData: cannot load value list from DB!" );
         DBG_ASSERT( !hasExternalListSource(), "OListBoxModel::loadData: cannot load from DB when I have an external list source!" );
 
+        const sal_Int16 nNULLPosBackup( m_nNULLPos );
+        const sal_Int32 nBoundColumnTypeBackup( m_nBoundColumnType );
         m_nNULLPos = -1;
         m_nBoundColumnType = DataType::SQLNULL;
 
                     // if none of the settings of the row set changed, compared to the last
                     // invocation of loadData, then don't re-fill the list. Instead, assume
                     // the list entries are the same.
+                    m_nNULLPos = nNULLPosBackup;
+                    m_nBoundColumnType = nBoundColumnTypeBackup;
                     return;
                 }
                 xListCursor.reset( m_aListRowSet.execute() );