Kaydet (Commit) 9015333e authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

firebird: release driver on dispose rather than destroy.

Change-Id: I5ffeaf818c1eb4985bdd150830f089f03fe42ceb
üst ae6551b4
...@@ -77,7 +77,7 @@ const OUString Connection::our_sDBLocation( "firebird.fdb" ); ...@@ -77,7 +77,7 @@ const OUString Connection::our_sDBLocation( "firebird.fdb" );
Connection::Connection(FirebirdDriver* _pDriver) Connection::Connection(FirebirdDriver* _pDriver)
: Connection_BASE(m_aMutex) : Connection_BASE(m_aMutex)
, OSubComponent<Connection, Connection_BASE>((::cppu::OWeakObject*)_pDriver, this) , OSubComponent<Connection, Connection_BASE>((::cppu::OWeakObject*)_pDriver, this)
, m_pDriver(_pDriver) , m_xDriver(_pDriver)
, m_sConnectionURL() , m_sConnectionURL()
, m_sFirebirdURL() , m_sFirebirdURL()
, m_bIsEmbedded(false) , m_bIsEmbedded(false)
...@@ -93,16 +93,12 @@ Connection::Connection(FirebirdDriver* _pDriver) ...@@ -93,16 +93,12 @@ Connection::Connection(FirebirdDriver* _pDriver)
, m_xMetaData(0) , m_xMetaData(0)
, m_aStatements() , m_aStatements()
{ {
m_pDriver->acquire();
} }
Connection::~Connection() Connection::~Connection()
{ {
if(!isClosed()) if(!isClosed())
close(); close();
m_pDriver->release();
m_pDriver = 0;
} }
void SAL_CALL Connection::release() throw() void SAL_CALL Connection::release() throw()
...@@ -348,7 +344,7 @@ OUString Connection::transformPreparedStatement(const OUString& _sSQL) ...@@ -348,7 +344,7 @@ OUString Connection::transformPreparedStatement(const OUString& _sSQL)
OUString sSqlStatement (_sSQL); OUString sSqlStatement (_sSQL);
try try
{ {
OSQLParser aParser( m_pDriver->getContext() ); OSQLParser aParser( m_xDriver->getContext() );
OUString sErrorMessage; OUString sErrorMessage;
OUString sNewSql; OUString sNewSql;
OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL); OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL);
...@@ -758,6 +754,7 @@ void Connection::disposing() ...@@ -758,6 +754,7 @@ void Connection::disposing()
dispose_ChildImpl(); dispose_ChildImpl();
cppu::WeakComponentImplHelperBase::disposing(); cppu::WeakComponentImplHelperBase::disposing();
m_xDriver.clear();
} }
void Connection::disposeStatements() void Connection::disposeStatements()
......
...@@ -83,7 +83,7 @@ namespace connectivity ...@@ -83,7 +83,7 @@ namespace connectivity
// for each row returned by // for each row returned by
// DatabaseMetaData.getTypeInfo. // DatabaseMetaData.getTypeInfo.
/** The parent driver that created this connection. */ /** 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:* */ /** The URL passed to us when opening, i.e. of the form sdbc:* */
::rtl::OUString m_sConnectionURL; ::rtl::OUString m_sConnectionURL;
...@@ -179,8 +179,6 @@ namespace connectivity ...@@ -179,8 +179,6 @@ namespace connectivity
throw(::com::sun::star::sdbc::SQLException, throw(::com::sun::star::sdbc::SQLException,
::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::RuntimeException);
FirebirdDriver* getDriver() const {return m_pDriver;}
::rtl::OUString getConnectionURL() const {return m_sConnectionURL;} ::rtl::OUString getConnectionURL() const {return m_sConnectionURL;}
bool isEmbedded() const {return m_bIsEmbedded;} bool isEmbedded() const {return m_bIsEmbedded;}
::rtl::OUString getUserName() const {return m_sUser;} ::rtl::OUString getUserName() const {return m_sUser;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment