diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-08 11:29:19 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-09 09:45:50 +0000 |
commit | aaebe3c45d3ceac7aba19ad8fd5b1cb621e337b3 (patch) | |
tree | 132aaabeefe2f47ab38d7296dede066fdce03e6c /connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx | |
parent | a7415828b86a02216ffed44a4fa5b785f17d657c (diff) |
remove some manual ref-counting in connectivity
Change-Id: I0d00b4566c13817b296f237e993f4ce63ef0c664
Reviewed-on: https://gerrit.libreoffice.org/26053
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx')
-rw-r--r-- | connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 8160b8a1cd1a..d10f6c99bfa4 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -63,12 +63,11 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(OConnection* _pConnection ,m_bWasNull(true) ,m_bEOF(false) { - OSL_ENSURE(m_pConnection,"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!"); + OSL_ENSURE(m_pConnection.is(),"ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet: No parent set!"); if( SQL_NULL_HANDLE == m_aStatementHandle ) throw RuntimeException(); osl_atomic_increment( &m_refCount ); - m_pConnection->acquire(); m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value osl_atomic_decrement( &m_refCount ); // allocBuffer(); @@ -95,8 +94,8 @@ void ODatabaseMetaDataResultSet::disposing() m_pConnection->freeStatementHandle(m_aStatementHandle); m_aStatement = nullptr; -m_xMetaData.clear(); - m_pConnection->release(); + m_xMetaData.clear(); + m_pConnection.clear(); } Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception) @@ -175,7 +174,7 @@ template < typename T, SQLSMALLINT sqlTypeId > T ODatabaseMetaDataResultSet::get T nVal = 0; if(columnIndex <= m_nDriverColumnCount) { - getValue<T>(m_pConnection, m_aStatementHandle, columnIndex, sqlTypeId, m_bWasNull, **this, nVal); + getValue<T>(m_pConnection.get(), m_aStatementHandle, columnIndex, sqlTypeId, m_bWasNull, **this, nVal); if ( !m_aValueRange.empty() ) { @@ -220,7 +219,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex case DataType::BIT: { sal_Int8 nValue = 0; - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nValue,sizeof nValue); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BIT,m_bWasNull,**this,&nValue,sizeof nValue); bRet = nValue != 0; } break; @@ -255,11 +254,11 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co case DataType::VARCHAR: case DataType::LONGVARCHAR: { - OUString aRet = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding); + OUString aRet = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding); return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } } - return OTools::getBytesValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this); + return OTools::getBytesValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this); } else m_bWasNull = true; @@ -280,7 +279,7 @@ css::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIn aDate.day = 0; aDate.month = 0; aDate.year = 0; - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate); return Date(aDate.day,aDate.month,aDate.year); } else @@ -299,7 +298,7 @@ double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) t columnIndex = mapColumn(columnIndex); double nValue(0.0); if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nValue,sizeof nValue); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_DOUBLE,m_bWasNull,**this,&nValue,sizeof nValue); else m_bWasNull = true; return nValue; @@ -316,7 +315,7 @@ float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) thr columnIndex = mapColumn(columnIndex); float nVal(0); if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_FLOAT,m_bWasNull,**this,&nVal,sizeof nVal); else m_bWasNull = true; return nVal; @@ -345,7 +344,9 @@ Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData { checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - return m_xMetaData.is() ? m_xMetaData : (m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle)); + if (!m_xMetaData.is()) + m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle); + return m_xMetaData; } Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception) @@ -397,7 +398,7 @@ OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) columnIndex = mapColumn(columnIndex); OUString aVal; if(columnIndex <= m_nDriverColumnCount) - aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding); + aVal = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding); else m_bWasNull = true; @@ -415,7 +416,7 @@ css::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIn columnIndex = mapColumn(columnIndex); TIME_STRUCT aTime={0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime); else m_bWasNull = true; return Time(0, aTime.second,aTime.minute,aTime.hour, false); @@ -432,7 +433,7 @@ css::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex = mapColumn(columnIndex); TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP, m_bWasNull, **this, &aTime, sizeof aTime); + OTools::getValue(m_pConnection.get(),m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP, m_bWasNull, **this, &aTime, sizeof aTime); else m_bWasNull = true; return DateTime(aTime.fraction, aTime.second, aTime.minute, aTime.hour, @@ -515,7 +516,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, Runt m_bEOF = false; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_FIRST,0); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO ); if( bRet ) m_nRowPos = 1; @@ -530,7 +531,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, Runti m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_LAST,0); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); // here I know definitely that I stand on the last record bool bRet = ( m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO ); if( bRet ) @@ -547,7 +548,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQ m_bEOF = false; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_ABSOLUTE,row); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; if(bRet) m_nRowPos = row; @@ -563,7 +564,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQ m_bEOF = false; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_RELATIVE,row); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; if(bRet) m_nRowPos += row; @@ -579,7 +580,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, R m_bEOF = false; m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_PRIOR,0); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; if(bRet) --m_nRowPos; @@ -646,7 +647,7 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, Runti SQLRETURN nOldFetchStatus = m_nCurrentFetchState; // m_nCurrentFetchState = N3SQLFetchScroll(m_aStatementHandle,SQL_FETCH_NEXT,0); m_nCurrentFetchState = N3SQLFetch(m_aStatementHandle); - OTools::ThrowException(m_pConnection,m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),m_nCurrentFetchState,m_aStatementHandle,SQL_HANDLE_STMT,*this); bool bRet = m_nCurrentFetchState == SQL_SUCCESS || m_nCurrentFetchState == SQL_SUCCESS_WITH_INFO; if(bRet || ( m_nCurrentFetchState == SQL_NO_DATA && nOldFetchStatus != SQL_NO_DATA ) ) ++m_nRowPos; @@ -827,7 +828,7 @@ void ODatabaseMetaDataResultSet::openTypeInfo() throw(SQLException, RuntimeExcep m_aValueRange[2] = aMap; - OTools::ThrowException(m_pConnection,N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),N3SQLGetTypeInfo(m_aStatementHandle, SQL_ALL_TYPES),m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -875,7 +876,7 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const OUString& reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), pCOL ? SQL_NTS : 0); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -887,12 +888,12 @@ void ODatabaseMetaDataResultSet::openTablesTypes( ) throw(SQLException, RuntimeE nullptr,0, nullptr,0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_TABLE_TYPES)),SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); m_aColMapping.clear(); m_aColMapping.push_back(-1); m_aColMapping.push_back(4); - m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping); + m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping); checkColumnCount(); } @@ -904,12 +905,12 @@ void ODatabaseMetaDataResultSet::openCatalogs() throw(SQLException, RuntimeExcep reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); m_aColMapping.clear(); m_aColMapping.push_back(-1); m_aColMapping.push_back(1); - m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping); + m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping); checkColumnCount(); } @@ -920,12 +921,12 @@ void ODatabaseMetaDataResultSet::openSchemas() throw(SQLException, RuntimeExcept reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(SQL_ALL_SCHEMAS)),SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>("")),SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); m_aColMapping.clear(); m_aColMapping.push_back(-1); m_aColMapping.push_back(2); - m_xMetaData = new OResultSetMetaData(m_pConnection,m_aStatementHandle,m_aColMapping); + m_xMetaData = new OResultSetMetaData(m_pConnection.get(),m_aStatementHandle,m_aColMapping); checkColumnCount(); } @@ -959,7 +960,7 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 , reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -994,7 +995,7 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); TInt2IntMap aMap; aMap[SQL_BIT] = DataType::BIT; aMap[SQL_TINYINT] = DataType::TINYINT; @@ -1062,7 +1063,7 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pCOL)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1093,7 +1094,7 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const OUStri reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 , reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1138,7 +1139,7 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, (SQLSMALLINT)scope, nullable ? SQL_NULLABLE : SQL_NO_NULLS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1181,7 +1182,7 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const OUSt reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKO)), pFKO ? SQL_NTS : 0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pFKN)), SQL_NTS ); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1223,7 +1224,7 @@ void ODatabaseMetaDataResultSet::openPrimaryKeys(const Any& catalog, const OUStr reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 , reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1252,7 +1253,7 @@ void ODatabaseMetaDataResultSet::openTablePrivileges(const Any& catalog, const O reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKQ)), (catalog.hasValue() && !aPKQ.isEmpty()) ? SQL_NTS : 0, reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKO)), pPKO ? SQL_NTS : 0 , reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } @@ -1284,14 +1285,14 @@ void ODatabaseMetaDataResultSet::openIndexInfo( const Any& catalog, const OUStri reinterpret_cast<SDB_ODBC_CHAR *>(const_cast<char *>(pPKN)), SQL_NTS, unique ? SQL_INDEX_UNIQUE : SQL_INDEX_ALL, approximate ? 1 : 0); - OTools::ThrowException(m_pConnection,nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),nRetcode,m_aStatementHandle,SQL_HANDLE_STMT,*this); checkColumnCount(); } void ODatabaseMetaDataResultSet::checkColumnCount() { sal_Int16 nNumResultCols=0; - OTools::ThrowException(m_pConnection,N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this); + OTools::ThrowException(m_pConnection.get(),N3SQLNumResultCols(m_aStatementHandle,&nNumResultCols),m_aStatementHandle,SQL_HANDLE_STMT,*this); m_nDriverColumnCount = nNumResultCols; } @@ -1300,7 +1301,7 @@ SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnInd { ::std::map<sal_Int32,SWORD>::iterator aFind = m_aODBCColumnTypes.find(columnIndex); if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first; + aFind = m_aODBCColumnTypes.insert(::std::map<sal_Int32,SWORD>::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection.get(),m_aStatementHandle,*this,columnIndex))).first; return aFind->second; } |