diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-09-08 09:50:48 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-09-08 09:50:48 +0000 |
commit | 39e949c290b8ab1e063930380a8926afb0615dd0 (patch) | |
tree | b1871069c6ecb5bade5ce3dbafd88cdbbefa041d /connectivity/source/drivers | |
parent | CWS-TOOLING: integrate CWS dba32f (diff) | |
download | core-39e949c290b8ab1e063930380a8926afb0615dd0.tar.gz core-39e949c290b8ab1e063930380a8926afb0615dd0.zip |
CWS-TOOLING: integrate CWS dbaperf3
2009-08-28 08:04:41 +0200 oj r275515 : wrong replacement
2009-08-28 07:57:44 +0200 oj r275514 : declaration of 'nRealSize' shadows a previous local
2009-08-20 10:17:11 +0200 oj r275168 : CWS-TOOLING: rebase CWS dbaperf3 to trunk@275001 (milestone: DEV300:m55)
2009-08-19 11:50:49 +0200 oj r275145 : #ii102891# minimize metadata calls
2009-06-22 12:20:15 +0200 oj r273213 : compile error
2009-06-22 12:19:45 +0200 oj r273212 : compile error
2009-06-18 08:54:08 +0200 oj r273099 : #i102891# reduce calls to databasemetadata
2009-06-18 08:19:55 +0200 oj r273095 : #i102891# reduce calls to databasemetadata
Diffstat (limited to 'connectivity/source/drivers')
43 files changed, 217 insertions, 192 deletions
diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx index f30532cebc70..11add583ea4a 100644 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -223,10 +223,7 @@ Reference< XPreparedStatement > SAL_CALL OAdabasConnection::prepareStatement( co ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE2::rBHelper.bDisposed); - if(m_aTypeInfo.empty()) - buildTypeInfo(); - - Reference< XPreparedStatement > xReturn = new OAdabasPreparedStatement(this,m_aTypeInfo,sql); + Reference< XPreparedStatement > xReturn = new OAdabasPreparedStatement(this,sql); m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; } diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index 4bc0cc70c430..31dd0001fc11 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -317,7 +317,7 @@ void SAL_CALL ODriver::disposing( const EventObject& Source ) throw(RuntimeExcep } } } - m_xORB = NULL; + m_xORB.clear(); } } // -------------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BPreparedStatement.cxx b/connectivity/source/drivers/adabas/BPreparedStatement.cxx index 92ccab30af77..900c50da2b6a 100644 --- a/connectivity/source/drivers/adabas/BPreparedStatement.cxx +++ b/connectivity/source/drivers/adabas/BPreparedStatement.cxx @@ -48,8 +48,8 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; -OAdabasPreparedStatement::OAdabasPreparedStatement( OAdabasConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql) -: ::connectivity::odbc::OPreparedStatement( _pConnection,_TypeInfo,sql) +OAdabasPreparedStatement::OAdabasPreparedStatement( OAdabasConnection* _pConnection,const ::rtl::OUString& sql) +: ::connectivity::odbc::OPreparedStatement( _pConnection,sql) { m_aSelectColumns = _pConnection->createSelectColumns(sql); } diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx index 1f301d5fda94..86b8df2fd795 100644 --- a/connectivity/source/drivers/adabas/BTables.cxx +++ b/connectivity/source/drivers/adabas/BTables.cxx @@ -96,7 +96,7 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx index 6c8f40eaef9d..5a7fda021701 100644 --- a/connectivity/source/drivers/adabas/BViews.cxx +++ b/connectivity/source/drivers/adabas/BViews.cxx @@ -110,7 +110,7 @@ void OViews::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OViews::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index af97d312ea8e..afd050d6cda2 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -100,7 +100,7 @@ void ODatabaseMetaDataResultSet::disposing(void) if(m_pRecordSet) m_pRecordSet->Close(); m_aStatement = NULL; - m_xMetaData = NULL; +m_xMetaData.clear(); } // ------------------------------------------------------------------------- Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 9c8adc7aa79f..59d33f40385b 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -39,6 +39,8 @@ #include <com/sun/star/lang/DisposedException.hpp> #include "connectivity/dbexception.hxx" #include "resource/ado_res.hrc" +#include <Objbase.h> + #include "resource/sharedresources.hxx" @@ -57,12 +59,19 @@ ODriver::ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang: : ODriver_BASE(m_aMutex) ,m_xORB(_xORB) { - CoInitialize(NULL); + if ( FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)) ) + { + CoUninitialize(); + int h = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + (void)h; + ++h; + } } // ------------------------------------------------------------------------- ODriver::~ODriver() { CoUninitialize(); + CoInitialize(NULL); } //------------------------------------------------------------------------------ void ODriver::disposing() diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx index ac05163d416f..839c34513c62 100644 --- a/connectivity/source/drivers/ado/APreparedStatement.cxx +++ b/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -135,7 +135,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr // ------------------------------------------------------------------------- void OPreparedStatement::disposing() { - m_xMetaData = NULL; +m_xMetaData.clear(); if (m_pParameters) { m_pParameters->Release(); @@ -295,7 +295,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE // first clear the old things - m_xMetaData = NULL; +m_xMetaData.clear(); disposeResultSet(); if(m_RecordSet.IsValid()) m_RecordSet.Close(); diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index 5326a2ba4143..1c53614bba04 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -139,8 +139,8 @@ void OResultSet::disposing(void) ::osl::MutexGuard aGuard(m_aMutex); if(m_pRecordSet) m_pRecordSet->Close(); - m_xStatement = NULL; - m_xMetaData = NULL; +m_xStatement.clear(); +m_xMetaData.clear(); } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/ado/Aservices.cxx b/connectivity/source/drivers/ado/Aservices.cxx index 5a2817f628e9..e3c855f6b042 100644 --- a/connectivity/source/drivers/ado/Aservices.cxx +++ b/connectivity/source/drivers/ado/Aservices.cxx @@ -121,7 +121,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( uno_Environment ** /*ppEnv*/ ) { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ":affine"; } //--------------------------------------------------------------------------------------- @@ -143,7 +143,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( } catch (::com::sun::star::registry::InvalidRegistryException& ) { - OSL_ENSURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); + OSL_ENSURE(sal_False, "ADO::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); } return sal_False; diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index d4a83249098a..1db81262e120 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -1765,7 +1765,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const m_pColumns->getByIndex(i) >>= xCol; OSL_ENSURE(xCol.is(),"ODbaseTable::UpdateBuffer column is null!"); xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName; - xCol = NULL; + xCol.clear(); } // if ( !aColName.getLength() ) const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_DUPLICATE_VALUE_IN_COLUMN diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx index fc024fa293e5..9e2eddb8750a 100644 --- a/connectivity/source/drivers/evoab2/NDriver.cxx +++ b/connectivity/source/drivers/evoab2/NDriver.cxx @@ -82,7 +82,7 @@ void OEvoabDriver::disposing() xComp->dispose(); } catch (com::sun::star::lang::DisposedException e) { - xComp=NULL; + xComp.clear(); } } } diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index ec3f9fe7e99b..d71908e0afd8 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -579,7 +579,7 @@ void OEvoabResultSet::disposing(void) g_list_free(m_pContacts); m_pContacts = NULL; m_pStatement = NULL; - m_xMetaData = NULL; +m_xMetaData.clear(); } // ------------------------------------------------------------------------- Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException) diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 6cc1ceb11f03..2ddcd84c87a0 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -463,7 +463,7 @@ rtl::OUString OCommonStatement::getTableName() if( m_aSQLIterator.isTableNode( pAllTableNames->getChild( 0 ) ) ) OSQLParseNode::getTableComponents( pAllTableNames->getChild( 0 ), - aCatalog,aSchema, aTableName ); + aCatalog,aSchema, aTableName,NULL ); else if( SQL_ISRULE( pAllTableNames->getChild( 0 ), table_ref ) ) { @@ -472,7 +472,7 @@ rtl::OUString OCommonStatement::getTableName() { aTableName = OSQLParseNode::getTableRange(pAllTableNames->getChild( 0 )); if( !aTableName.getLength() ) - OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName); + OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName,NULL); } else OSL_ENSURE( false, "odd table layout" ); diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx index 21630ec62a1e..804248435ae6 100644 --- a/connectivity/source/drivers/evoab2/NTables.cxx +++ b/connectivity/source/drivers/evoab2/NTables.cxx @@ -101,7 +101,7 @@ void OEvoabTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OEvoabTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index 8f51eedc1cfe..79eb15aa6648 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -58,7 +58,7 @@ void SAL_CALL OFileCatalog::disposing() ::osl::MutexGuard aGuard(m_aMutex); typedef connectivity::sdbcx::OCatalog OFileCatalog_BASE; - m_xMetaData = NULL; +m_xMetaData.clear(); OFileCatalog_BASE::disposing(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 4fb0583e281b..52d14e6498cb 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -383,8 +383,8 @@ void OConnection::disposing() OConnection_BASE::disposing(); m_bClosed = sal_True; - m_xDir = NULL; - m_xContent = NULL; +m_xDir.clear(); +m_xContent.clear(); m_xCatalog = WeakReference< XTablesSupplier>(); dispose_ChildImpl(); diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 722037ae6ea6..b55276c3b17d 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -98,9 +98,7 @@ void OPreparedStatement::disposing() } m_xParamColumns = NULL; - - - m_xMetaData = NULL; + m_xMetaData.clear(); if(m_aParameterRow.isValid()) { m_aParameterRow->get().clear(); diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index d96245c06cda..dbc2162f9d73 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -174,13 +174,13 @@ void OResultSet::disposing(void) OPropertySetHelper::disposing(); ::osl::MutexGuard aGuard(m_aMutex); - m_xStatement = NULL; - m_xMetaData = NULL; + m_xStatement.clear(); + m_xMetaData.clear(); m_pParseTree = NULL; - m_xColNames = NULL; - m_xColumns = NULL; + m_xColNames.clear(); + m_xColumns = NULL; m_xParamColumns = NULL; - m_xColsIdx = NULL; + m_xColsIdx.clear(); Reference<XComponent> xComp = m_pTable; if ( xComp.is() ) diff --git a/connectivity/source/drivers/file/FTables.cxx b/connectivity/source/drivers/file/FTables.cxx index 0862c3803b31..5da29306e475 100644 --- a/connectivity/source/drivers/file/FTables.cxx +++ b/connectivity/source/drivers/file/FTables.cxx @@ -68,7 +68,7 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } //------------------------------------------------------------------ diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 9c801d6d9b98..04d38ddfc5ee 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -79,7 +79,7 @@ void OPredicateCompiler::dispose() { Clean(); m_orgColumns = NULL; - m_xIndexes = NULL; +m_xIndexes.clear(); } //------------------------------------------------------------------ // inline OCursor& OPredicateCompiler::Cursor() const {return m_rCursor;} diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index aa03e5f1f29f..2da6e2496b0f 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -64,12 +64,12 @@ namespace connectivity { try { - m_xStream = NULL; - m_xSeek = NULL; + m_xStream.clear(); + m_xSeek.clear(); if ( m_xInputStream.is() ) { m_xInputStream->closeInput(); - m_xInputStream = NULL; + m_xInputStream.clear(); } if ( m_xOutputStream.is() ) { @@ -86,7 +86,7 @@ namespace connectivity OSL_UNUSED( e ); OSL_ENSURE(0,"Could not dispose OutputStream"); } - m_xOutputStream = NULL; + m_xOutputStream.clear(); } } catch(Exception& ) diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx index 5edff4cc7944..6cf19812b9f2 100644 --- a/connectivity/source/drivers/hsqldb/HTables.cxx +++ b/connectivity/source/drivers/hsqldb/HTables.cxx @@ -113,7 +113,7 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/hsqldb/HViews.cxx b/connectivity/source/drivers/hsqldb/HViews.cxx index 558f938a8e35..c3a07447c209 100644 --- a/connectivity/source/drivers/hsqldb/HViews.cxx +++ b/connectivity/source/drivers/hsqldb/HViews.cxx @@ -93,7 +93,7 @@ void HViews::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void HViews::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 7d2bafa0d29c..333a836e919f 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -118,7 +118,7 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin java_sql_Connection* pConnection = new java_sql_Connection( *this ); xOut = pConnection; if ( !pConnection->construct(url,info) ) - xOut = NULL; // an error occured and the java driver didn't throw an exception + xOut.clear(); // an error occured and the java driver didn't throw an exception else m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS ); } diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index 4728586ad4d0..677985ac6a90 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -116,7 +116,7 @@ void java_sql_ResultSet::disposing(void) OPropertySetHelper::disposing(); ::osl::MutexGuard aGuard(m_aMutex); - m_xMetaData = NULL; +m_xMetaData.clear(); if( object ) { SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); diff --git a/connectivity/source/drivers/kab/KResultSet.cxx b/connectivity/source/drivers/kab/KResultSet.cxx index 28c9877914ac..d05d757c9dac 100644 --- a/connectivity/source/drivers/kab/KResultSet.cxx +++ b/connectivity/source/drivers/kab/KResultSet.cxx @@ -124,8 +124,8 @@ void KabResultSet::disposing() ::osl::MutexGuard aGuard(m_aMutex); - m_xStatement = NULL; - m_xMetaData = NULL; +m_xStatement.clear(); +m_xMetaData.clear(); } // ------------------------------------------------------------------------- Any SAL_CALL KabResultSet::queryInterface(const Type & rType) throw(RuntimeException) diff --git a/connectivity/source/drivers/kab/KTables.cxx b/connectivity/source/drivers/kab/KTables.cxx index 88ccecc188ac..a672f983e8aa 100644 --- a/connectivity/source/drivers/kab/KTables.cxx +++ b/connectivity/source/drivers/kab/KTables.cxx @@ -88,6 +88,6 @@ void KabTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void KabTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx index 955a3998b39a..50417b1f6a0f 100755 --- a/connectivity/source/drivers/macab/MacabResultSet.cxx +++ b/connectivity/source/drivers/macab/MacabResultSet.cxx @@ -151,8 +151,8 @@ void MacabResultSet::disposing() ::osl::MutexGuard aGuard(m_aMutex); - m_xStatement = NULL; - m_xMetaData = NULL; +m_xStatement.clear(); +m_xMetaData.clear(); } // ------------------------------------------------------------------------- Any SAL_CALL MacabResultSet::queryInterface(const Type & rType) throw(RuntimeException) diff --git a/connectivity/source/drivers/macab/MacabTables.cxx b/connectivity/source/drivers/macab/MacabTables.cxx index 9d1e4d1cbc35..1c386711e992 100755 --- a/connectivity/source/drivers/macab/MacabTables.cxx +++ b/connectivity/source/drivers/macab/MacabTables.cxx @@ -88,6 +88,6 @@ void MacabTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void MacabTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index 8cec9c18f635..098fc8b9e055 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -91,7 +91,7 @@ void SAL_CALL OPreparedStatement::disposing() OCommonStatement::disposing(); - m_xMetaData = NULL; + m_xMetaData.clear(); if(m_aParameterRow.isValid()) { m_aParameterRow->get().clear(); diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index 18106375f252..8e0193f303c8 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -139,10 +139,10 @@ void OResultSet::disposing(void) ::osl::MutexGuard aGuard(m_aMutex); - m_xStatement = NULL; - m_xMetaData = NULL; + m_xStatement.clear(); + m_xMetaData.clear(); m_pParseTree = NULL; - m_xColumns = NULL; + m_xColumns = NULL; m_xParamColumns = NULL; m_pKeySet = NULL; if(m_pTable) diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx index 855f3580b797..aad7be864cd5 100644 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx +++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx @@ -50,7 +50,7 @@ using namespace ::comphelper; // ------------------------------------------------------------------------- OResultSetMetaData::~OResultSetMetaData() { - m_xColumns = NULL; + m_xColumns = NULL; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx index 99f12ccc501c..4fa686b1c6a8 100644 --- a/connectivity/source/drivers/mozab/MTables.cxx +++ b/connectivity/source/drivers/mozab/MTables.cxx @@ -100,7 +100,7 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index b835909d2c63..d60deb22df7d 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -130,7 +130,7 @@ void OTables::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OTables::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mysql/YViews.cxx b/connectivity/source/drivers/mysql/YViews.cxx index c90445718842..0f8807c91f26 100644 --- a/connectivity/source/drivers/mysql/YViews.cxx +++ b/connectivity/source/drivers/mysql/YViews.cxx @@ -87,7 +87,7 @@ void OViews::impl_refresh( ) throw(RuntimeException) // ------------------------------------------------------------------------- void OViews::disposing(void) { - m_xMetaData = NULL; +m_xMetaData.clear(); OCollection::disposing(); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx index 40a14531553c..0a86ed7b9f18 100644 --- a/connectivity/source/drivers/odbcbase/OConnection.cxx +++ b/connectivity/source/drivers/odbcbase/OConnection.cxx @@ -69,6 +69,7 @@ OConnection::OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver) ,m_bParameterSubstitution(sal_False) ,m_bIgnoreDriverPrivileges(sal_False) ,m_bPreventGetVersionColumns(sal_False) + ,m_bReadOnly(sal_True) { m_pDriver->acquire(); } @@ -104,7 +105,6 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int if (m_aConnectionHandle == SQL_NULL_HANDLE) return -1; - sal_Bool bReadOnly; //weil Methode statisch hier noch einmal ein lokales bReadOnly SQLRETURN nSQLRETURN = 0; SDB_ODBC_CHAR szConnStrOut[4096]; SDB_ODBC_CHAR szConnStrIn[2048]; @@ -153,11 +153,11 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int { ::rtl::OUString aVal; OTools::GetInfo(this,m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aVal,*this,getTextEncoding()); - bReadOnly = !aVal.compareToAscii("Y"); + m_bReadOnly = !aVal.compareToAscii("Y"); } catch(Exception&) { - bReadOnly = sal_True; + m_bReadOnly = sal_True; } try { @@ -172,7 +172,7 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int // autocoomit ist immer default - if (!bReadOnly) + if (!m_bReadOnly) N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_AUTOCOMMIT,(SQLPOINTER)SQL_AUTOCOMMIT_ON,SQL_IS_INTEGER); return nSQLRETURN; @@ -299,10 +299,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - if(m_aTypeInfo.empty()) - buildTypeInfo(); - - Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,m_aTypeInfo,sql); + Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,sql); m_aStatements.push_back(WeakReferenceHelper(xReturn)); return xReturn; } @@ -399,15 +396,10 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, m_aConnectionHandle,SQL_HANDLE_DBC,*this); } // -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) +sal_Bool SAL_CALL OConnection::isReadOnly() throw(SQLException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - - ::rtl::OUString aValue; - OTools::GetInfo(this,m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aValue,*this,getTextEncoding()); - return !aValue.compareToAscii("Y"); + // const member which will initialized only once + return m_bReadOnly; } // -------------------------------------------------------------------------------- void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx index 79baeac3cadc..b92206199c24 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx @@ -43,6 +43,7 @@ #include "stdio.h" #include "TPrivilegesResultSet.hxx" #include <connectivity/dbexception.hxx> +#include <rtl/ustrbuf.hxx> using namespace connectivity::odbc; using namespace com::sun::star::uno; @@ -830,9 +831,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aValue; - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aValue,*this,m_pConnection->getTextEncoding()); - return aValue.toChar() == 'Y'; + return m_pConnection->isReadOnly(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) @@ -1324,186 +1323,197 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeExc ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) { SQLUINTEGER nValue; - ::rtl::OUString aValue; + ::rtl::OUStringBuffer aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this); if(nValue & SQL_FN_STR_ASCII) - aValue = ::rtl::OUString::createFromAscii("ASCII,"); + aValue.appendAscii("ASCII,"); if(nValue & SQL_FN_STR_BIT_LENGTH) - aValue += ::rtl::OUString::createFromAscii("BIT_LENGTH,"); + aValue.appendAscii("BIT_LENGTH,"); if(nValue & SQL_FN_STR_CHAR) - aValue += ::rtl::OUString::createFromAscii("CHAR,"); + aValue.appendAscii("CHAR,"); if(nValue & SQL_FN_STR_CHAR_LENGTH) - aValue += ::rtl::OUString::createFromAscii("CHAR_LENGTH,"); + aValue.appendAscii("CHAR_LENGTH,"); if(nValue & SQL_FN_STR_CHARACTER_LENGTH) - aValue += ::rtl::OUString::createFromAscii("CHARACTER_LENGTH,"); + aValue.appendAscii("CHARACTER_LENGTH,"); if(nValue & SQL_FN_STR_CONCAT) - aValue += ::rtl::OUString::createFromAscii("CONCAT,"); + aValue.appendAscii("CONCAT,"); if(nValue & SQL_FN_STR_DIFFERENCE) - aValue += ::rtl::OUString::createFromAscii("DIFFERENCE,"); + aValue.appendAscii("DIFFERENCE,"); if(nValue & SQL_FN_STR_INSERT) - aValue += ::rtl::OUString::createFromAscii("INSERT,"); + aValue.appendAscii("INSERT,"); if(nValue & SQL_FN_STR_LCASE) - aValue += ::rtl::OUString::createFromAscii("LCASE,"); + aValue.appendAscii("LCASE,"); if(nValue & SQL_FN_STR_LEFT) - aValue += ::rtl::OUString::createFromAscii("LEFT,"); + aValue.appendAscii("LEFT,"); if(nValue & SQL_FN_STR_LENGTH) - aValue += ::rtl::OUString::createFromAscii("LENGTH,"); + aValue.appendAscii("LENGTH,"); if(nValue & SQL_FN_STR_LOCATE) - aValue += ::rtl::OUString::createFromAscii("LOCATE,"); + aValue.appendAscii("LOCATE,"); if(nValue & SQL_FN_STR_LOCATE_2) - aValue += ::rtl::OUString::createFromAscii("LOCATE_2,"); + aValue.appendAscii("LOCATE_2,"); if(nValue & SQL_FN_STR_LTRIM) - aValue += ::rtl::OUString::createFromAscii("LTRIM,"); + aValue.appendAscii("LTRIM,"); if(nValue & SQL_FN_STR_OCTET_LENGTH) - aValue += ::rtl::OUString::createFromAscii("OCTET_LENGTH,"); + aValue.appendAscii("OCTET_LENGTH,"); if(nValue & SQL_FN_STR_POSITION) - aValue += ::rtl::OUString::createFromAscii("POSITION,"); + aValue.appendAscii("POSITION,"); if(nValue & SQL_FN_STR_REPEAT) - aValue += ::rtl::OUString::createFromAscii("REPEAT,"); + aValue.appendAscii("REPEAT,"); if(nValue & SQL_FN_STR_REPLACE) - aValue += ::rtl::OUString::createFromAscii("REPLACE,"); + aValue.appendAscii("REPLACE,"); if(nValue & SQL_FN_STR_RIGHT) - aValue += ::rtl::OUString::createFromAscii("RIGHT,"); + aValue.appendAscii("RIGHT,"); if(nValue & SQL_FN_STR_RTRIM) - aValue += ::rtl::OUString::createFromAscii("RTRIM,"); + aValue.appendAscii("RTRIM,"); if(nValue & SQL_FN_STR_SOUNDEX) - aValue += ::rtl::OUString::createFromAscii("SOUNDEX,"); + aValue.appendAscii("SOUNDEX,"); if(nValue & SQL_FN_STR_SPACE) - aValue += ::rtl::OUString::createFromAscii("SPACE,"); + aValue.appendAscii("SPACE,"); if(nValue & SQL_FN_STR_SUBSTRING) - aValue += ::rtl::OUString::createFromAscii("SUBSTRING,"); + aValue.appendAscii("SUBSTRING,"); if(nValue & SQL_FN_STR_UCASE) - aValue += ::rtl::OUString::createFromAscii("UCASE,"); + aValue.appendAscii("UCASE,"); - return aValue.copy(0,aValue.lastIndexOf(',')); + if ( aValue.getLength() ) + aValue.setLength(aValue.getLength()-1); + + return aValue.makeStringAndClear(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) { SQLUINTEGER nValue; - ::rtl::OUString aValue; + ::rtl::OUStringBuffer aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this); if(nValue & SQL_FN_TD_CURRENT_DATE) - aValue = ::rtl::OUString::createFromAscii("CURRENT_DATE,"); + aValue.appendAscii("CURRENT_DATE,"); if(nValue & SQL_FN_TD_CURRENT_TIME) - aValue += ::rtl::OUString::createFromAscii("CURRENT_TIME,"); + aValue.appendAscii("CURRENT_TIME,"); if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP) - aValue += ::rtl::OUString::createFromAscii("CURRENT_TIMESTAMP,"); + aValue.appendAscii("CURRENT_TIMESTAMP,"); if(nValue & SQL_FN_TD_CURDATE) - aValue += ::rtl::OUString::createFromAscii("CURDATE,"); + aValue.appendAscii("CURDATE,"); if(nValue & SQL_FN_TD_CURTIME) - aValue += ::rtl::OUString::createFromAscii("CURTIME,"); + aValue.appendAscii("CURTIME,"); if(nValue & SQL_FN_TD_DAYNAME) - aValue += ::rtl::OUString::createFromAscii("DAYNAME,"); + aValue.appendAscii("DAYNAME,"); if(nValue & SQL_FN_TD_DAYOFMONTH) - aValue += ::rtl::OUString::createFromAscii("DAYOFMONTH,"); + aValue.appendAscii("DAYOFMONTH,"); if(nValue & SQL_FN_TD_DAYOFWEEK) - aValue += ::rtl::OUString::createFromAscii("DAYOFWEEK,"); + aValue.appendAscii("DAYOFWEEK,"); if(nValue & SQL_FN_TD_DAYOFYEAR) - aValue += ::rtl::OUString::createFromAscii("DAYOFYEAR,"); + aValue.appendAscii("DAYOFYEAR,"); if(nValue & SQL_FN_TD_EXTRACT) - aValue += ::rtl::OUString::createFromAscii("EXTRACT,"); + aValue.appendAscii("EXTRACT,"); if(nValue & SQL_FN_TD_HOUR) - aValue += ::rtl::OUString::createFromAscii("HOUR,"); + aValue.appendAscii("HOUR,"); if(nValue & SQL_FN_TD_MINUTE) - aValue += ::rtl::OUString::createFromAscii("MINUTE,"); + aValue.appendAscii("MINUTE,"); if(nValue & SQL_FN_TD_MONTH) - aValue += ::rtl::OUString::createFromAscii("MONTH,"); + aValue.appendAscii("MONTH,"); if(nValue & SQL_FN_TD_MONTHNAME) - aValue += ::rtl::OUString::createFromAscii("MONTHNAME,"); + aValue.appendAscii("MONTHNAME,"); if(nValue & SQL_FN_TD_NOW) - aValue += ::rtl::OUString::createFromAscii("NOW,"); + aValue.appendAscii("NOW,"); if(nValue & SQL_FN_TD_QUARTER) - aValue += ::rtl::OUString::createFromAscii("QUARTER,"); + aValue.appendAscii("QUARTER,"); if(nValue & SQL_FN_TD_SECOND) - aValue += ::rtl::OUString::createFromAscii("SECOND,"); + aValue.appendAscii("SECOND,"); if(nValue & SQL_FN_TD_TIMESTAMPADD) - aValue += ::rtl::OUString::createFromAscii("TIMESTAMPADD,"); + aValue.appendAscii("TIMESTAMPADD,"); if(nValue & SQL_FN_TD_TIMESTAMPDIFF) - aValue += ::rtl::OUString::createFromAscii("TIMESTAMPDIFF,"); + aValue.appendAscii("TIMESTAMPDIFF,"); if(nValue & SQL_FN_TD_WEEK) - aValue += ::rtl::OUString::createFromAscii("WEEK,"); + aValue.appendAscii("WEEK,"); if(nValue & SQL_FN_TD_YEAR) - aValue += ::rtl::OUString::createFromAscii("YEAR,"); + aValue.appendAscii("YEAR,"); - return aValue.copy(0,aValue.lastIndexOf(',')); + if ( aValue.getLength() ) + aValue.setLength(aValue.getLength()-1); + + return aValue.makeStringAndClear(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) { SQLUINTEGER nValue; - ::rtl::OUString aValue; + ::rtl::OUStringBuffer aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this); if(nValue & SQL_FN_SYS_DBNAME) - aValue += ::rtl::OUString::createFromAscii("DBNAME,"); + aValue.appendAscii("DBNAME,"); if(nValue & SQL_FN_SYS_IFNULL) - aValue += ::rtl::OUString::createFromAscii("IFNULL,"); + aValue.appendAscii("IFNULL,"); if(nValue & SQL_FN_SYS_USERNAME) - aValue += ::rtl::OUString::createFromAscii("USERNAME,"); + aValue.appendAscii("USERNAME,"); - return aValue.copy(0,aValue.lastIndexOf(',')); + if ( aValue.getLength() ) + aValue.setLength(aValue.getLength()-1); + + return aValue.makeStringAndClear(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) { SQLUINTEGER nValue; - ::rtl::OUString aValue; + ::rtl::OUStringBuffer aValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this); if(nValue & SQL_FN_NUM_ABS) - aValue += ::rtl::OUString::createFromAscii("ABS,"); + aValue.appendAscii("ABS,"); if(nValue & SQL_FN_NUM_ACOS) - aValue += ::rtl::OUString::createFromAscii("ACOS,"); + aValue.appendAscii("ACOS,"); if(nValue & SQL_FN_NUM_ASIN) - aValue += ::rtl::OUString::createFromAscii("ASIN,"); + aValue.appendAscii("ASIN,"); if(nValue & SQL_FN_NUM_ATAN) - aValue += ::rtl::OUString::createFromAscii("ATAN,"); + aValue.appendAscii("ATAN,"); if(nValue & SQL_FN_NUM_ATAN2) - aValue += ::rtl::OUString::createFromAscii("ATAN2,"); + aValue.appendAscii("ATAN2,"); if(nValue & SQL_FN_NUM_CEILING) - aValue += ::rtl::OUString::createFromAscii("CEILING,"); + aValue.appendAscii("CEILING,"); if(nValue & SQL_FN_NUM_COS) - aValue += ::rtl::OUString::createFromAscii("COS,"); + aValue.appendAscii("COS,"); if(nValue & SQL_FN_NUM_COT) - aValue += ::rtl::OUString::createFromAscii("COT,"); + aValue.appendAscii("COT,"); if(nValue & SQL_FN_NUM_DEGREES) - aValue += ::rtl::OUString::createFromAscii("DEGREES,"); + aValue.appendAscii("DEGREES,"); if(nValue & SQL_FN_NUM_EXP) - aValue += ::rtl::OUString::createFromAscii("EXP,"); + aValue.appendAscii("EXP,"); if(nValue & SQL_FN_NUM_FLOOR) - aValue += ::rtl::OUString::createFromAscii("FLOOR,"); + aValue.appendAscii("FLOOR,"); if(nValue & SQL_FN_NUM_LOG) - aValue += ::rtl::OUString::createFromAscii("LOGF,"); + aValue.appendAscii("LOGF,"); if(nValue & SQL_FN_NUM_LOG10) - aValue += ::rtl::OUString::createFromAscii("LOG10,"); + aValue.appendAscii("LOG10,"); if(nValue & SQL_FN_NUM_MOD) - aValue += ::rtl::OUString::createFromAscii("MOD,"); + aValue.appendAscii("MOD,"); if(nValue & SQL_FN_NUM_PI) - aValue += ::rtl::OUString::createFromAscii("PI,"); + aValue.appendAscii("PI,"); if(nValue & SQL_FN_NUM_POWER) - aValue += ::rtl::OUString::createFromAscii("POWER,"); + aValue.appendAscii("POWER,"); if(nValue & SQL_FN_NUM_RADIANS) - aValue += ::rtl::OUString::createFromAscii("RADIANS,"); + aValue.appendAscii("RADIANS,"); if(nValue & SQL_FN_NUM_RAND) - aValue += ::rtl::OUString::createFromAscii("RAND,"); + aValue.appendAscii("RAND,"); if(nValue & SQL_FN_NUM_ROUND) - aValue += ::rtl::OUString::createFromAscii("ROUND,"); + aValue.appendAscii("ROUND,"); if(nValue & SQL_FN_NUM_SIGN) - aValue += ::rtl::OUString::createFromAscii("SIGN,"); + aValue.appendAscii("SIGN,"); if(nValue & SQL_FN_NUM_SIN) - aValue += ::rtl::OUString::createFromAscii("SIN,"); + aValue.appendAscii("SIN,"); if(nValue & SQL_FN_NUM_SQRT) - aValue += ::rtl::OUString::createFromAscii("SQRT,"); + aValue.appendAscii("SQRT,"); if(nValue & SQL_FN_NUM_TAN) - aValue += ::rtl::OUString::createFromAscii("TAN,"); + aValue.appendAscii("TAN,"); if(nValue & SQL_FN_NUM_TRUNCATE) - aValue += ::rtl::OUString::createFromAscii("TRUNCATE,"); + aValue.appendAscii("TRUNCATE,"); + if ( aValue.getLength() ) + aValue.setLength(aValue.getLength()-1); - return aValue.copy(0,aValue.lastIndexOf(',')); + return aValue.makeStringAndClear(); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index dd91861062b6..77ecceeaacdf 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -112,7 +112,7 @@ void ODatabaseMetaDataResultSet::disposing(void) m_pConnection->freeStatementHandle(m_aStatementHandle); m_aStatement = NULL; - m_xMetaData = NULL; +m_xMetaData.clear(); m_pConnection->release(); } // ------------------------------------------------------------------------- @@ -434,7 +434,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) columnIndex = mapColumn(columnIndex); ::rtl::OUString aVal; if(columnIndex <= m_nDriverColumnCount) - aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,(SWORD)getMetaData()->getColumnType(columnIndex),m_bWasNull,**this,m_nTextEncoding); + aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,(SWORD)SQL_C_WCHAR,m_bWasNull,**this,m_nTextEncoding); else m_bWasNull = sal_True; @@ -880,7 +880,8 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS else pSchemaPat = NULL; - aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); + if ( catalog.hasValue() ) + aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, @@ -1179,8 +1180,10 @@ void ODatabaseMetaDataResultSet::openForeignKeys( const Any& catalog, const ::rt m_bFreeHandle = sal_True; ::rtl::OString aPKQ,aPKO,aPKN, aFKQ, aFKO, aFKN; - aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); - aFKQ = ::rtl::OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding); + if ( catalog.hasValue() ) + aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); + if ( catalog2.hasValue() ) + aFKQ = ::rtl::OUStringToOString(comphelper::getString(catalog2),m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = schema && schema->getLength() ? ::rtl::OUStringToOString(*schema,m_nTextEncoding).getStr() : NULL, diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx index 0a798092c742..655006d1f8e4 100644 --- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @@ -65,9 +65,8 @@ using namespace com::sun::star::util; IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement"); -OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql) +OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql) :OStatement_BASE2(_pConnection) - ,m_aTypeInfo(_TypeInfo) ,numParams(0) ,boundParams(NULL) ,m_bPrepared(sal_False) @@ -80,12 +79,11 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInf OSQLParser aParser(_pConnection->getDriver()->getORB()); ::rtl::OUString sErrorMessage; ::rtl::OUString sNewSql; - OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,sql); - if(pNode) + ::std::auto_ptr<OSQLParseNode> pNode( aParser.parseTree(sErrorMessage,sql) ); + if ( pNode.get() ) { // special handling for parameters - OSQLParseNode::substituteParameterNames(pNode); + OSQLParseNode::substituteParameterNames(pNode.get()); pNode->parseNodeToStr( sNewSql, _pConnection ); - delete pNode; m_sSqlStatement = sNewSql; } } @@ -819,12 +817,18 @@ sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType) checkDisposed(OStatement_BASE::rBHelper.bDisposed); sal_Int32 prec = -1; - if (m_aTypeInfo.size()) + const TTypeInfoVector& rTypeInfo = m_pConnection->getTypeInfo(); + if ( !rTypeInfo.empty() ) + { + m_pConnection->buildTypeInfo(); + } + + if ( !rTypeInfo.empty() ) { OTypeInfo aInfo; aInfo.nType = (sal_Int16)sqlType; - TTypeInfoVector::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo); - if(aIter != m_aTypeInfo.end()) + TTypeInfoVector::const_iterator aIter = ::std::find(rTypeInfo.begin(),rTypeInfo.end(),aInfo); + if(aIter != rTypeInfo.end()) prec = (*aIter).nPrecision; } return prec; diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index 4ff581eed299..1825b94051e7 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -188,8 +188,8 @@ void OResultSet::disposing(void) if(m_bFreeHandle) m_pStatement->getOwnConnection()->freeStatementHandle(m_aStatementHandle); - m_xStatement = NULL; - m_xMetaData = NULL; +m_xStatement.clear(); +m_xMetaData.clear(); } // ------------------------------------------------------------------------- SQLRETURN OResultSet::unbind(sal_Bool _bUnbindHandle) @@ -1491,7 +1491,7 @@ void OResultSet::fillRow(sal_Int32 _nToColumn) for (; pColumn < pColumnEnd; ++nColumn, ++pColumn) { - sal_Int32 nType = pColumn->getTypeKind(); + const sal_Int32 nType = pColumn->getTypeKind(); switch (nType) { case DataType::CHAR: diff --git a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx index de5243c93d5a..adf77eca238c 100644 --- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx @@ -134,32 +134,38 @@ SWORD OResultSetMetaData::getColumnODBCType(OConnection* _pConnection { nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE ); } + return nType; } // ----------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { - sal_Int32 nType = 0; - if(!m_bUseODBC2Types) + ::std::map<sal_Int32,sal_Int32>::iterator aFind = m_aColumnTypes.find(column); + if ( aFind == m_aColumnTypes.end() ) { - try + sal_Int32 nType = 0; + if(!m_bUseODBC2Types) { - nType = getNumColAttrib(column,SQL_DESC_CONCISE_TYPE); - if(nType == SQL_UNKNOWN_TYPE) - nType = getNumColAttrib(column, SQL_DESC_TYPE); - nType = OTools::MapOdbcType2Jdbc(nType); + try + { + nType = getNumColAttrib(column,SQL_DESC_CONCISE_TYPE); + if(nType == SQL_UNKNOWN_TYPE) + nType = getNumColAttrib(column, SQL_DESC_TYPE); + nType = OTools::MapOdbcType2Jdbc(nType); + } + catch(SQLException& ) // in this case we have an odbc 2.0 driver + { + m_bUseODBC2Types = sal_True; + nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE )); + } } - catch(SQLException& ) // in this case we have an odbc 2.0 driver - { - m_bUseODBC2Types = sal_True; + else nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE )); - } + aFind = m_aColumnTypes.insert(::std::map<sal_Int32,sal_Int32>::value_type(column,nType)).first; } - else - nType = OTools::MapOdbcType2Jdbc(getNumColAttrib(column,SQL_DESC_CONCISE_TYPE )); - return nType; + return aFind->second; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index f72aec64e7dc..a7ac4ebf4d78 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -571,9 +571,12 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, return ::rtl::OUString(); // Bei Fehler bricht der GETDATA-Makro mit return ab, // bei NULL mit break! - SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1); + SQLINTEGER nRealSize = 0; + if ( pcbValue > -1 ) + nRealSize = pcbValue / sizeof(sal_Unicode); + SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1); waCharArray[nLen] = 0; - aData = ::rtl::OUString(waCharArray); + aData.append(waCharArray,nLen); // Es handelt sich um Binaerdaten, um einen String, der fuer // StarView zu lang ist oder der Treiber kann die Laenge der @@ -598,7 +601,10 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, (SQLINTEGER)nLen+1, &pcbValue), _aStatementHandle,SQL_HANDLE_STMT,_xInterface); - nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1); + nRealSize = 0; + if ( pcbValue > -1 ) + nRealSize = pcbValue / sizeof(sal_Unicode); + nLen = pcbValue != SQL_NO_TOTAL ? std::min(nRealSize, nMaxLen) : (nMaxLen-1); waCharArray[nLen] = 0; aData.append(::rtl::OUString(waCharArray)); @@ -628,7 +634,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, aCharArray[nLen] = 0; if ( ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) && aCharArray[nLen-1] == 0 && nLen > 0 ) --nLen; - aData = ::rtl::OUString((const sal_Char*)aCharArray,nLen, _nTextEncoding); + aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen, _nTextEncoding)); // Es handelt sich um Binaerdaten, um einen String, der fuer // StarView zu lang ist oder der Treiber kann die Laenge der |