[Libreoffice-commits] core.git: dbaccess/source

Lionel Elie Mamane lionel at mamane.lu
Thu Dec 12 11:24:46 PST 2013


 dbaccess/source/core/api/BookmarkSet.cxx      |    5 +++++
 dbaccess/source/core/api/BookmarkSet.hxx      |    1 +
 dbaccess/source/core/api/CacheSet.cxx         |   10 ++++------
 dbaccess/source/core/api/CacheSet.hxx         |    3 ++-
 dbaccess/source/core/api/KeySet.cxx           |   11 ++++++++++-
 dbaccess/source/core/api/KeySet.hxx           |    2 +-
 dbaccess/source/core/api/OptimisticSet.cxx    |   10 ----------
 dbaccess/source/core/api/OptimisticSet.hxx    |    1 -
 dbaccess/source/core/api/RowSet.cxx           |    4 ++++
 dbaccess/source/core/api/RowSetCache.cxx      |    2 +-
 dbaccess/source/core/api/StaticSet.cxx        |   12 ++++++++++++
 dbaccess/source/core/api/StaticSet.hxx        |    2 ++
 dbaccess/source/core/api/WrappedResultSet.cxx |    5 +++++
 dbaccess/source/core/api/WrappedResultSet.hxx |    1 +
 14 files changed, 48 insertions(+), 21 deletions(-)

New commits:
commit dd0990db74a4a5c3a129a7ff0ed2a739cd74a381
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Dec 12 20:13:40 2013 +0100

    fdo#72463 RowSet: on execute when not dirty, rebuild cache
    
    Change-Id: I3f27b7572b88cd1200483121614c29d414c37e20

diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index 96636e9..262b11f 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -43,6 +43,11 @@ void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const OUS
     m_xRowLocate.set(_xDriverSet,UNO_QUERY);
 }
 
+void OBookmarkSet::reset(const Reference< XResultSet>& _xDriverSet)
+{
+    construct(_xDriverSet, m_sRowSetFilter);
+}
+
 Any SAL_CALL OBookmarkSet::getBookmark() throw(SQLException, RuntimeException)
 {
    SAL_INFO("dbaccess", "OBookmarkSet::getBookmark" );
diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx
index c02ced3..76e92e9 100644
--- a/dbaccess/source/core/api/BookmarkSet.hxx
+++ b/dbaccess/source/core/api/BookmarkSet.hxx
@@ -40,6 +40,7 @@ namespace dbaccess
         }
 
         virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter);
+        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
         virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
         // ::com::sun::star::sdbcx::XRowLocate
         virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 09519c7..23ad484 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -78,10 +78,13 @@ OUString OCacheSet::getIdentifierQuoteString() const
     return sQuote;
 }
 
-void OCacheSet::construct(  const Reference< XResultSet>& _xDriverSet,const OUString& /*i_sRowSetFilter*/)
+void OCacheSet::construct(  const Reference< XResultSet>& _xDriverSet,const OUString &i_sRowSetFilter)
 {
     SAL_INFO("dbaccess", "OCacheSet::construct" );
     OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet");
+
+    m_sRowSetFilter = i_sRowSetFilter;
+
     if(_xDriverSet.is())
     {
         m_xDriverSet = _xDriverSet;
@@ -666,11 +669,6 @@ bool OCacheSet::isResultSetChanged() const
     return false;
 }
 
-void OCacheSet::reset(const Reference< XResultSet>& /*_xDriverSet*/)
-{
-    SAL_WARN("dbaccess", "Illegal call!");
-}
-
 void OCacheSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& /*io_aInsertRow*/,ORowSetValueVector::Vector& /*io_aRow*/,::std::vector<sal_Int32>& o_aChangedColumns)
 {
     o_aChangedColumns.push_back(i_nColumnIndex);
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 5247f61..a975699 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -53,6 +53,7 @@ namespace dbaccess
         sal_Bool                                    m_bInserted;
         sal_Bool                                    m_bUpdated;
         sal_Bool                                    m_bDeleted;
+        OUString                                    m_sRowSetFilter;
 
         OCacheSet(sal_Int32 i_nMaxRows);
         virtual ~OCacheSet();
@@ -135,7 +136,7 @@ namespace dbaccess
         virtual void SAL_CALL moveToCurrentRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0;
 
         virtual bool isResultSetChanged() const;
-        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
+        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet) = 0;
         virtual void mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns);
         virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow);
         virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns);
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 547b312..bce8331 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -302,7 +302,6 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
     OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
 
     initColumns();
-    m_sRowSetFilter = i_sRowSetFilter;
 
     Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
     Reference<XColumnsSupplier> xQueryColSup(m_xComposer, UNO_QUERY);
@@ -343,6 +342,16 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
     m_aKeyIter = m_aKeyMap.begin();
 }
 
+void OKeySet::reset(const Reference< XResultSet>& _xDriverSet)
+{
+    OCacheSet::construct(_xDriverSet, m_sRowSetFilter);
+    m_bRowCountFinal = sal_False;
+    m_aKeyMap.clear();
+    OKeySetValue keySetValue((ORowSetValueVector *)NULL,::std::pair<sal_Int32,Reference<XRow> >(0,(Reference<XRow>)NULL));
+    m_aKeyMap.insert(OKeySetMatrix::value_type(0,keySetValue));
+    m_aKeyIter = m_aKeyMap.begin();
+}
+
 void OKeySet::ensureStatement( )
 {
     // do we already have a statement for the current combination of NULLness
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index a4eaf49..e4cfdae 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -106,7 +106,6 @@ namespace dbaccess
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>                 m_xRow;
         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >   m_xComposer;
         const OUString                                   m_sUpdateTableName;
-        OUString                                         m_sRowSetFilter;
         ::std::vector< OUString >                        m_aFilterColumns;
         sal_Int32&                                              m_rRowCount;
 
@@ -161,6 +160,7 @@ namespace dbaccess
 
         // late ctor which can throw exceptions
         virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter);
+        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
 
         // ::com::sun::star::sdbc::XRow
         virtual sal_Bool SAL_CALL wasNull(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 53239b3..43e2313 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -482,16 +482,6 @@ bool OptimisticSet::isResultSetChanged() const
     return bOld;
 }
 
-void OptimisticSet::reset(const Reference< XResultSet>& _xDriverSet)
-{
-    OCacheSet::construct(_xDriverSet,OUString());
-    m_bRowCountFinal = sal_False;
-    m_aKeyMap.clear();
-    OKeySetValue keySetValue((ORowSetValueVector *)NULL,::std::pair<sal_Int32,Reference<XRow> >(0,(Reference<XRow>)NULL));
-    m_aKeyMap.insert(OKeySetMatrix::value_type(0,keySetValue));
-    m_aKeyIter = m_aKeyMap.begin();
-}
-
 void OptimisticSet::mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns)
 {
     o_aChangedColumns.push_back(i_nColumnIndex);
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index cbc5f2d..bf4d59b 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -70,7 +70,6 @@ namespace dbaccess
 
         // CacheSet
         virtual bool isResultSetChanged() const;
-        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
         virtual void mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns);
         virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow);
         virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 07fc875..acac042 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1991,6 +1991,10 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
                                                 aColumns,*this,m_aColumnsMutex,aNames);
         }
     }
+    else // !m_bCommandFacetsDirty
+    {
+        impl_rebuild_throw(_rClearForNotification);
+    }
     checkCache();
     // notify the rowset listeners
     notifyAllListeners(_rClearForNotification);
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 4ac763e..17c1522 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -1680,7 +1680,6 @@ void ORowSetCache::deregisterOldRow(const TORowSetOldRowHelperRef& _rRow)
 
 sal_Bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos,sal_Int32 _nNewEndPos)
 {
-    OSL_ENSURE( _nNewEndPos - _nNewStartPos == m_nFetchSize, "reFillMatrix called with Start/EndPos not m_nFetchSize apart");
     const TOldRowSetRows::const_iterator aOldRowEnd = m_aOldRows.end();
     for (TOldRowSetRows::iterator aOldRowIter = m_aOldRows.begin(); aOldRowIter != aOldRowEnd; ++aOldRowIter)
     {
@@ -1724,6 +1723,7 @@ bool ORowSetCache::isResultSetChanged() const
 
 void ORowSetCache::reset(const Reference< XResultSet>& _xDriverSet)
 {
+    m_xSet = _xDriverSet;
     m_xMetaData.set(Reference< XResultSetMetaDataSupplier >(_xDriverSet,UNO_QUERY)->getMetaData());
     m_pCacheSet->reset(_xDriverSet);
 
diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx
index 5d252a5..fa7ebd0 100644
--- a/dbaccess/source/core/api/StaticSet.cxx
+++ b/dbaccess/source/core/api/StaticSet.cxx
@@ -358,4 +358,16 @@ void SAL_CALL OStaticSet::moveToCurrentRow(  ) throw(SQLException, RuntimeExcept
     SAL_INFO("dbaccess", "OStaticSet::moveToCurrentRow" );
 }
 
+void OStaticSet::reset(const Reference< XResultSet> &_xDriverSet)
+{
+    OCacheSet::construct(_xDriverSet, m_sRowSetFilter);
+    {
+        ORowSetMatrix t;
+        m_aSet.swap(t);
+    }
+    m_aSetIter = m_aSet.end();
+    m_bEnd = sal_False;
+    m_aSet.push_back(NULL); // this is the beforefirst record
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx
index d120281..e6d8a1a 100644
--- a/dbaccess/source/core/api/StaticSet.hxx
+++ b/dbaccess/source/core/api/StaticSet.hxx
@@ -41,6 +41,8 @@ namespace dbaccess
             m_aSet.push_back(NULL); // this is the beforefirst record
         }
 
+        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
+
         virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
         // ::com::sun::star::sdbcx::XRowLocate
         virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx
index bf2ce01..eef512b 100644
--- a/dbaccess/source/core/api/WrappedResultSet.cxx
+++ b/dbaccess/source/core/api/WrappedResultSet.cxx
@@ -45,6 +45,11 @@ void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const
     m_xUpdRow.set(_xDriverSet,UNO_QUERY_THROW);
 }
 
+void WrappedResultSet::reset(const Reference< XResultSet>& _xDriverSet)
+{
+    construct(_xDriverSet, m_sRowSetFilter);
+}
+
 Any SAL_CALL WrappedResultSet::getBookmark() throw(SQLException, RuntimeException)
 {
     SAL_INFO("dbaccess", "WrappedResultSet::getBookmark" );
diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx
index d9cc3e5..87fe14e 100644
--- a/dbaccess/source/core/api/WrappedResultSet.hxx
+++ b/dbaccess/source/core/api/WrappedResultSet.hxx
@@ -43,6 +43,7 @@ namespace dbaccess
         }
 
         virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter);
+        virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
         virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
         // ::com::sun::star::sdbcx::XRowLocate
         virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);


More information about the Libreoffice-commits mailing list