Kaydet (Commit) b0591b38 authored tarafından Javier Fernandez's avatar Javier Fernandez Kaydeden (comit) Andrzej J.R. Hunt

Adding debug info for tracking disposes and fixed a memory allocation bug.

Change-Id: Iae8a6dac26fd7d074ece6421ae61ecf7ce047b8f
üst 54060540
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
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