summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Fernandez <jfernandez@igalia.com>2013-05-27 21:06:48 +0000
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-10 14:08:45 +0100
commitcc228a3fcdbcdd476cdbe8b699d9b7bb3b0445d2 (patch)
tree1e234f2055d341c26050f1f521f7e725a95440e3
parent79cf983d367cbae05d4ce536db4e36f4c056a243 (diff)
Adding debug info for tracking disposes and fixed a memory allocation bug.
Change-Id: Iae8a6dac26fd7d074ece6421ae61ecf7ce047b8f
-rw-r--r--connectivity/source/drivers/firebird/FConnection.cxx10
-rw-r--r--connectivity/source/drivers/firebird/FPreparedStatement.cxx30
-rw-r--r--connectivity/source/drivers/firebird/FResultSet.cxx4
-rw-r--r--connectivity/source/drivers/firebird/FStatement.cxx4
4 files changed, 30 insertions, 18 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx
index 71bcb3f95cab..f990a3d0c635 100644
--- a/connectivity/source/drivers/firebird/FConnection.cxx
+++ b/connectivity/source/drivers/firebird/FConnection.cxx
@@ -76,6 +76,8 @@ OConnection::~OConnection()
//-----------------------------------------------------------------------------
void SAL_CALL OConnection::release() throw()
{
+ printf("DEBUG !!! connectivity.firebird => OConnection::release() \n" );
+
relase_ChildImpl();
}
// -----------------------------------------------------------------------------
@@ -100,7 +102,7 @@ static int pr_error (long* status, char* operation)
void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
{
- printf("DEBUG !!! connectivity.firebird", "=> OConnection::construct()" );
+ printf("DEBUG !!! connectivity.firebird => OConnection::construct() \n" );
osl_atomic_increment( &m_refCount );
@@ -218,7 +220,7 @@ sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException
// --------------------------------------------------------------------------------
Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
{
- printf ("DEBUG !!! __ OConnection::getMetaData() __ \n");
+ printf ("DEBUG !!! connectivity.firebird => OConnection::getMetaData() \n");
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
@@ -307,6 +309,8 @@ void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::contai
// XCloseable
void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
{
+ printf("DEBUG !!! connectivity.firebird => OConnection::close() \n" );
+
// we just dispose us
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -381,6 +385,8 @@ void OConnection::buildTypeInfo() throw( SQLException)
//------------------------------------------------------------------------------
void OConnection::disposing()
{
+ printf("DEBUG !!! connectivity.firebird => OConnection::disposing(). \n");
+
// we noticed that we should be destroied in near future so we have to dispose our statements
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/connectivity/source/drivers/firebird/FPreparedStatement.cxx b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
index d7aeee58ce28..bdd20ab66043 100644
--- a/connectivity/source/drivers/firebird/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/FPreparedStatement.cxx
@@ -89,9 +89,9 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
isc_db_handle db = _pConnection->getDBHandler(); // database handle
// enabling the XSQLDA to accommodate up to 10 select-list items (DEFAULT)
- XSQLDA *out_sqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(10));
- out_sqlda->version = SQLDA_VERSION1;
- out_sqlda->sqln = 10;
+ m_OUTsqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(10));
+ m_OUTsqlda->version = SQLDA_VERSION1;
+ m_OUTsqlda->sqln = 10;
m_STMTHandler = NULL; // Set handle to NULL before allocation.
if (isc_dsql_allocate_statement(status, &db, &m_STMTHandler))
@@ -111,27 +111,27 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
free(sqlStr);
// fill the output XSQLDA with information about the select-list items.
- if (isc_dsql_describe(status, &m_STMTHandler, 1, out_sqlda))
+ if (isc_dsql_describe(status, &m_STMTHandler, 1, m_OUTsqlda))
if (pr_error(status, "describe statement"))
return;
// determine if the output descriptor can accommodate the number of select-list
// items specified in the statement.
- if (out_sqlda->sqld > out_sqlda->sqln)
+ if (m_OUTsqlda->sqld > m_OUTsqlda->sqln)
{
- int n = out_sqlda->sqld;
- free(out_sqlda);
- out_sqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(n));
- out_sqlda->sqln = n;
- out_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe(status, &m_STMTHandler, 1, out_sqlda))
+ int n = m_OUTsqlda->sqld;
+ free(m_OUTsqlda);
+ m_OUTsqlda = (XSQLDA *)malloc(XSQLDA_LENGTH(n));
+ m_OUTsqlda->sqln = n;
+ m_OUTsqlda->version = SQLDA_VERSION1;
+ if (isc_dsql_describe(status, &m_STMTHandler, 1, m_OUTsqlda))
if (pr_error(status, "describe statement 2"))
return;
}
XSQLVAR *var = NULL;
int i, dtype;
- for (i=0, var = out_sqlda->sqlvar; i < out_sqlda->sqld; i++, var++)
+ for (i=0, var = m_OUTsqlda->sqlvar; i < m_OUTsqlda->sqld; i++, var++)
{
dtype = (var->sqltype & ~1); /* drop flag bit for now */
switch(dtype) {
@@ -146,7 +146,7 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
var->sqldata = (char *)malloc(sizeof(long));
break;
case SQL_SHORT:
- var->sqldata = (char *)malloc(sizeof(char));
+ var->sqldata = (char *)malloc(sizeof(char)*var->sqllen);
break;
case SQL_FLOAT:
var->sqldata = (char *)malloc(sizeof(double));
@@ -174,8 +174,6 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf
var->sqlind = (short *)malloc(sizeof(short));
}
}
-
- m_OUTsqlda = out_sqlda;
}
// -----------------------------------------------------------------------------
@@ -220,6 +218,8 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr
void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
{
+ printf("DEBUG !!! connectivity.firebird => OPreparedStatement::close() \n");
+
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx b/connectivity/source/drivers/firebird/FResultSet.cxx
index 895af3fd67a1..07d68d55f74b 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -152,6 +152,8 @@ OResultSet::~OResultSet()
// -------------------------------------------------------------------------
void OResultSet::disposing(void)
{
+ printf("DEBUG !!! connectivity.firebird => OResultSet::disposing() \n" );
+
OPropertySetHelper::disposing();
::osl::MutexGuard aGuard(m_aMutex);
@@ -462,6 +464,8 @@ void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
{
+ printf("DEBUG !!! connectivity.firebird => OResultSet::close() \n" );
+
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
diff --git a/connectivity/source/drivers/firebird/FStatement.cxx b/connectivity/source/drivers/firebird/FStatement.cxx
index 11b5d5cc3367..42195e84f336 100644
--- a/connectivity/source/drivers/firebird/FStatement.cxx
+++ b/connectivity/source/drivers/firebird/FStatement.cxx
@@ -85,7 +85,7 @@ void OStatement_Base::disposeResultSet()
//------------------------------------------------------------------------------
void OStatement_BASE2::disposing()
{
- printf("DEBUG !!! connectivity.firebird => OStatement_BASE2::disposing: \n");
+ printf("DEBUG !!! connectivity.firebird => OStatement_BASE2::disposing() \n");
::osl::MutexGuard aGuard(m_aMutex);
@@ -146,6 +146,8 @@ void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
{
+ printf("DEBUG !!! connectivity.firebird => OStatement_Base::close() \n");
+
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);