diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-12-12 20:13:40 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-12-12 20:19:06 +0100 |
commit | dd0990db74a4a5c3a129a7ff0ed2a739cd74a381 (patch) | |
tree | f245d620f318a632366172311ca317d2f3a1c06e /dbaccess | |
parent | 07359c242830bcc934d491870cdf5cb70fc26414 (diff) |
fdo#72463 RowSet: on execute when not dirty, rebuild cache
Change-Id: I3f27b7572b88cd1200483121614c29d414c37e20
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/BookmarkSet.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/BookmarkSet.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/core/api/CacheSet.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/api/CacheSet.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/api/OptimisticSet.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/StaticSet.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/core/api/StaticSet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/WrappedResultSet.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/core/api/WrappedResultSet.hxx | 1 |
14 files changed, 48 insertions, 21 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx index 96636e93fefc..262b11f44c3e 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 c02ced39a820..76e92e9cabae 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 09519c72c1b8..23ad4843315c 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 5247f61085c9..a975699539bb 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 547b312cbe51..bce833151850 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 a4eaf49927c0..e4cfdaead9fa 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 53239b3dd499..43e2313fe6ee 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 cbc5f2d5b756..bf4d59b87118 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 07fc87508658..acac0429798b 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 4ac763ebbfc4..17c1522a966d 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 5d252a59b1ba..fa7ebd02a997 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 d12028139104..e6d8a1af7a3c 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 bf2ce017bc0c..eef512b7287d 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 d9cc3e581f11..87fe14efa317 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); |