diff options
author | Frank Schönheit <fs@openoffice.org> | 2000-10-06 13:51:31 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2000-10-06 13:51:31 +0000 |
commit | a544cbc2e0609ae6a8ce54c347fb8404e88009e9 (patch) | |
tree | 3386edc3c7cead8a777e7378afced7544db8128d /connectivity | |
parent | 5337d264f5a2f0db08b0cf2f86c510f83d2b8e43 (diff) |
create-/prepareStatement: hold the returned object alive while <weakcontainer>.push_back
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/dbase/DConnection.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FConnection.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OConnection.cxx | 17 |
3 files changed, 21 insertions, 18 deletions
diff --git a/connectivity/source/drivers/dbase/DConnection.cxx b/connectivity/source/drivers/dbase/DConnection.cxx index 0f7cc2a27e0d..ecf8b8efb4b3 100644 --- a/connectivity/source/drivers/dbase/DConnection.cxx +++ b/connectivity/source/drivers/dbase/DConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DConnection.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-09-29 15:28:55 $ + * last change: $Author: fs $ $Date: 2000-10-06 14:51:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,10 +146,10 @@ Reference< XStatement > SAL_CALL ODbaseConnection::createStatement( ) throw(SQL ::osl::MutexGuard aGuard( m_aMutex ); if (OConnection_BASE::rBHelper.bDisposed) throw DisposedException(); - ODbaseStatement* pStmt = new ODbaseStatement(this); - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return pStmt; + Reference< XStatement > xReturn = new ODbaseStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; } // -------------------------------------------------------------------------------- Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) @@ -160,6 +160,7 @@ Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( con ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this,m_aTypeInfo); pStmt->construct(sql); + Reference< XPreparedStatement > xHoldAlive = pStmt; m_aStatements.push_back(WeakReferenceHelper(*pStmt)); return pStmt; } diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 09899a561e50..505c6fb0fe84 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FConnection.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: fs $ $Date: 2000-10-06 12:03:08 $ + * last change: $Author: fs $ $Date: 2000-10-06 14:51:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -261,10 +261,10 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep ::osl::MutexGuard aGuard( m_aMutex ); if (OConnection_BASE::rBHelper.bDisposed) throw DisposedException(); - OStatement* pStmt = new OStatement(this); - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return pStmt; + Reference< XStatement > xReturn = new OStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; } // -------------------------------------------------------------------------------- Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) @@ -275,6 +275,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo); pStmt->construct(sql); + Reference< XPreparedStatement > xHoldAlive = pStmt; m_aStatements.push_back(WeakReferenceHelper(*pStmt)); return pStmt; } diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 4232ee0edc56..924c6f8ef483 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OConnection.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2000-10-06 12:04:21 $ + * last change: $Author: fs $ $Date: 2000-10-06 14:50:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -254,9 +254,9 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep ::osl::MutexGuard aGuard( m_aMutex ); if (OConnection_BASE::rBHelper.bDisposed) throw DisposedException(); - OStatement* pStmt = new OStatement(this); - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return pStmt; + Reference< XStatement > xReturn = new OStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; } // -------------------------------------------------------------------------------- Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) @@ -266,9 +266,10 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: throw DisposedException(); if(m_aTypeInfo.empty()) buildTypeInfo(); - OPreparedStatement* pStmt = new OPreparedStatement(this,m_aTypeInfo,sql); - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return pStmt; + + Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,m_aTypeInfo,sql); + m_aStatements.push_back(WeakReferenceHelper(xReturn)); + return xReturn; } // -------------------------------------------------------------------------------- Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException) |