summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-02-01 16:35:03 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2019-02-03 16:09:32 +0100
commit65f6a4088ad5d51a3225905aa6e2fa175f3eab49 (patch)
treec61400473efe3f3f2ef6ba9154adf6b0ee66bdd2
parentc3b6ec8aba5659ffb861b02ef98b7e49be3289b7 (diff)
dbaccess: convert ORowSetBase::m_pCache to shared_ptr
Change-Id: Ic6f95a226e0d900fbc633796d7e27edcd13f5482 Reviewed-on: https://gerrit.libreoffice.org/67286 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
-rw-r--r--dbaccess/source/core/api/RowSet.cxx12
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx3
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx2
3 files changed, 6 insertions, 11 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index dd5bd93d5e80..349d70716b7b 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -569,7 +569,7 @@ void ORowSet::freeResources( bool _bComplete )
// let our warnings container forget the reference to the (possibly disposed) old result set
m_aWarnings.setExternalWarnings( nullptr );
- DELETEZ(m_pCache);
+ m_pCache.reset();
impl_resetTables_nothrow();
@@ -1700,13 +1700,9 @@ Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
aComposedUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), m_aUpdateCatalogName, m_aUpdateSchemaName, m_aUpdateTableName, false, ::dbtools::EComposeRule::InDataManipulation );
SAL_INFO("dbaccess", "ORowSet::impl_prepareAndExecute_throw: creating cache" );
- if(m_pCache)
- {
- DELETEZ(m_pCache);
- }
- m_pCache
- = new ORowSetCache(xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName,
- m_bModified, m_bNew, *m_aParameterValueForCache, m_aFilter, m_nMaxRows);
+ m_pCache.reset(
+ new ORowSetCache(xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName,
+ m_bModified, m_bNew, *m_aParameterValueForCache, m_aFilter, m_nMaxRows));
if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
{
m_nPrivileges = Privilege::SELECT;
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 84d18d8aae34..94c7e9e7dd37 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -81,7 +81,6 @@ ORowSetBase::ORowSetBase( const Reference<XComponentContext>& _rContext, ::cppu:
:OPropertyStateContainer(_rBHelper)
,m_pMutex(_pMutex)
,m_pMySelf(nullptr)
- ,m_pCache(nullptr)
,m_rBHelper(_rBHelper)
,m_aContext( _rContext )
,m_nLastColumnIndex(-1)
@@ -793,7 +792,7 @@ bool SAL_CALL ORowSetBase::move(std::function<bool(ORowSetBase *)> const & _aChe
bool bMoved = ( bWasNew || !_aCheckFunctor(this) );
- bRet = _aMovementFunctor(m_pCache);
+ bRet = _aMovementFunctor(m_pCache.get());
doCancelModification( );
if ( bRet )
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index a6508b362952..af94d6da92ff 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -85,7 +85,7 @@ namespace dbaccess
connectivity::ORowSetValue m_aEmptyValue; // only for error case
::cppu::OWeakObject* m_pMySelf; // set by derived classes
- ORowSetCache* m_pCache; // the cache is used by the rowset and his clone (shared)
+ std::shared_ptr<ORowSetCache> m_pCache; // the cache is used by the rowset and his clone (shared)
std::unique_ptr<ORowSetDataColumns> m_pColumns; // represent the select columns
::cppu::OBroadcastHelper& m_rBHelper; // must be set from the derived classes
// is used when the formatkey for database types is set