summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Fernandez <jfernandez@igalia.com>2013-05-27 15:00:29 +0000
committerJavier Fernandez <jfernandez@igalia.com>2013-06-06 09:37:43 +0000
commit28c8baee278e341aab30e549a5d6f2d7a04932db (patch)
tree2e66b572825556ce9eb09cbdd83bb828d1bf3c30
parentcb6b541b30c0f18d7270a38c80a6ecef30a321a0 (diff)
Adding disposing bits.
Change-Id: I997c23d0c0765a6929be89087330ac6616ccd28c
-rw-r--r--connectivity/source/drivers/firebird/FConnection.cxx10
-rw-r--r--connectivity/source/drivers/firebird/FPreparedStatement.cxx1
-rw-r--r--connectivity/source/drivers/firebird/FResultSet.cxx3
-rw-r--r--connectivity/source/drivers/firebird/FStatement.cxx21
4 files changed, 29 insertions, 6 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx
index 4f98cd1cfb36..71bcb3f95cab 100644
--- a/connectivity/source/drivers/firebird/FConnection.cxx
+++ b/connectivity/source/drivers/firebird/FConnection.cxx
@@ -107,14 +107,11 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
// some example code how to get the information out of the sequence
ISC_STATUS_ARRAY status; /* status vector */
- isc_db_handle db = NULL; /* database handle */
- if (isc_attach_database(status, 0, "/home/javi/Firebird/test/new.fdb", &db, 0, NULL))
+ if (isc_attach_database(status, 0, "/home/javi/Firebird/test/new.fdb", &m_DBHandler, 0, NULL))
if (pr_error(status, "attach database"))
return;
- m_DBHandler = db;
-
osl_atomic_decrement( &m_refCount );
}
// XServiceInfo
@@ -398,6 +395,11 @@ void OConnection::disposing()
m_bClosed = sal_True;
m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
+ ISC_STATUS_ARRAY status; /* status vector */
+ if (isc_detach_database(status, &m_DBHandler))
+ if (pr_error(status, "dattach database"))
+ return;
+
dispose_ChildImpl();
OConnection_BASE::disposing();
}
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
index e7e1131c1eee..d7aeee58ce28 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
@@ -108,6 +108,7 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
if (isc_dsql_prepare(status, &m_TRANSHandler, &m_STMTHandler, 0, sqlStr, 1, NULL))
if (pr_error(status, "prepare statement"))
return;
+ free(sqlStr);
// fill the output XSQLDA with information about the select-list items.
if (isc_dsql_describe(status, &m_STMTHandler, 1, out_sqlda))
diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx
index 535f5757045b..895af3fd67a1 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -141,6 +141,9 @@ OResultSet::OResultSet(OStatement_Base* pStmt)
if (pr_error(status, "fetch data"))
return;
}
+ if (isc_dsql_free_statement(status, &stmt, DSQL_drop))
+ if (pr_error(status, "fetch data"))
+ return;
}
// -------------------------------------------------------------------------
OResultSet::~OResultSet()
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 53452703850b..11b5d5cc3367 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -66,15 +66,17 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection )
m_pConnection(_pConnection)
{
m_pConnection->acquire();
+ m_OUTsqlda = NULL;
+ m_INsqlda = NULL;
}
-// -----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
OStatement_Base::~OStatement_Base()
{
}
//------------------------------------------------------------------------------
void OStatement_Base::disposeResultSet()
{
- // free the cursor if alive
+ //free the cursor if alive
Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
if (xComp.is())
xComp->dispose();
@@ -83,6 +85,8 @@ void OStatement_Base::disposeResultSet()
//------------------------------------------------------------------------------
void OStatement_BASE2::disposing()
{
+ printf("DEBUG !!! connectivity.firebird => OStatement_BASE2::disposing: \n");
+
::osl::MutexGuard aGuard(m_aMutex);
disposeResultSet();
@@ -91,6 +95,19 @@ void OStatement_BASE2::disposing()
m_pConnection->release();
m_pConnection = NULL;
+ if (m_OUTsqlda)
+ {
+ int i;
+ XSQLVAR *var;
+ for (i=0, var = m_OUTsqlda->sqlvar; i < m_OUTsqlda->sqld; i++, var++)
+ free(var->sqldata);
+ free(m_OUTsqlda);
+ }
+ if (m_INsqlda)
+ {
+ free(m_INsqlda);
+ }
+
dispose_ChildImpl();
OStatement_Base::disposing();
}