summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-06-28 16:52:54 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-06-28 16:56:24 +0200
commit9015333ebd5b33c9c6c3a9072167af4c77d6d75a (patch)
treea207b16aa80410e5a34f67b193a2cd449e21f7ab /connectivity
parentae6551b43d6cde10edb449cca6d2caa8fa428b20 (diff)
firebird: release driver on dispose rather than destroy.
Change-Id: I5ffeaf818c1eb4985bdd150830f089f03fe42ceb
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx9
-rw-r--r--connectivity/source/drivers/firebird/Connection.hxx4
2 files changed, 4 insertions, 9 deletions
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 1ad4f445cca4..2d846d8c9959 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -77,7 +77,7 @@ const OUString Connection::our_sDBLocation( "firebird.fdb" );
Connection::Connection(FirebirdDriver* _pDriver)
: Connection_BASE(m_aMutex)
, OSubComponent<Connection, Connection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- , m_pDriver(_pDriver)
+ , m_xDriver(_pDriver)
, m_sConnectionURL()
, m_sFirebirdURL()
, m_bIsEmbedded(false)
@@ -93,16 +93,12 @@ Connection::Connection(FirebirdDriver* _pDriver)
, m_xMetaData(0)
, m_aStatements()
{
- m_pDriver->acquire();
}
Connection::~Connection()
{
if(!isClosed())
close();
-
- m_pDriver->release();
- m_pDriver = 0;
}
void SAL_CALL Connection::release() throw()
@@ -348,7 +344,7 @@ OUString Connection::transformPreparedStatement(const OUString& _sSQL)
OUString sSqlStatement (_sSQL);
try
{
- OSQLParser aParser( m_pDriver->getContext() );
+ OSQLParser aParser( m_xDriver->getContext() );
OUString sErrorMessage;
OUString sNewSql;
OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL);
@@ -758,6 +754,7 @@ void Connection::disposing()
dispose_ChildImpl();
cppu::WeakComponentImplHelperBase::disposing();
+ m_xDriver.clear();
}
void Connection::disposeStatements()
diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx
index 1c783bbfedb3..d613263048ad 100644
--- a/connectivity/source/drivers/firebird/Connection.hxx
+++ b/connectivity/source/drivers/firebird/Connection.hxx
@@ -83,7 +83,7 @@ namespace connectivity
// for each row returned by
// DatabaseMetaData.getTypeInfo.
/** The parent driver that created this connection. */
- FirebirdDriver* m_pDriver;
+ ::rtl::Reference<FirebirdDriver> m_xDriver;
/** The URL passed to us when opening, i.e. of the form sdbc:* */
::rtl::OUString m_sConnectionURL;
@@ -179,8 +179,6 @@ namespace connectivity
throw(::com::sun::star::sdbc::SQLException,
::com::sun::star::uno::RuntimeException);
- FirebirdDriver* getDriver() const {return m_pDriver;}
-
::rtl::OUString getConnectionURL() const {return m_sConnectionURL;}
bool isEmbedded() const {return m_bIsEmbedded;}
::rtl::OUString getUserName() const {return m_sUser;}