[Libreoffice-commits] .: 3 commits - connectivity/source
Lionel Elie Mamane
lmamane at kemper.freedesktop.org
Thu Jul 19 02:51:48 PDT 2012
connectivity/source/drivers/odbcbase/OConnection.cxx | 3 +
connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx | 22 ++--------
connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx | 3 -
3 files changed, 9 insertions(+), 19 deletions(-)
New commits:
commit 8cd92447d78c4fe9f93e1a6ee3031b4d8d5ec477
Author: Terrence Enger <tenger at iseries-guru.com>
Date: Wed Jul 18 14:46:11 2012 -0400
stop some leaked statement handles
Change-Id: I06764e0569ea615e66de6cd5946614c7c538e60e
Signed-off-by: Lionel Elie Mamane <lionel at mamane.lu>
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 9d229fa..37040d4 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -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() )
diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
index e6e7f03..42d0348 100644
--- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx
@@ -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();
commit ae56c4e025aafddee2cc39a454ae98011e5dfa9e
Author: Terrence Enger <tenger at iseries-guru.com>
Date: Wed Jul 18 14:46:11 2012 -0400
ODBMetaDataRS ctor: abort if statement handle allocation failed
Change-Id: Ieac069565bbc14c909eeecf3e67588191191992f
Signed-off-by: Lionel Elie Mamane <lionel at mamane.lu>
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 953ccc5..9d229fa 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -69,6 +69,9 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection
,m_bFreeHandle(sal_False)
{
OSL_ENSURE(m_pConnection,"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!");
+ if( SQL_NULL_HANDLE == m_aStatementHandle )
+ throw RuntimeException();
+
osl_incrementInterlockedCount( &m_refCount );
m_pConnection->acquire();
m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
commit 1c3c15081f360892c929a4dd4cbeaaca907a1c89
Author: Terrence Enger <tenger at iseries-guru.com>
Date: Wed Jul 18 14:46:11 2012 -0400
avoid freeing the NULL handle
Change-Id: Id3f22bacfbf5e582656cc8ac38d60b781a25b4c3
Signed-off-by: Lionel Elie Mamane <lionel at mamane.lu>
diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
index c7ed89b..8f362d0 100644
--- a/connectivity/source/drivers/odbcbase/OConnection.cxx
+++ b/connectivity/source/drivers/odbcbase/OConnection.cxx
@@ -541,6 +541,9 @@ SQLHANDLE OConnection::createStatementHandle()
// -----------------------------------------------------------------------------
void OConnection::freeStatementHandle(SQLHANDLE& _pHandle)
{
+ if( SQL_NULL_HANDLE == _pHandle )
+ return;
+
::std::map< SQLHANDLE,OConnection*>::iterator aFind = m_aConnections.find(_pHandle);
N3SQLFreeStmt(_pHandle,SQL_RESET_PARAMS);
More information about the Libreoffice-commits
mailing list