diff options
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 9 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/connection.hxx | 4 |
4 files changed, 18 insertions, 21 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 08a82c9dcb91..53b9492021f1 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -353,18 +353,17 @@ ORowSetCache::~ORowSetCache() if(m_pMatrix) { m_pMatrix->clear(); - delete m_pMatrix; + m_pMatrix.reset(); } if(m_pInsertMatrix) { m_pInsertMatrix->clear(); - delete m_pInsertMatrix; + m_pInsertMatrix.reset(); } m_xSet = WeakReference< XResultSet>(); m_xMetaData = nullptr; m_aUpdateTable = nullptr; - } void ORowSetCache::setFetchSize(sal_Int32 _nSize) @@ -375,11 +374,11 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize) m_nFetchSize = _nSize; if(!m_pMatrix) { - m_pMatrix = new ORowSetMatrix(_nSize); + m_pMatrix.reset( new ORowSetMatrix(_nSize) ); m_aMatrixIter = m_pMatrix->end(); m_aMatrixEnd = m_pMatrix->end(); - m_pInsertMatrix = new ORowSetMatrix(1); // a little bit overkill but ??? :-) + m_pInsertMatrix.reset( new ORowSetMatrix(1) ); // a little bit overkill but ??? :-) m_aInsertRow = m_pInsertMatrix->end(); } else diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx index 2a90278afd5f..4a8373d1ee85 100644 --- a/dbaccess/source/core/api/RowSetCache.hxx +++ b/dbaccess/source/core/api/RowSetCache.hxx @@ -65,13 +65,13 @@ namespace dbaccess rtl::Reference<OCacheSet> m_xCacheSet; // is a bookmarkable, keyset or static resultset - ORowSetMatrix* m_pMatrix; // represent the table struct + std::unique_ptr<ORowSetMatrix> m_pMatrix; // represent the table struct ORowSetMatrix::iterator m_aMatrixIter; // represent a row of the table ORowSetMatrix::iterator m_aMatrixEnd; // present the row behind the last row of the table ORowSetCacheMap m_aCacheIterators; TOldRowSetRows m_aOldRows; - ORowSetMatrix* m_pInsertMatrix; // represent the rows which should be inserted normally this is only one + std::unique_ptr<ORowSetMatrix> m_pInsertMatrix; // represent the rows which should be inserted normally this is only one ORowSetMatrix::iterator m_aInsertRow; // represent a insert row connectivity::OSQLTable m_aUpdateTable; // used for updates/deletes and inserts diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 4e5d6fd1bdc8..c0fc854971f5 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -311,7 +311,7 @@ OConnection::OConnection(ODatabaseSource& _rDB { } Reference< XNameContainer > xTableDefinitions(_rDB.getTables(),UNO_QUERY); - m_pTables = new OTableContainer( *this, m_aMutex, this, bCase, xTableDefinitions, this, m_nInAppend ); + m_pTables.reset( new OTableContainer( *this, m_aMutex, this, bCase, xTableDefinitions, this, m_nInAppend ) ); // check if we supports types if ( xMeta.is() ) @@ -340,9 +340,9 @@ OConnection::OConnection(ODatabaseSource& _rDB } if(m_bSupportsViews) { - m_pViews = new OViewContainer(*this, m_aMutex, this, bCase, this, m_nInAppend); - m_pViews->addContainerListener(m_pTables); - m_pTables->addContainerListener(m_pViews); + m_pViews.reset( new OViewContainer(*this, m_aMutex, this, bCase, this, m_nInAppend) ); + m_pViews->addContainerListener(m_pTables.get()); + m_pTables->addContainerListener(m_pViews.get()); } m_bSupportsUsers = Reference< XUsersSupplier> (getMasterTables(),UNO_QUERY).is(); m_bSupportsGroups = Reference< XGroupsSupplier> (getMasterTables(),UNO_QUERY).is(); @@ -359,8 +359,6 @@ OConnection::OConnection(ODatabaseSource& _rDB OConnection::~OConnection() { - delete m_pTables; - delete m_pViews; } // XWarningsSupplier @@ -532,7 +530,7 @@ void OConnection::impl_fillTableFilter() void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) { - if ( _rToBeRefreshed == Reference< XNameAccess >(m_pTables) ) + if ( _rToBeRefreshed == Reference< XNameAccess >(m_pTables.get()) ) { if (m_pTables && !m_pTables->isInitialized()) { @@ -550,7 +548,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) } } } - else if ( _rToBeRefreshed == Reference< XNameAccess >(m_pViews) ) + else if ( _rToBeRefreshed == Reference< XNameAccess >(m_pViews.get()) ) { if (m_pViews && !m_pViews->isInitialized()) { @@ -572,9 +570,9 @@ Reference< XNameAccess > OConnection::getTables() MutexGuard aGuard(m_aMutex); checkDisposed(); - refresh(m_pTables); + refresh(m_pTables.get()); - return m_pTables; + return m_pTables.get(); } Reference< XNameAccess > SAL_CALL OConnection::getViews( ) @@ -582,9 +580,9 @@ Reference< XNameAccess > SAL_CALL OConnection::getViews( ) MutexGuard aGuard(m_aMutex); checkDisposed(); - refresh(m_pViews); + refresh(m_pViews.get()); - return m_pViews; + return m_pViews.get(); } // XQueriesSupplier diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx index 497f03f24f24..0e548f9508d7 100644 --- a/dbaccess/source/core/dataaccess/connection.hxx +++ b/dbaccess/source/core/dataaccess/connection.hxx @@ -96,8 +96,8 @@ class OConnection final :public ::cppu::BaseMutex typedef std::map< OUString, css::uno::Reference< css::uno::XInterface> > TSupportServices; TSupportServices m_aSupportServices; - OTableContainer* m_pTables; - OViewContainer* m_pViews; + std::unique_ptr<OTableContainer> m_pTables; + std::unique_ptr<OViewContainer> m_pViews; ::dbtools::WarningsContainer m_aWarnings; std::atomic<std::size_t> m_nInAppend; bool m_bSupportsViews; // true when the getTableTypes return "VIEW" as type |