stop some leaked statement handles

Change-Id: I06764e0569ea615e66de6cd5946614c7c538e60e
Signed-off-by: Lionel Elie Mamane <lionel@mamane.lu>
This commit is contained in:
Terrence Enger 2012-07-18 14:46:11 -04:00 committed by Lionel Elie Mamane
parent ae56c4e025
commit 8cd92447d7
2 changed files with 3 additions and 19 deletions

View file

@ -66,7 +66,6 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection
,m_nCurrentFetchState(0)
,m_bWasNull(sal_True)
,m_bEOF(sal_False)
,m_bFreeHandle(sal_False)
{
OSL_ENSURE(m_pConnection,"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!");
if( SQL_NULL_HANDLE == m_aStatementHandle )
@ -96,8 +95,8 @@ void ODatabaseMetaDataResultSet::disposing(void)
OPropertySetHelper::disposing();
::osl::MutexGuard aGuard(m_aMutex);
if(m_bFreeHandle)
m_pConnection->freeStatementHandle(m_aStatementHandle);
m_pConnection->freeStatementHandle(m_aStatementHandle);
m_aStatement = NULL;
m_xMetaData.clear();
@ -846,7 +845,6 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS
const ::rtl::OUString& tableNamePattern,
const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
{
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
const ::rtl::OUString *pSchemaPat = NULL;
@ -894,7 +892,6 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS
//-----------------------------------------------------------------------------
void ODatabaseMetaDataResultSet::openTablesTypes( ) throw(SQLException, RuntimeException)
{
m_bFreeHandle = sal_True;
SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
0,0,
0,0,
@ -911,7 +908,6 @@ void ODatabaseMetaDataResultSet::openTablesTypes( ) throw(SQLException, RuntimeE
// -------------------------------------------------------------------------
void ODatabaseMetaDataResultSet::openCatalogs() throw(SQLException, RuntimeException)
{
m_bFreeHandle = sal_True;
SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
(SDB_ODBC_CHAR *) SQL_ALL_CATALOGS,SQL_NTS,
(SDB_ODBC_CHAR *) "",SQL_NTS,
@ -929,7 +925,6 @@ void ODatabaseMetaDataResultSet::openCatalogs() throw(SQLException, RuntimeExcep
// -------------------------------------------------------------------------
void ODatabaseMetaDataResultSet::openSchemas() throw(SQLException, RuntimeException)
{
m_bFreeHandle = sal_True;
SQLRETURN nRetcode = N3SQLTables(m_aStatementHandle,
(SDB_ODBC_CHAR *) "",SQL_NTS,
(SDB_ODBC_CHAR *) SQL_ALL_SCHEMAS,SQL_NTS,
@ -955,7 +950,6 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
@ -991,7 +985,6 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog,
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
@ -1060,7 +1053,6 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog,
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
@ -1095,7 +1087,6 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl:
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
@ -1140,7 +1131,6 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any&
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
@ -1179,8 +1169,6 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const ::rt
const Any& catalog2, const ::rtl::OUString* schema2,
const ::rtl::OUString* table2) throw(SQLException, RuntimeException)
{
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN, aFKQ, aFKO, aFKN;
if ( catalog.hasValue() )
aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding);
@ -1230,7 +1218,6 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const ::rtl
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN,aCOL;
if ( catalog.hasValue() )
@ -1260,7 +1247,6 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const :
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
if ( catalog.hasValue() )
@ -1291,7 +1277,6 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const ::rtl:
else
pSchemaPat = NULL;
m_bFreeHandle = sal_True;
::rtl::OString aPKQ,aPKO,aPKN;
if ( catalog.hasValue() )

View file

@ -66,7 +66,7 @@ namespace connectivity
::std::map<sal_Int32, ::connectivity::TInt2StringMap > m_aIntValueRange;
::std::map<sal_Int32,SWORD> m_aODBCColumnTypes;
SQLHANDLE m_aStatementHandle;
SQLHANDLE m_aStatementHandle; // ... until freed
SQLHANDLE m_aConnectionHandle;
::com::sun::star::uno::WeakReferenceHelper m_aStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
@ -79,7 +79,6 @@ namespace connectivity
SQLRETURN m_nCurrentFetchState;
sal_Bool m_bWasNull;
sal_Bool m_bEOF; // after last record
sal_Bool m_bFreeHandle;
// set the columncount of the driver
void checkColumnCount();