summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r--connectivity/source/drivers/adabas/BConnection.cxx5
-rw-r--r--connectivity/source/drivers/adabas/BDriver.cxx2
-rw-r--r--connectivity/source/drivers/adabas/BPreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/adabas/BTables.cxx2
-rw-r--r--connectivity/source/drivers/adabas/BViews.cxx2
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx2
-rw-r--r--connectivity/source/drivers/ado/ADriver.cxx11
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx4
-rw-r--r--connectivity/source/drivers/ado/Aservices.cxx4
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx2
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.cxx2
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx2
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.cxx4
-rw-r--r--connectivity/source/drivers/evoab2/NTables.cxx2
-rw-r--r--connectivity/source/drivers/file/FCatalog.cxx2
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx4
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx4
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx10
-rw-r--r--connectivity/source/drivers/file/FTables.cxx2
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx2
-rw-r--r--connectivity/source/drivers/hsqldb/HStorageMap.cxx8
-rw-r--r--connectivity/source/drivers/hsqldb/HTables.cxx2
-rw-r--r--connectivity/source/drivers/hsqldb/HViews.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx2
-rw-r--r--connectivity/source/drivers/kab/KResultSet.cxx4
-rw-r--r--connectivity/source/drivers/kab/KTables.cxx2
-rwxr-xr-xconnectivity/source/drivers/macab/MacabResultSet.cxx4
-rwxr-xr-xconnectivity/source/drivers/macab/MacabTables.cxx2
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx6
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx2
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx2
-rw-r--r--connectivity/source/drivers/mysql/YTables.cxx2
-rw-r--r--connectivity/source/drivers/mysql/YViews.cxx2
-rw-r--r--connectivity/source/drivers/odbcbase/OConnection.cxx24
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx176
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx13
-rw-r--r--connectivity/source/drivers/odbcbase/OPreparedStatement.cxx22
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx6
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx34
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx14
43 files changed, 217 insertions, 192 deletions
diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx
index 0eb8a5a727..151b886fd7 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 8f8870ad91..bcdd09cb7e 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 4a4de6808a..3b398c8044 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 fb4b8c6780..0d16aeba65 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 bac78d2b7a..b62f0d12ca 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 39e933cf24..783707b8e0 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 33c1f80b4a..6ff8dedcf7 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 517d17dd0c..38284a3d42 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 f84a85eacc..10295db9a4 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 513d6b1454..00ae2a249b 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 d776a91c74..216dc2d9fc 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 7cf0824886..2324ec7a7d 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 1b79c43af7..c7e6a1617d 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 65cb703ffa..120ceb5248 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 8b3d1a6532..0109d9f126 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 b98896786f..8dba811f7a 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 4b68c873f1..1894e34d91 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 82eea55ba8..914dddc59e 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 ae614f0c28..2a373922d6 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 0e02147df8..b9233eb8b0 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 c402bdefc5..81c4fc052c 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 79bfb4be47..712c38eea0 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 0e4f6fb6c8..9b3c08aa28 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 4806203641..9c20fc0404 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 aeec9ee2d1..e1066776a5 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 7bcd93f23b..8a5a9a22a0 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 1455fd2b94..91ef3f6cae 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 931e537a46..82131b8538 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 25113f9cf3..5a5d660c60 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 82ccac7f97..7fa211ad76 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 b3fd20bd2f..07e7551a8a 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 f3755e95ab..081ff8369f 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 ccfe2e3e90..a4d468d795 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 f04a9308e9..c6bac0f566 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 077adb5faa..8b2626d612 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 adeeb229da..3a2e133421 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 fdc2985086..7465a6bc9d 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 60e185b4a7..97edeeffeb 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 2c8f37de5c..773b9c0293 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 ed6b881212..503ceb9905 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 3792efedcd..f43f743b03 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 090cc2cec4..06fab6db28 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 caecaa7bca..9ecc9de7f3 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