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
-rwxr-xr-xconnectivity/source/drivers/adabas/adabas.xcu128
-rw-r--r--connectivity/source/drivers/adabas/makefile.mk8
-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.cxx8
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx4
-rw-r--r--connectivity/source/drivers/ado/Aservices.cxx4
-rwxr-xr-xconnectivity/source/drivers/ado/ado.xcu242
-rw-r--r--connectivity/source/drivers/ado/makefile.mk13
-rw-r--r--connectivity/source/drivers/calc/CDriver.cxx6
-rw-r--r--connectivity/source/drivers/calc/CTable.cxx180
-rwxr-xr-xconnectivity/source/drivers/calc/calc.xcu66
-rw-r--r--connectivity/source/drivers/calc/makefile.mk4
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx50
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx598
-rwxr-xr-xconnectivity/source/drivers/dbase/dbase.xcu98
-rw-r--r--connectivity/source/drivers/dbase/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/evoab/evoab.xcu64
-rw-r--r--connectivity/source/drivers/evoab/makefile.mk11
-rw-r--r--connectivity/source/drivers/evoab2/EApi.cxx3
-rw-r--r--connectivity/source/drivers/evoab2/EApi.h1
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.cxx16
-rw-r--r--connectivity/source/drivers/evoab2/NConnection.hxx30
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx48
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx6
-rw-r--r--connectivity/source/drivers/evoab2/NDriver.cxx4
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.cxx101
-rw-r--r--connectivity/source/drivers/evoab2/NPreparedStatement.hxx32
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx521
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.hxx69
-rw-r--r--connectivity/source/drivers/evoab2/NResultSetMetaData.cxx5
-rw-r--r--connectivity/source/drivers/evoab2/NServices.cxx9
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.cxx671
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.hxx230
-rw-r--r--connectivity/source/drivers/evoab2/NTables.cxx2
-rwxr-xr-xconnectivity/source/drivers/evoab2/evoab2.xcu79
-rw-r--r--connectivity/source/drivers/evoab2/makefile.mk31
-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.cxx14
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx49
-rw-r--r--connectivity/source/drivers/file/FStringFunctions.cxx13
-rw-r--r--connectivity/source/drivers/file/FTables.cxx2
-rw-r--r--connectivity/source/drivers/file/fanalyzer.cxx3
-rw-r--r--connectivity/source/drivers/file/fcode.cxx25
-rw-r--r--connectivity/source/drivers/file/fcomp.cxx9
-rw-r--r--connectivity/source/drivers/file/quotedstring.cxx4
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx26
-rwxr-xr-xconnectivity/source/drivers/flat/flat.xcu113
-rw-r--r--connectivity/source/drivers/flat/makefile.mk4
-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
-rwxr-xr-xconnectivity/source/drivers/hsqldb/hsqldb.xcu76
-rw-r--r--connectivity/source/drivers/hsqldb/makefile.mk4
-rw-r--r--connectivity/source/drivers/jdbc/DatabaseMetaData.cxx4
-rw-r--r--connectivity/source/drivers/jdbc/JDriver.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/ResultSet.cxx5
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.xcu207
-rw-r--r--connectivity/source/drivers/jdbc/makefile.mk4
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx3
-rw-r--r--connectivity/source/drivers/kab/KResultSet.cxx4
-rw-r--r--connectivity/source/drivers/kab/KTables.cxx2
-rwxr-xr-xconnectivity/source/drivers/kab/kab.xcu49
-rw-r--r--connectivity/source/drivers/kab/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/macab/MacabResultSet.cxx4
-rwxr-xr-xconnectivity/source/drivers/macab/MacabTables.cxx2
-rwxr-xr-xconnectivity/source/drivers/macab/macab.xcu49
-rwxr-xr-xconnectivity/source/drivers/macab/makefile.mk4
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.cxx152
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.hxx77
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx85
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx29
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx8
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx4
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx139
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx28
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx88
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx4
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx9
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx230
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx80
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx2
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx1
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx13
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx9
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx27
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx6
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/makefile.mk9
-rw-r--r--connectivity/source/drivers/mozab/makefile.mk24
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab.xcu157
-rwxr-xr-xconnectivity/source/drivers/mozab/mozab2.xcu121
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx95
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx43
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx453
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx78
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx84
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx18
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx425
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx25
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx32
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx5
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/makefile.mk11
-rw-r--r--connectivity/source/drivers/mozab/post_include_mozilla.h12
-rw-r--r--connectivity/source/drivers/mozab/pre_include_mozilla.h14
-rw-r--r--connectivity/source/drivers/mysql/YDriver.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/mysql/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/mysql/mysql.xcu236
-rw-r--r--connectivity/source/drivers/odbc/makefile.mk4
-rwxr-xr-xconnectivity/source/drivers/odbc/odbc.xcu173
-rw-r--r--connectivity/source/drivers/odbcbase/OConnection.cxx26
-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.cxx38
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx12
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx48
-rw-r--r--connectivity/source/drivers/odbcbase/OStatement.cxx20
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx92
130 files changed, 5116 insertions, 2430 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/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu
new file mode 100755
index 000000000000..0648d25cebe6
--- /dev/null
+++ b/connectivity/source/drivers/adabas/adabas.xcu
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:adabas:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbcx.adabas.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Adabas D</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="ShutdownDatabase" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="DataCacheSizeIncrement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>20</value>
+ </prop>
+ </node>
+ <node oor:name="DataCacheSize" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>20</value>
+ </prop>
+ </node>
+ <node oor:name="ControlUser" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="ControlPassword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk
index 59f3238b4fdc..5b3483ed57bb 100644
--- a/connectivity/source/drivers/adabas/makefile.mk
+++ b/connectivity/source/drivers/adabas/makefile.mk
@@ -42,8 +42,8 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
+.INCLUDE : $(PRJ)$/version.mk
.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
CFLAGS+=-DSYSTEM_ODBC_HEADERS
@@ -104,9 +104,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
-
# --- Targets ----------------------------------
-.INCLUDE : target.mk
-
+.INCLUDE : $(PRJ)$/target.pmk
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..1eeb59befc1f 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -49,6 +49,10 @@
if(!x) \
ADOS::ThrowException(*m_pConnection->getConnection(),*this);
+#ifdef max
+# undef max
+#endif
+
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
using namespace connectivity::ado;
@@ -135,7 +139,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 +299,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/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu
new file mode 100755
index 000000000000..236d38bd7ff7
--- /dev/null
+++ b/connectivity/source/drivers/ado/ado.xcu
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:ado:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ado.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">ADO</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ado.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Access</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>3</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="ColumnAliasInOrderBy" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/msaccess</value>
+ </prop>
+ </node>
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>mdb</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
+ <prop oor:name="ParentURLPattern">
+ <value>sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Access 2007</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk
index 1aace34e4de6..b453c528e127 100644
--- a/connectivity/source/drivers/ado/makefile.mk
+++ b/connectivity/source/drivers/ado/makefile.mk
@@ -28,7 +28,6 @@
# for a copy of the LGPLv3 License.
#
#*************************************************************************
-.IF "$(GUI)"=="WNT"
PRJ=..$/..$/..
PRJINC=..$/..
@@ -43,9 +42,10 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
+.IF "$(GUI)"=="WNT"
# --- Files -------------------------------------
EXCEPTIONSFILES= \
@@ -109,9 +109,10 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
+.ELSE
+dummy:
+ @echo "Nothing to build for GUI $(GUI)"
.ENDIF # "$(GUI)"=="WNT"
+# --- Targets ----------------------------------
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx
index df3937803190..525ef9596317 100644
--- a/connectivity/source/drivers/calc/CDriver.cxx
+++ b/connectivity/source/drivers/calc/CDriver.cxx
@@ -91,11 +91,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url,
sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url )
throw(SQLException, RuntimeException)
{
- if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:calc:"),10))
- {
- return sal_True;
- }
- return sal_False;
+ return url.compareTo(::rtl::OUString::createFromAscii("sdbc:calc:"),10) == 0;
}
Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 2d35c16c11dd..91f917224496 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -164,11 +164,11 @@ CellContentType lcl_GetContentOrResultType( const Reference<XCell>& xCell )
CellContentType eCellType = xCell->getType();
if ( eCellType == CellContentType_FORMULA )
{
+ static const ::rtl::OUString s_sFormulaResultType(RTL_CONSTASCII_USTRINGPARAM("FormulaResultType"));
Reference<XPropertySet> xProp( xCell, UNO_QUERY );
try
{
- static ::rtl::OUString s_FormulaResultType(RTL_CONSTASCII_USTRINGPARAM("FormulaResultType"));
- xProp->getPropertyValue( s_FormulaResultType ) >>= eCellType; // type of formula result
+ xProp->getPropertyValue( s_sFormulaResultType ) >>= eCellType; // type of formula result
}
catch (UnknownPropertyException&)
{
@@ -346,101 +346,101 @@ void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet,
const Reference<XCell> xCell = xSheet->getCellByPosition( nDocColumn, nDocRow );
if ( xCell.is() )
{
- if ( DataType::VARCHAR == nType )
+ CellContentType eCellType = lcl_GetContentOrResultType( xCell );
+ switch (nType)
{
- // no difference between empty cell and empty string in spreadsheet
- const Reference<XText> xText( xCell, UNO_QUERY );
- if ( xText.is() )
- rValue = xText->getString();
- }
- else
- {
- CellContentType eCellType = lcl_GetContentOrResultType( xCell );
- switch (nType)
- {
- case DataType::DECIMAL:
- if ( eCellType == CellContentType_VALUE )
- rValue = xCell->getValue(); // double
- else
- rValue.setNull();
- break;
- case DataType::BIT:
- if ( eCellType == CellContentType_VALUE )
- rValue = (sal_Bool)( xCell->getValue() != 0.0 );
- else
- rValue.setNull();
- break;
- case DataType::DATE:
- if ( eCellType == CellContentType_VALUE )
- {
- ::Date aDate( rNullDate );
- aDate += (long)::rtl::math::approxFloor( xCell->getValue() );
- ::com::sun::star::util::Date aDateStruct( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() );
- rValue = aDateStruct;
- }
- else
- rValue.setNull();
- break;
- case DataType::TIME:
- if ( eCellType == CellContentType_VALUE )
+ case DataType::VARCHAR:
+ if ( eCellType == CellContentType_TEXT )
+ {
+ const Reference<XText> xText( xCell, UNO_QUERY );
+ if ( xText.is() )
+ rValue = xText->getString();
+ } // if ( eCellType == CellContentType_TEXT )
+ else
+ rValue.setNull();
+ break;
+ case DataType::DECIMAL:
+ if ( eCellType == CellContentType_VALUE )
+ rValue = xCell->getValue(); // double
+ else
+ rValue.setNull();
+ break;
+ case DataType::BIT:
+ if ( eCellType == CellContentType_VALUE )
+ rValue = (sal_Bool)( xCell->getValue() != 0.0 );
+ else
+ rValue.setNull();
+ break;
+ case DataType::DATE:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ ::Date aDate( rNullDate );
+ aDate += (long)::rtl::math::approxFloor( xCell->getValue() );
+ ::com::sun::star::util::Date aDateStruct( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() );
+ rValue = aDateStruct;
+ }
+ else
+ rValue.setNull();
+ break;
+ case DataType::TIME:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ double fCellVal = xCell->getValue();
+ double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
+ long nIntTime = (long)rtl::math::round( fTime * 8640000.0 );
+ if ( nIntTime == 8640000 )
+ nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
+ ::com::sun::star::util::Time aTime;
+ aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
+ nIntTime /= 100;
+ aTime.Seconds = (sal_uInt16)( nIntTime % 60 );
+ nIntTime /= 60;
+ aTime.Minutes = (sal_uInt16)( nIntTime % 60 );
+ nIntTime /= 60;
+ OSL_ENSURE( nIntTime < 24, "error in time calculation" );
+ aTime.Hours = (sal_uInt16) nIntTime;
+ rValue = aTime;
+ }
+ else
+ rValue.setNull();
+ break;
+ case DataType::TIMESTAMP:
+ if ( eCellType == CellContentType_VALUE )
+ {
+ double fCellVal = xCell->getValue();
+ double fDays = ::rtl::math::approxFloor( fCellVal );
+ double fTime = fCellVal - fDays;
+ long nIntDays = (long)fDays;
+ long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 );
+ if ( nIntTime == 8640000 )
{
- double fCellVal = xCell->getValue();
- double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
- long nIntTime = (long)rtl::math::round( fTime * 8640000.0 );
- if ( nIntTime == 8640000 )
- nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
- ::com::sun::star::util::Time aTime;
- aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
- nIntTime /= 100;
- aTime.Seconds = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- aTime.Minutes = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aTime.Hours = (sal_uInt16) nIntTime;
- rValue = aTime;
+ nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
+ ++nIntDays; // (next day)
}
- else
- rValue.setNull();
- break;
- case DataType::TIMESTAMP:
- if ( eCellType == CellContentType_VALUE )
- {
- double fCellVal = xCell->getValue();
- double fDays = ::rtl::math::approxFloor( fCellVal );
- double fTime = fCellVal - fDays;
- long nIntDays = (long)fDays;
- long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 );
- if ( nIntTime == 8640000 )
- {
- nIntTime = 0; // 23:59:59.995 and above is 00:00:00.00
- ++nIntDays; // (next day)
- }
- ::com::sun::star::util::DateTime aDateTime;
+ ::com::sun::star::util::DateTime aDateTime;
- aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
- nIntTime /= 100;
- aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 );
- nIntTime /= 60;
- OSL_ENSURE( nIntTime < 24, "error in time calculation" );
- aDateTime.Hours = (sal_uInt16) nIntTime;
+ aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
+ nIntTime /= 100;
+ aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 );
+ nIntTime /= 60;
+ aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 );
+ nIntTime /= 60;
+ OSL_ENSURE( nIntTime < 24, "error in time calculation" );
+ aDateTime.Hours = (sal_uInt16) nIntTime;
- ::Date aDate( rNullDate );
- aDate += nIntDays;
- aDateTime.Day = aDate.GetDay();
- aDateTime.Month = aDate.GetMonth();
- aDateTime.Year = aDate.GetYear();
+ ::Date aDate( rNullDate );
+ aDate += nIntDays;
+ aDateTime.Day = aDate.GetDay();
+ aDateTime.Month = aDate.GetMonth();
+ aDateTime.Year = aDate.GetYear();
- rValue = aDateTime;
- }
- else
- rValue.setNull();
- break;
- } // switch (nType)
- }
+ rValue = aDateTime;
+ }
+ else
+ rValue.setNull();
+ break;
+ } // switch (nType)
}
// rValue.setTypeKind(nType);
diff --git a/connectivity/source/drivers/calc/calc.xcu b/connectivity/source/drivers/calc/calc.xcu
new file mode 100755
index 000000000000..7260341946f1
--- /dev/null
+++ b/connectivity/source/drivers/calc/calc.xcu
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:calc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.calc.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Spreadsheet</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/vnd.oasis.opendocument.spreadsheet</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/calc/makefile.mk b/connectivity/source/drivers/calc/makefile.mk
index 08d83423638d..620bcd6a8eee 100644
--- a/connectivity/source/drivers/calc/makefile.mk
+++ b/connectivity/source/drivers/calc/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -94,6 +94,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index 469656bcbf11..bcc734c0e07a 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -87,8 +87,8 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
aRow.reserve(18);
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")));
- aRow.push_back(new ORowSetValueDecorator(DataType::CHAR));
+ aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")));
+ aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
aRow.push_back(new ORowSetValueDecorator((sal_Int32)254));
aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
@@ -99,7 +99,7 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("C"))));
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
@@ -108,23 +108,17 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
aRows.push_back(aRow);
- aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"));
- aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
- aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue();
- aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length"));
- aRows.push_back(aRow);
-
-
aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR"));
aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
- aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)2147483647);
aRow[6] = new ORowSetValueDecorator();
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("M")));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE"));
aRow[2] = new ORowSetValueDecorator(DataType::DATE);
aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D")));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOLEAN"));
@@ -134,13 +128,43 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( )
aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
aRow[6] = new ORowSetValueDecorator(::rtl::OUString());
aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L")));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE"));
+ aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)8);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("B")));
+ aRows.push_back(aRow);
+
+ aRow[11] = new ORowSetValueDecorator(sal_True);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("Y"));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP"));
+ aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
+ aRow[11] = new ORowSetValueDecorator(sal_False);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("T")));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER"));
+ aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("I")));
aRows.push_back(aRow);
aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL"));
aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length,scale"));
- aRow[15] = new ORowSetValueDecorator((sal_Int32)20);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("F")));
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC"));
+ aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)16);
+ aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("N")));
+ aRow[15] = new ORowSetValueDecorator((sal_Int32)16);
aRows.push_back(aRow);
}
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 5449235eb739..1db81262e120 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -42,8 +42,10 @@
#include <tools/config.hxx>
#include "dbase/DIndex.hxx"
#include "dbase/DIndexes.hxx"
+//#include "file/FDriver.hxx"
#include <comphelper/sequence.hxx>
#include <svtools/zforlist.hxx>
+#include <svtools/syslocale.hxx>
#include <rtl/math.hxx>
#include <stdio.h> //sprintf
#include <ucbhelper/content.hxx>
@@ -52,6 +54,7 @@
#include <connectivity/dbconversion.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/property.hxx>
+//#include <unotools/calendarwrapper.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/types.hxx>
@@ -81,15 +84,14 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
// stored as the Field Descriptor terminator
#define FIELD_DESCRIPTOR_TERMINATOR 0x0D
#define DBF_EOL 0x1A
-//==================================================================
namespace
{
-//==================================================================
sal_Int32 lcl_getFileSize(SvStream& _rStream)
{
sal_Int32 nFileSize = 0;
@@ -102,9 +104,123 @@ sal_Int32 lcl_getFileSize(SvStream& _rStream)
nFileSize -= 1;
return nFileSize;
}
-//==================================================================
+/**
+ calculates the Julian date
+*/
+void lcl_CalcJulDate(sal_Int32& _nJulianDate,sal_Int32& _nJulianTime,const com::sun::star::util::DateTime _aDateTime)
+{
+ com::sun::star::util::DateTime aDateTime = _aDateTime;
+ // weird: months fix
+ if (aDateTime.Month > 12)
+ {
+ aDateTime.Month--;
+ sal_uInt16 delta = _aDateTime.Month / 12;
+ aDateTime.Year += delta;
+ aDateTime.Month -= delta * 12;
+ aDateTime.Month++;
+ }
+
+ _nJulianTime = ((aDateTime.Hours*3600000)+(aDateTime.Minutes*60000)+(aDateTime.Seconds*1000)+(aDateTime.HundredthSeconds*10));
+ /* conversion factors */
+ sal_uInt16 iy0;
+ sal_uInt16 im0;
+ if ( aDateTime.Month <= 2 )
+ {
+ iy0 = aDateTime.Year - 1;
+ im0 = aDateTime.Month + 12;
+ }
+ else
+ {
+ iy0 = aDateTime.Year;
+ im0 = aDateTime.Month;
+ }
+ sal_Int32 ia = iy0 / 100;
+ sal_Int32 ib = 2 - ia + (ia >> 2);
+ /* calculate julian date */
+ if ( aDateTime.Year <= 0 )
+ {
+ _nJulianDate = (sal_Int32) ((365.25 * iy0) - 0.75)
+ + (sal_Int32) (30.6001 * (im0 + 1) )
+ + aDateTime.Day + 1720994;
+ } // if ( _aDateTime.Year <= 0 )
+ else
+ {
+ _nJulianDate = static_cast<sal_Int32>( ((365.25 * iy0)
+ + (sal_Int32) (30.6001 * (im0 + 1))
+ + aDateTime.Day + 1720994));
+ }
+ double JD = _nJulianDate + 0.5;
+ _nJulianDate = (sal_Int32)( JD + 0.5);
+ const double gyr = aDateTime.Year + (0.01 * aDateTime.Month) + (0.0001 * aDateTime.Day);
+ if ( gyr >= 1582.1015 ) /* on or after 15 October 1582 */
+ _nJulianDate += ib;
+}
+
+/**
+ calculates date time from the Julian Date
+*/
+void lcl_CalDate(sal_Int32 _nJulianDate,sal_Int32 _nJulianTime,com::sun::star::util::DateTime& _rDateTime)
+{
+ if ( _nJulianDate )
+ {
+ sal_Int32 ialp;
+ sal_Int32 ka = _nJulianDate;
+ if ( _nJulianDate >= 2299161 )
+ {
+ ialp = (sal_Int32)( ((double) _nJulianDate - 1867216.25 ) / ( 36524.25 ));
+ ka = _nJulianDate + 1 + ialp - ( ialp >> 2 );
+ }
+ sal_Int32 kb = ka + 1524;
+ sal_Int32 kc = (sal_Int32) ( ((double) kb - 122.1 ) / 365.25 );
+ sal_Int32 kd = (sal_Int32) ((double) kc * 365.25);
+ sal_Int32 ke = (sal_Int32) ((double) ( kb - kd ) / 30.6001 );
+ _rDateTime.Day = static_cast<sal_uInt16>(kb - kd - ((sal_Int32) ( (double) ke * 30.6001 )));
+ if ( ke > 13 )
+ _rDateTime.Month = static_cast<sal_uInt16>(ke - 13);
+ else
+ _rDateTime.Month = static_cast<sal_uInt16>(ke - 1);
+ if ( (_rDateTime.Month == 2) && (_rDateTime.Day > 28) )
+ _rDateTime.Day = 29;
+ if ( (_rDateTime.Month == 2) && (_rDateTime.Day == 29) && (ke == 3) )
+ _rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
+ else if ( _rDateTime.Month > 2 )
+ _rDateTime.Year = static_cast<sal_uInt16>(kc - 4716);
+ else
+ _rDateTime.Year = static_cast<sal_uInt16>(kc - 4715);
+ } // if ( _nJulianDate )
+
+ if ( _nJulianTime )
+ {
+ double d_s = _nJulianTime / 1000;
+ double d_m = d_s / 60;
+ double d_h = d_m / 60;
+ _rDateTime.Hours = (sal_uInt16) (d_h);
+ _rDateTime.Minutes = (sal_uInt16) d_m; // integer _aDateTime.Minutes
+ //// weird: time fix
+ // int test = (_rDateTime.Hours % 3) * 100 + _rDateTime.Minutes;
+ //int test_tbl[] = {0, 1, 2, 11, 12, 13, 22, 23, 24, 25, 34, 35, 36,
+ // 45, 46, 47, 56, 57, 58, 107, 108, 109, 110, 119, 120, 121,
+ // 130, 131, 132, 141, 142, 143, 152, 153, 154, 155, 204, 205,
+ // 206, 215, 216, 217, 226, 227, 228, 237, 238, 239, 240, 249,
+ // 250, 251};
+ // for (int i = 0; i < sizeof(test_tbl)/sizeof(test_tbl[0]); i++)
+ //{
+ // if (test == test_tbl[i])
+ // {
+ // // frac += 0.000012;
+ // //d_hour = frac * 24.0;
+ // _rDateTime.Hours = (sal_uInt16)d_hour;
+ // d_minute = (d_hour - (double)_rDateTime.Hours) * 60.0;
+ // _rDateTime.Minutes = (sal_uInt16)d_minute;
+ // break;
+ // }
+ // }
+
+ _rDateTime.Seconds = static_cast<sal_uInt16>(( d_m - (double) _rDateTime.Minutes ) * 60.0);
+ }
+}
+
}
-//==================================================================
// -------------------------------------------------------------------------
void ODbaseTable::readHeader()
@@ -152,6 +268,7 @@ void ODbaseTable::readHeader()
case dBaseIV:
case dBaseV:
case VisualFoxPro:
+ case VisualFoxProAuto:
case dBaseFS:
case dBaseFSMemo:
case dBaseIVMemoSQL:
@@ -227,6 +344,7 @@ void ODbaseTable::fillColumns()
::rtl::OUString aTypeName;
static const ::rtl::OUString sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
const sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers();
+ const bool bFoxPro = m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto || m_aHeader.db_typ == FoxProMemo;
sal_Int32 i = 0;
for (; i < nFieldCount; i++)
@@ -236,61 +354,97 @@ void ODbaseTable::fillColumns()
if ( FIELD_DESCRIPTOR_TERMINATOR == aDBFColumn.db_fnm[0] ) // 0x0D stored as the Field Descriptor terminator.
break;
+ sal_Bool bIsRowVersion = bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01;
+ //if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x01 ) == 0x01 ) // system column not visible to user
+ // continue;
const String aColumnName((const char *)aDBFColumn.db_fnm,m_eEncoding);
+ m_aRealFieldLengths.push_back(aDBFColumn.db_flng);
sal_Int32 nPrecision = aDBFColumn.db_flng;
sal_Int32 eType;
+ sal_Bool bIsCurrency = sal_False;
+
+ char cType[2];
+ cType[0] = aDBFColumn.db_typ;
+ cType[1] = 0;
+ aTypeName = ::rtl::OUString::createFromAscii(cType);
+OSL_TRACE("column type: %c",aDBFColumn.db_typ);
switch (aDBFColumn.db_typ)
{
case 'C':
eType = DataType::VARCHAR;
- aTypeName = sVARCHAR;
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"));
break;
case 'F':
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"));
case 'N':
+ if ( aDBFColumn.db_typ == 'N' )
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC"));
eType = DataType::DECIMAL;
- aTypeName = ::rtl::OUString::createFromAscii("DECIMAL");
// Bei numerischen Feldern werden zwei Zeichen mehr geschrieben, als die Precision der Spaltenbeschreibung eigentlich
// angibt, um Platz fuer das eventuelle Vorzeichen und das Komma zu haben. Das muss ich jetzt aber wieder rausrechnen.
nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez);
// leider gilt das eben Gesagte nicht fuer aeltere Versionen ....
- ;
break;
case 'L':
eType = DataType::BIT;
- aTypeName = ::rtl::OUString::createFromAscii("BIT");
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN"));
+ break;
+ case 'Y':
+ bIsCurrency = sal_True;
+ eType = DataType::DOUBLE;
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
break;
case 'D':
eType = DataType::DATE;
- aTypeName = ::rtl::OUString::createFromAscii("DATE");
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"));
+ break;
+ case 'T':
+ eType = DataType::TIMESTAMP;
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"));
+ break;
+ case 'I':
+ eType = DataType::INTEGER;
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER"));
break;
case 'M':
- eType = DataType::LONGVARCHAR;
- aTypeName = ::rtl::OUString::createFromAscii("LONGVARCHAR");
- nPrecision = 65535;
+ if ( bFoxPro && ( aDBFColumn.db_frei2[0] & 0x04 ) == 0x04 )
+ {
+ eType = DataType::LONGVARBINARY;
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
+ }
+ else
+ {
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR"));
+ eType = DataType::LONGVARCHAR;
+ }
+ nPrecision = 2147483647;
+ break;
+ case 'P':
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
+ eType = DataType::LONGVARBINARY;
+ nPrecision = 2147483647;
+ break;
+ case '0':
+ case 'B':
+ if ( m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto )
+ {
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"));
+ eType = DataType::DOUBLE;
+ }
+ else
+ {
+ aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARBINARY"));
+ eType = DataType::LONGVARBINARY;
+ nPrecision = 2147483647;
+ }
break;
default:
- aTypeName = ::rtl::OUString::createFromAscii("OTHER");
eType = DataType::OTHER;
-
}
-// sal_Int32 nFlags = 0;
-// switch (aDBFColumn.db_typ)
-// {
-// case 'C':
-// case 'D':
-// case 'L': nFlags = ColumnSearch::FULL; break;
-// case 'F':
-// case 'N': nFlags = ColumnSearch::BASIC; break;
-// case 'M': nFlags = ColumnSearch::CHAR; break;
-// default:
-// nFlags = ColumnSearch::NONE;
-//
-// }
-
m_aTypes.push_back(eType);
m_aPrecisions.push_back(nPrecision);
m_aScales.push_back(aDBFColumn.db_dez);
@@ -303,8 +457,8 @@ void ODbaseTable::fillColumns()
aDBFColumn.db_dez,
eType,
sal_False,
- sal_False,
- sal_False,
+ bIsRowVersion,
+ bIsCurrency,
bCase);
m_aColumns->get().push_back(xCol);
} // for (; i < nFieldCount; i++)
@@ -380,7 +534,7 @@ void ODbaseTable::construct()
// Memo-Dateinamen bilden (.DBT):
// nyi: Unschoen fuer Unix und Mac!
- if ( m_aHeader.db_typ == FoxProMemo || VisualFoxPro == m_aHeader.db_typ ) // foxpro uses another extension
+ if ( m_aHeader.db_typ == FoxProMemo || VisualFoxPro == m_aHeader.db_typ || VisualFoxProAuto == m_aHeader.db_typ ) // foxpro uses another extension
aURL.SetExtension(String::CreateFromAscii("fpt"));
else
aURL.SetExtension(String::CreateFromAscii("dbt"));
@@ -465,6 +619,7 @@ BOOL ODbaseTable::ReadMemoHeader()
}
break;
case VisualFoxPro:
+ case VisualFoxProAuto:
case FoxProMemo:
m_aMemoHeader.db_typ = MemoFoxPro;
m_pMemoStream->Seek(6L);
@@ -693,15 +848,23 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
}
switch(nType)
{
- case DataType::DATE: nLen = 8; break;
+ case DataType::INTEGER:
+ case DataType::DOUBLE:
+ case DataType::TIMESTAMP:
+ case DataType::DATE:
+ case DataType::BIT:
+ case DataType::LONGVARCHAR:
+ case DataType::LONGVARBINARY:
+ nLen = m_aRealFieldLengths[i-1];
+ break;
case DataType::DECIMAL:
if(_bUseTableDefs)
nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i-1]);
else
nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
break; // das Vorzeichen und das Komma
- case DataType::BIT: nLen = 1; break;
- case DataType::LONGVARCHAR: nLen = 10; break;
+
+ case DataType::BINARY:
case DataType::OTHER:
nByteOffset += nLen;
continue;
@@ -714,7 +877,9 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
nByteOffset += nLen;
OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
continue;
- }
+ } // if ( !(_rRow->get())[i]->isBound() )
+ if ( ( nByteOffset + nLen) > m_nBufferSize )
+ break; // length doesn't match buffer size.
char *pData = (char *) (m_pBuffer + nByteOffset);
@@ -733,6 +898,48 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
(_rRow->get())[i]->setNull();
pData[nLen] = cLast;
+ } // if (nType == DataType::CHAR || nType == DataType::VARCHAR)
+ else if ( DataType::TIMESTAMP == nType )
+ {
+ sal_Int32 nDate = 0,nTime = 0;
+ memcpy(&nDate, pData, 4);
+ memcpy(&nTime, pData+ 4, 4);
+ if ( !nDate && !nTime )
+ {
+ (_rRow->get())[i]->setNull();
+ }
+ else
+ {
+ ::com::sun::star::util::DateTime aDateTime;
+ lcl_CalDate(nDate,nTime,aDateTime);
+ *(_rRow->get())[i] = aDateTime;
+ }
+ }
+ else if ( DataType::INTEGER == nType )
+ {
+ sal_Int32 nValue = 0;
+ memcpy(&nValue, pData, nLen);
+ *(_rRow->get())[i] = nValue;
+ }
+ else if ( DataType::DOUBLE == nType )
+ {
+ double d = 0.0;
+ if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt
+ {
+ sal_Int64 nValue = 0;
+ memcpy(&nValue, pData, nLen);
+
+ if ( m_aScales[i-1] )
+ d = (double)(nValue / pow(10.0,(int)m_aScales[i-1]));
+ else
+ d = (double)(nValue);
+ }
+ else
+ {
+ memcpy(&d, pData, nLen);
+ }
+
+ *(_rRow->get())[i] = d;
}
else
{
@@ -789,6 +996,8 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
// pVal->setDouble(b);
}
break;
+ case DataType::LONGVARBINARY:
+ case DataType::BINARY:
case DataType::LONGVARCHAR:
{
const long nBlockNo = aStr.ToInt32(); // Blocknummer lesen
@@ -806,9 +1015,6 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s
(_rRow->get())[i]->setTypeKind(nType);
}
-// if (aStatus.IsError())
-// break;
- // Und weiter ...
nByteOffset += nLen;
OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
}
@@ -978,38 +1184,78 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
if (!m_pFileStream)
return sal_False;
+ BYTE nDbaseType = dBaseIII;
+ Reference<XIndexAccess> xColumns(getColumns(),UNO_QUERY);
+ Reference<XPropertySet> xCol;
+ const ::rtl::OUString sPropType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
+
+ try
+ {
+ const sal_Int32 nCount = xColumns->getCount();
+ for(sal_Int32 i=0;i<nCount;++i)
+ {
+ xColumns->getByIndex(i) >>= xCol;
+ OSL_ENSURE(xCol.is(),"This should be a column!");
+
+ switch (getINT32(xCol->getPropertyValue(sPropType)))
+ {
+ case DataType::DOUBLE:
+ case DataType::INTEGER:
+ case DataType::TIMESTAMP:
+ case DataType::LONGVARBINARY:
+ nDbaseType = VisualFoxPro;
+ i = nCount; // no more columns need to be checked
+ break;
+ } // switch (getINT32(xCol->getPropertyValue(sPropType)))
+ }
+ }
+ catch ( const Exception& e )
+ {
+ (void)e;
+
+ try
+ {
+ // we have to drop the file because it is corrupted now
+ DropImpl();
+ }
+ catch(const Exception&) { }
+ throw;
+ }
+
char aBuffer[21]; // write buffer
memset(aBuffer,0,sizeof(aBuffer));
m_pFileStream->Seek(0L);
- (*m_pFileStream) << (BYTE) dBaseIII; // dBase format
+ (*m_pFileStream) << (BYTE) nDbaseType; // dBase format
(*m_pFileStream) << (BYTE) (aDate.GetYear() % 100); // aktuelles Datum
(*m_pFileStream) << (BYTE) aDate.GetMonth();
(*m_pFileStream) << (BYTE) aDate.GetDay();
- (*m_pFileStream) << 0L; // Anzahl der Datensaetze
- (*m_pFileStream) << (USHORT)((m_pColumns->getCount()+1) * 32 + 1); // Kopfinformationen,
+ (*m_pFileStream) << 0L; // Anzahl der Datensaetze
+ (*m_pFileStream) << (USHORT)((m_pColumns->getCount()+1) * 32 + 1); // Kopfinformationen,
// pColumns erhaelt immer eine Spalte mehr
- (*m_pFileStream) << (USHORT) 0; // Satzlaenge wird spaeter bestimmt
+ (*m_pFileStream) << (USHORT) 0; // Satzlaenge wird spaeter bestimmt
m_pFileStream->Write(aBuffer, 20);
- USHORT nRecLength = 1; // Laenge 1 fuer deleted flag
+ USHORT nRecLength = 1; // Laenge 1 fuer deleted flag
sal_Int32 nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength();
- Reference<XIndexAccess> xColumns(getColumns(),UNO_QUERY);
-
::rtl::OUString aName;
- Reference<XPropertySet> xCol;
+ const ::rtl::OUString sPropName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+ const ::rtl::OUString sPropPrec = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION);
+ const ::rtl::OUString sPropScale = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE);
+
try
{
- for(sal_Int32 i=0;i<xColumns->getCount();++i)
+ const sal_Int32 nCount = xColumns->getCount();
+ for(sal_Int32 i=0;i<nCount;++i)
{
- ::cppu::extractInterface(xCol,xColumns->getByIndex(i));
+ xColumns->getByIndex(i) >>= xCol;
OSL_ENSURE(xCol.is(),"This should be a column!");
char cTyp( 'C' );
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aName;
+ xCol->getPropertyValue(sPropName) >>= aName;
::rtl::OString aCol;
if ( DBTypeConversion::convertUnicodeString( aName, aCol, m_eEncoding ) > nMaxFieldLength)
@@ -1020,22 +1266,39 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
(*m_pFileStream) << aCol.getStr();
m_pFileStream->Write(aBuffer, 11 - aCol.getLength());
- switch (getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
+ sal_Int32 nPrecision = 0;
+ xCol->getPropertyValue(sPropPrec) >>= nPrecision;
+ sal_Int32 nScale = 0;
+ xCol->getPropertyValue(sPropScale) >>= nScale;
+
+ bool bBinary = false;
+
+ switch (getINT32(xCol->getPropertyValue(sPropType)))
{
case DataType::CHAR:
case DataType::VARCHAR:
cTyp = 'C';
break;
+ case DataType::DOUBLE:
+ if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt
+ cTyp = 'Y';
+ else
+ cTyp = 'B';
+ break;
+ case DataType::INTEGER:
+ cTyp = 'I';
+ break;
case DataType::TINYINT:
case DataType::SMALLINT:
- case DataType::INTEGER:
case DataType::BIGINT:
case DataType::DECIMAL:
case DataType::NUMERIC:
case DataType::REAL:
- case DataType::DOUBLE:
cTyp = 'N'; // nur dBase 3 format
break;
+ case DataType::TIMESTAMP:
+ cTyp = 'T';
+ break;
case DataType::DATE:
cTyp = 'D';
break;
@@ -1043,6 +1306,8 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
cTyp = 'L';
break;
case DataType::LONGVARBINARY:
+ bBinary = true;
+ // run through
case DataType::LONGVARCHAR:
cTyp = 'M';
break;
@@ -1053,12 +1318,10 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
}
(*m_pFileStream) << cTyp;
- m_pFileStream->Write(aBuffer, 4);
-
- sal_Int32 nPrecision = 0;
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nPrecision;
- sal_Int32 nScale = 0;
- xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
+ if ( nDbaseType == VisualFoxPro )
+ (*m_pFileStream) << (nRecLength-1);
+ else
+ m_pFileStream->Write(aBuffer, 4);
switch(cTyp)
{
@@ -1092,14 +1355,22 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
(*m_pFileStream) << (BYTE)( nPrec);
(*m_pFileStream) << (BYTE)nScale;
- nRecLength = nRecLength + (USHORT)nPrec;
+ nRecLength += (USHORT)nPrec;
}
break;
case 'L':
(*m_pFileStream) << (BYTE)1;
(*m_pFileStream) << (BYTE)0;
- nRecLength++;
+ ++nRecLength;
break;
+ case 'I':
+ (*m_pFileStream) << (BYTE)4;
+ (*m_pFileStream) << (BYTE)0;
+ nRecLength += 4;
+ break;
+ case 'Y':
+ case 'B':
+ case 'T':
case 'D':
(*m_pFileStream) << (BYTE)8;
(*m_pFileStream) << (BYTE)0;
@@ -1110,11 +1381,14 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
(*m_pFileStream) << (BYTE)10;
(*m_pFileStream) << (BYTE)0;
nRecLength += 10;
+ if ( bBinary )
+ aBuffer[0] = 0x06;
break;
default:
throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName);
}
m_pFileStream->Write(aBuffer, 14);
+ aBuffer[0] = 0x00;
}
(*m_pFileStream) << (BYTE)FIELD_DESCRIPTOR_TERMINATOR; // kopf ende
@@ -1125,7 +1399,10 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
if (bCreateMemo)
{
m_pFileStream->Seek(0L);
- (*m_pFileStream) << (BYTE) dBaseIIIMemo;
+ if (nDbaseType == VisualFoxPro)
+ (*m_pFileStream) << (BYTE) FoxProMemo;
+ else
+ (*m_pFileStream) << (BYTE) dBaseIIIMemo;
} // if (bCreateMemo)
}
catch ( const Exception& e )
@@ -1252,7 +1529,7 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<X
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::InsertRow" );
// Buffer mit Leerzeichen fuellen
AllocBuffer();
- memset(m_pBuffer, ' ', m_aHeader.db_slng);
+ memset(m_pBuffer, 0, m_aHeader.db_slng);
// Gesamte neue Row uebernehmen:
// ... und am Ende als neuen Record hinzufuegen:
@@ -1436,7 +1713,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
Reference<XPropertySet> xIndex;
USHORT i;
::rtl::OUString aColName;
- sal_Int32 nColumnCount = m_pColumns->getCount();
+ const sal_Int32 nColumnCount = m_pColumns->getCount();
::std::vector< Reference<XPropertySet> > aIndexedCols(nColumnCount);
::comphelper::UStringMixEqual aCase(isCaseSensitive());
@@ -1488,9 +1765,13 @@ 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() )
- throwInvalidColumnType(STR_DUPLICATE_VALUE_IN_COLUMN,aColName);
+ const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution(
+ STR_DUPLICATE_VALUE_IN_COLUMN
+ ,"$columnname$", aColName
+ ) );
+ ::dbtools::throwGenericSQLException( sError, *this );
}
}
}
@@ -1522,15 +1803,24 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
}
}
+ bool bSetZero = false;
switch (nType)
{
- case DataType::DATE: nLen = 8; break;
+ case DataType::INTEGER:
+ case DataType::DOUBLE:
+ case DataType::TIMESTAMP:
+ bSetZero = true;
+ case DataType::LONGVARBINARY:
+ case DataType::DATE:
+ case DataType::BIT:
+ case DataType::LONGVARCHAR:
+ nLen = m_aRealFieldLengths[i];
+ break;
case DataType::DECIMAL:
nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,nScale);
break; // das Vorzeichen und das Komma
- case DataType::BIT: nLen = 1; break;
- case DataType::LONGVARCHAR: nLen = 10; break;
- default: break;
+ default:
+ break;
} // switch (nType)
@@ -1580,7 +1870,10 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
char* pData = (char *)(m_pBuffer + nByteOffset);
if (rRow.get()[nPos]->getValue().isNull())
{
- memset(pData,' ',nLen); // Zuruecksetzen auf NULL
+ if ( bSetZero )
+ memset(pData,0,nLen); // Zuruecksetzen auf NULL
+ else
+ memset(pData,' ',nLen); // Zuruecksetzen auf NULL
nByteOffset += nLen;
OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!");
continue;
@@ -1591,6 +1884,15 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
{
switch (nType)
{
+ case DataType::TIMESTAMP:
+ {
+ sal_Int32 nJulianDate = 0, nJulianTime = 0;
+ lcl_CalcJulDate(nJulianDate,nJulianTime,rRow.get()[nPos]->getValue());
+ // Genau 8 Byte kopieren:
+ memcpy(pData,&nJulianDate,4);
+ memcpy(pData+4,&nJulianTime,4);
+ }
+ break;
case DataType::DATE:
{
::com::sun::star::util::Date aDate;
@@ -1609,6 +1911,30 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
// Genau 8 Byte kopieren:
strncpy(pData,s,sizeof s - 1);
} break;
+ case DataType::INTEGER:
+ {
+ sal_Int32 nValue = rRow.get()[nPos]->getValue();
+ memcpy(pData,&nValue,nLen);
+ }
+ break;
+ case DataType::DOUBLE:
+ {
+ const double d = rRow.get()[nPos]->getValue();
+ m_pColumns->getByIndex(i) >>= xCol;
+
+ if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt
+ {
+ sal_Int64 nValue = 0;
+ if ( m_aScales[i] )
+ nValue = (sal_Int64)(d * pow(10.0,(int)m_aScales[i]));
+ else
+ nValue = (sal_Int64)(d);
+ memcpy(pData,&nValue,nLen);
+ } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt
+ else
+ memcpy(pData,&d,nLen);
+ }
+ break;
case DataType::DECIMAL:
{
memset(pData,' ',nLen); // Zuruecksetzen auf NULL
@@ -1647,6 +1973,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const
case DataType::BIT:
*pData = rRow.get()[nPos]->getValue().getBool() ? 'T' : 'F';
break;
+ case DataType::LONGVARBINARY:
case DataType::LONGVARCHAR:
{
char cNext = pData[nLen]; // merken und temporaer durch 0 ersetzen
@@ -1714,12 +2041,20 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteMemo" );
// wird die BlockNr 0 vorgegeben, wird der block ans Ende gehaengt
-
- BYTE nHeader[4];
-
- ::rtl::OUString sStringToWrite( aVariable.getString() );
+ ULONG nSize = 0;
::rtl::OString aStr;
- ULONG nSize = DBTypeConversion::convertUnicodeString( sStringToWrite, aStr, m_eEncoding );
+ ::com::sun::star::uno::Sequence<sal_Int8> aValue;
+ BYTE nHeader[4];
+ const bool bBinary = aVariable.getTypeKind() == DataType::LONGVARBINARY && m_aMemoHeader.db_typ == MemoFoxPro;
+ if ( bBinary )
+ {
+ aValue = aVariable.getSequence();
+ nSize = aValue.getLength();
+ }
+ else
+ {
+ nSize = DBTypeConversion::convertUnicodeString( aVariable.getString(), aStr, m_eEncoding );
+ }
// Anhaengen oder ueberschreiben
BOOL bAppend = rBlockNr == 0;
@@ -1779,29 +2114,28 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr)
{
const char cEOF = (char) DBF_EOL;
nSize++;
-
-// if (pData)
-// {
-// m_pMemoStream->Write((const char*) pData->getConstArray(), pData->getLength());
-// }
-// else
-// {
- m_pMemoStream->Write( aStr.getStr(), aStr.getLength() );
- // }
-
+ m_pMemoStream->Write( aStr.getStr(), aStr.getLength() );
(*m_pMemoStream) << cEOF << cEOF;
} break;
case MemoFoxPro:
case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe
{
- (*m_pMemoStream) << (BYTE)0xFF
- << (BYTE)0xFF
- << (BYTE)0x08;
+ if ( MemodBaseIV == m_aMemoHeader.db_typ )
+ (*m_pMemoStream) << (BYTE)0xFF
+ << (BYTE)0xFF
+ << (BYTE)0x08;
+ else
+ (*m_pMemoStream) << (BYTE)0x00
+ << (BYTE)0x00
+ << (BYTE)0x00;
UINT32 nWriteSize = nSize;
if (m_aMemoHeader.db_typ == MemoFoxPro)
{
- (*m_pMemoStream) << (BYTE) 0x01; // ((pData = NULL) ? 0x01 : 0x00);
+ if ( bBinary )
+ (*m_pMemoStream) << (BYTE) 0x00; // Picture
+ else
+ (*m_pMemoStream) << (BYTE) 0x01; // Memo
for (int i = 4; i > 0; nWriteSize >>= 8)
nHeader[--i] = (BYTE) (nWriteSize % 256);
}
@@ -1814,14 +2148,10 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr)
}
m_pMemoStream->Write(nHeader,4);
-// if (pData)
-// {
-// m_pMemoStream->Write((const char*) pData->getConstArray(), pData->getLength());
-// }
-// else
-// {
+ if ( bBinary )
+ m_pMemoStream->Write( aValue.getConstArray(), aValue.getLength() );
+ else
m_pMemoStream->Write( aStr.getStr(), aStr.getLength() );
- // }
m_pMemoStream->Flush();
}
}
@@ -2419,18 +2749,18 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
// Foxpro stores text and binary data
if (m_aMemoHeader.db_typ == MemoFoxPro)
{
- if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0)
- {
-// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
-// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
-// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
-// aStatus.Set(SDB_STAT_ERROR,
-// String::CreateFromAscii("01000"),
-// aStatus.CreateErrorMessage(aText),
-// 0, String() );
- return sal_False;
- }
-
+// if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0)
+// {
+//// String aText = String(SdbResId(STR_STAT_IResultSetHelper::INVALID));
+//// aText.SearchAndReplace(String::CreateFromAscii("%%d"),m_pMemoStream->GetFileName());
+//// aText.SearchAndReplace(String::CreateFromAscii("%%t"),aStatus.TypeToString(MEMO));
+//// aStatus.Set(SDB_STAT_ERROR,
+//// String::CreateFromAscii("01000"),
+//// aStatus.CreateErrorMessage(aText),
+//// 0, String() );
+// return sal_False;
+// }
+//
bIsText = sHeader[3] != 0;
}
else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08)
@@ -2451,28 +2781,38 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable)
if (m_aMemoHeader.db_typ == MemodBaseIV)
nLength -= 8;
- // char cChar;
- ::rtl::OUString aStr;
- while ( nLength > STRING_MAXLEN )
+ if ( nLength )
{
- ByteString aBStr;
- aBStr.Expand(STRING_MAXLEN);
- m_pMemoStream->Read(aBStr.AllocBuffer(STRING_MAXLEN),STRING_MAXLEN);
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding);
- nLength -= STRING_MAXLEN;
- }
- if ( nLength > 0 )
- {
- ByteString aBStr;
- aBStr.Expand(static_cast<xub_StrLen>(nLength));
- m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
- // aBStr.ReleaseBufferAccess();
-
- aStr += ::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding);
-
- }
- if ( aStr.getLength() )
- aVariable = aStr;
+ if ( bIsText )
+ {
+ // char cChar;
+ ::rtl::OUStringBuffer aStr;
+ while ( nLength > STRING_MAXLEN )
+ {
+ ByteString aBStr;
+ aBStr.Expand(STRING_MAXLEN);
+ m_pMemoStream->Read(aBStr.AllocBuffer(STRING_MAXLEN),STRING_MAXLEN);
+ aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
+ nLength -= STRING_MAXLEN;
+ }
+ if ( nLength > 0 )
+ {
+ ByteString aBStr;
+ aBStr.Expand(static_cast<xub_StrLen>(nLength));
+ m_pMemoStream->Read(aBStr.AllocBuffer(static_cast<xub_StrLen>(nLength)),nLength);
+ // aBStr.ReleaseBufferAccess();
+ aStr.append(::rtl::OUString(aBStr.GetBuffer(),aBStr.Len(), m_eEncoding));
+ }
+ if ( aStr.getLength() )
+ aVariable = aStr.makeStringAndClear();
+ } // if ( bIsText )
+ else
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aData(nLength);
+ m_pMemoStream->Read(aData.getArray(),nLength);
+ aVariable = aData;
+ }
+ } // if ( nLength )
}
}
return sal_True;
diff --git a/connectivity/source/drivers/dbase/dbase.xcu b/connectivity/source/drivers/dbase/dbase.xcu
new file mode 100755
index 000000000000..e981a56a34d2
--- /dev/null
+++ b/connectivity/source/drivers/dbase/dbase.xcu
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:dbase:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.dbase.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">dBASE</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="ShowDeleted" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="EnableSQL92Check" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>application/dbase</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk
index 7a827b86d46f..37a88ef47674 100644
--- a/connectivity/source/drivers/dbase/makefile.mk
+++ b/connectivity/source/drivers/dbase/makefile.mk
@@ -41,7 +41,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
# --- Files -------------------------------------
@@ -128,6 +128,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/evoab/evoab.xcu b/connectivity/source/drivers/evoab/evoab.xcu
new file mode 100755
index 000000000000..4c5c4894e0ab
--- /dev/null
+++ b/connectivity/source/drivers/evoab/evoab.xcu
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:evolution:ldap" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution LDAP</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Groupwise</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/evoab/makefile.mk b/connectivity/source/drivers/evoab/makefile.mk
index dc08137324c9..8982322513de 100644
--- a/connectivity/source/drivers/evoab/makefile.mk
+++ b/connectivity/source/drivers/evoab/makefile.mk
@@ -41,10 +41,11 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.IF "$(GUI)"=="UNX"
+
# --- Files -------------------------------------
EXCEPTIONSFILES=\
@@ -99,9 +100,9 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
+.ELSE
+dummy:
+ @echo "Nothing to build for GUI $(GUI)"
.ENDIF
# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
-
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx
index d8dcb3616fb6..8de1f8f59c0c 100644
--- a/connectivity/source/drivers/evoab2/EApi.cxx
+++ b/connectivity/source/drivers/evoab2/EApi.cxx
@@ -69,6 +69,7 @@ typedef void (*SymbolFunc) (void);
SYM_MAP( e_book_query_and ),
SYM_MAP( e_book_query_or ),
SYM_MAP( e_book_query_not ),
+ SYM_MAP( e_book_query_ref ),
SYM_MAP( e_book_query_unref ),
SYM_MAP( e_book_query_from_string ),
SYM_MAP( e_book_query_to_string ),
@@ -83,7 +84,7 @@ tryLink( oslModule &aModule, const char *pName )
for( guint i = 0; i < G_N_ELEMENTS( aApiMap ); i++ )
{
SymbolFunc aMethod;
- aMethod = (SymbolFunc) osl_getSymbol
+ aMethod = (SymbolFunc) osl_getFunctionSymbol
( aModule, rtl::OUString::createFromAscii ( aApiMap[ i ].sym_name ).pData );
if( !aMethod )
{
diff --git a/connectivity/source/drivers/evoab2/EApi.h b/connectivity/source/drivers/evoab2/EApi.h
index ce969f38673a..34dfc8930949 100644
--- a/connectivity/source/drivers/evoab2/EApi.h
+++ b/connectivity/source/drivers/evoab2/EApi.h
@@ -124,6 +124,7 @@ EAPI_EXTERN EBookQuery* (*e_book_query_field_test) (EContactField field,
EAPI_EXTERN EBookQuery* (*e_book_query_and) (int nqs, EBookQuery **qs, gboolean unref);
EAPI_EXTERN EBookQuery* (*e_book_query_or) (int nqs, EBookQuery **qs, gboolean unref);
EAPI_EXTERN EBookQuery* (*e_book_query_not) (EBookQuery *q, gboolean unref);
+EAPI_EXTERN EBookQuery* (*e_book_query_ref) (EBookQuery *q);
EAPI_EXTERN void (*e_book_query_unref) (EBookQuery *q);
EAPI_EXTERN char* (*e_book_query_to_string) (EBookQuery *q);
EAPI_EXTERN EBookQuery* (*e_book_query_from_string) (const char *query_string);
diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx
index f999a49c7df0..b38ad6b9e629 100644
--- a/connectivity/source/drivers/evoab2/NConnection.cxx
+++ b/connectivity/source/drivers/evoab2/NConnection.cxx
@@ -82,11 +82,10 @@ using namespace ::com::sun::star::lang;
}
// --------------------------------------------------------------------------------
-OEvoabConnection::OEvoabConnection(OEvoabDriver* _pDriver)
- :OSubComponent<OEvoabConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this)
- ,m_pDriver(_pDriver)
+OEvoabConnection::OEvoabConnection( OEvoabDriver& _rDriver )
+ :OSubComponent<OEvoabConnection, OConnection_BASE>( (::cppu::OWeakObject*)(&_rDriver), this )
+ ,m_rDriver(_rDriver)
,m_xCatalog(NULL)
- ,m_aPassword()
{
}
//-----------------------------------------------------------------------------
@@ -98,8 +97,6 @@ OEvoabConnection::~OEvoabConnection()
acquire();
close();
}
-
- m_pDriver = NULL;
}
//-----------------------------------------------------------------------------
@@ -195,8 +192,9 @@ Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( con
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement(this, sql);
+ OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement( this );
Reference< XPreparedStatement > xStmt = pStmt;
+ pStmt->construct( sql );
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
return xStmt;
@@ -228,11 +226,11 @@ void SAL_CALL OEvoabConnection::close( ) throw(SQLException, RuntimeException)
// XWarningsSupplier
Any SAL_CALL OEvoabConnection::getWarnings( ) throw(SQLException, RuntimeException)
{
- return Any(); // when you collected some warnings -> return it
+ return m_aWarnings.getWarnings();
}
void SAL_CALL OEvoabConnection::clearWarnings( ) throw(SQLException, RuntimeException)
{
- // you should clear your collected warnings here
+ m_aWarnings.clearWarnings();
}
//------------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
index bcd3b3b61ce4..3ffa903e92cf 100644
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ b/connectivity/source/drivers/evoab2/NConnection.hxx
@@ -37,10 +37,12 @@
#include "OSubComponent.hxx"
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include "connectivity/CommonTools.hxx"
+#include "connectivity/warningscontainer.hxx"
#include "TConnection.hxx"
#include <cppuhelper/weakref.hxx>
#include <osl/module.h>
#include "EApi.h"
+
namespace connectivity
{
namespace evoab
@@ -57,35 +59,29 @@ namespace connectivity
typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
- class OEvoabConnection : public OConnection_BASE,
- public connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>
+ class OEvoabConnection :public OConnection_BASE
+ ,public connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>
{
-
friend class connectivity::OSubComponent<OEvoabConnection, OConnection_BASE>;
private:
- OEvoabDriver *m_pDriver;
- ::rtl::OUString m_pCurrentTableName;
+ const OEvoabDriver& m_rDriver;
SDBCAddress::sdbc_address_type m_eSDBCAddressType;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >
+ m_xCatalog;
+ ::rtl::OString m_aPassword;
+ ::dbtools::WarningsContainer m_aWarnings;
- protected:
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
- rtl::OString m_aPassword;
-
-
- public:
- OEvoabConnection(OEvoabDriver* _pDriver);
virtual ~OEvoabConnection();
+ public:
+ OEvoabConnection( OEvoabDriver& _rDriver );
virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException);
inline rtl::OString getPassword() { return m_aPassword; }
inline void setPassword( rtl::OString aStr ) { m_aPassword = aStr; }
- inline rtl::OUString& getCurrentTableName() {return m_pCurrentTableName;}
- inline void setCurrentTableName(::rtl::OUString _name) {m_pCurrentTableName=_name;}
// own methods
- inline const OEvoabDriver* getDriver() const { return static_cast< const OEvoabDriver* >( m_pDriver ); }
+ inline const OEvoabDriver& getDriver() const { return m_rDriver; }
SDBCAddress::sdbc_address_type getSDBCAddressType() const { return m_eSDBCAddressType;}
void setSDBCAddressType(SDBCAddress::sdbc_address_type _eSDBCAddressType) {m_eSDBCAddressType = _eSDBCAddressType;}
@@ -124,8 +120,6 @@ namespace connectivity
// XWarningsSupplier
virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
-
};
}
}
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index 259d5bbbc0b0..9765a30359a0 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NDatabaseMetaData.cxx,v $
- * $Revision: 1.12 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -174,21 +171,24 @@ namespace connectivity
return NULL;
}
- sal_Int32
- getFieldType( guint nCol )
+ GType
+ getGFieldType( guint nCol )
{
- sal_Int32 nType = DataType::VARCHAR;
initFields();
+
+ sal_Int32 nType = G_TYPE_STRING;
if ( nCol < nFields )
- {
- if( ((GParamSpec *)pFields[nCol]->pField)->value_type == G_TYPE_STRING )
- nType = DataType::VARCHAR;
- else
- nType = DataType::BIT;
- }
+ return ((GParamSpec *)pFields[nCol]->pField)->value_type;
return nType;
}
+ sal_Int32
+ getFieldType( guint nCol )
+ {
+ sal_Int32 nType = getGFieldType( nCol );
+ return nType == G_TYPE_STRING ? DataType::VARCHAR : DataType::BIT;
+ }
+
guint findEvoabField(const rtl::OUString& aColName)
{
guint nRet = (guint)-1;
@@ -271,9 +271,7 @@ OEvoabDatabaseMetaData::~OEvoabDatabaseMetaData()
}
// -------------------------------------------------------------------------
-ODatabaseMetaDataResultSet::ORows& SAL_CALL OEvoabDatabaseMetaData::getColumnRows(
- const ::rtl::OUString& /*tableNamePattern*/,
- const ::rtl::OUString& columnNamePattern ) throw(SQLException)
+ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const ::rtl::OUString& columnNamePattern )
{
static ODatabaseMetaDataResultSet::ORows aRows;
ODatabaseMetaDataResultSet::ORow aRow(19);
@@ -322,7 +320,7 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL OEvoabDatabaseMetaData::getColumnRow
aRow[5] = new ORowSetValueDecorator( static_cast<sal_Int16>( getFieldType( i ) ) );
aRow[6] = new ORowSetValueDecorator( getFieldTypeName( i ) );
- OSL_TRACE( " ColumnName = '%s'", g_param_spec_get_name( pFields[i]->pField ) );
+ OSL_TRACE( "ColumnName = '%s'", g_param_spec_get_name( pFields[i]->pField ) );
// COLUMN_NAME
aRow[4] = new ORowSetValueDecorator( getFieldName( i ) );
// ORDINAL_POSITION
@@ -1019,18 +1017,9 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) throw
static ::rtl::OUString sTableTypes[] =
{
::rtl::OUString::createFromAscii("TABLE"),
- //m_pConnection->getCurrentTableName(),
- //
// Currently we only support a 'TABLE' nothing more complex
- //
- // ::rtl::OUString::createFromAscii("VIEW"),
- // ::rtl::OUString::createFromAscii("SYSTEM TABLE"),
- // ::rtl::OUString::createFromAscii("GLOBAL TEMPORARY"),
- // ::rtl::OUString::createFromAscii("LOCAL TEMPORARY"),
- // ::rtl::OUString::createFromAscii("ALIAS"),
- // ::rtl::OUString::createFromAscii("SYNONYM")
};
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
Reference< XResultSet > xRef = pResult;
// here we fill the rows which should be visible when ask for data from the resultset returned here
@@ -1043,7 +1032,6 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) throw
aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
// bound row
- ODatabaseMetaDataResultSet::ORow::iterator aIter = aRow.begin();
aRows.push_back(aRow);
}
// here we set the rows at the resultset
@@ -1076,7 +1064,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
// aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
- aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL));
aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
@@ -1099,14 +1087,14 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( )
}
// -------------------------------------------------------------------------
Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns(
- const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
+ const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*tableNamePattern*/,
const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
{
// this returns an empty resultset where the column-names are already set
// in special the metadata of the resultset already returns the right columns
ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns );
Reference< XResultSet > xResultSet = pResultSet;
- pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern ) );
+ pResultSet->setRows( getColumnRows( columnNamePattern ) );
return xResultSet;
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
index 0432597e353a..d0e1803f3f5a 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NDatabaseMetaData.hxx,v $
- * $Revision: 1.10 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -70,6 +67,7 @@ namespace connectivity
const ColumnProperty *getField(guint n);
guint getFieldCount() ;
+ GType getGFieldType(guint nCol) ;
sal_Int32 getFieldType(guint nCol) ;
rtl::OUString getFieldTypeName(guint nCol) ;
rtl::OUString getFieldName(guint nCol) ;
@@ -81,7 +79,7 @@ namespace connectivity
{
OEvoabConnection* m_pConnection;
- ODatabaseMetaDataResultSet::ORows& SAL_CALL getColumnRows( const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw( ::com::sun::star::sdbc::SQLException );
+ ODatabaseMetaDataResultSet::ORows& getColumnRows( const ::rtl::OUString& columnNamePattern );
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw();
diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx
index ccbb47ce963f..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();
}
}
}
@@ -147,7 +147,7 @@ Reference< XConnection > SAL_CALL OEvoabDriver::connect( const ::rtl::OUString&
if ( ! acceptsURL(url) )
return NULL;
- OEvoabConnection* pCon = new OEvoabConnection(this);
+ OEvoabConnection* pCon = new OEvoabConnection( *this );
pCon->construct(url,info);
Reference< XConnection > xCon = pCon;
m_xConnections.push_back(WeakReferenceHelper(*pCon));
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
index 029349f834de..3efcdc740ebf 100644
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NPreparedStatement.cxx,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -40,6 +37,7 @@
#include "propertyids.hxx"
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
+#include <tools/diagnose_ex.h>
#include "resource/common_res.hrc"
@@ -55,49 +53,67 @@ using namespace com::sun::star::util;
IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,"com.sun.star.sdbcx.evoab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
-OEvoabPreparedStatement::OEvoabPreparedStatement( OEvoabConnection* _pConnection, const ::rtl::OUString& sql)
- :OStatement_BASE2(_pConnection)
- ,m_nNumParams(0)
- ,m_sSqlStatement(sql)
- ,m_bPrepared(sal_False)
+OEvoabPreparedStatement::OEvoabPreparedStatement( OEvoabConnection* _pConnection )
+ :OCommonStatement(_pConnection)
+ ,m_sSqlStatement()
+ ,m_xMetaData()
{
}
+
+// -----------------------------------------------------------------------------
+void OEvoabPreparedStatement::construct( const ::rtl::OUString& _sql )
+{
+ m_sSqlStatement = _sql;
+
+ m_aQueryData = impl_getEBookQuery_throw( m_sSqlStatement );
+ ENSURE_OR_THROW( m_aQueryData.getQuery(), "no EBookQuery" );
+ ENSURE_OR_THROW( m_aQueryData.xSelectColumns.isValid(), "no SelectColumn" );
+
+ // create our meta data
+ OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( m_aQueryData.sTable );
+ m_xMetaData = pMeta;
+ pMeta->setEvoabFields( m_aQueryData.xSelectColumns );
+}
+
// -----------------------------------------------------------------------------
OEvoabPreparedStatement::~OEvoabPreparedStatement()
{
}
+
// -----------------------------------------------------------------------------
void SAL_CALL OEvoabPreparedStatement::acquire() throw()
{
- OStatement_BASE2::acquire();
+ OCommonStatement::acquire();
}
+
// -----------------------------------------------------------------------------
void SAL_CALL OEvoabPreparedStatement::release() throw()
{
- OStatement_BASE2::release();
+ OCommonStatement::release();
}
+
// -----------------------------------------------------------------------------
Any SAL_CALL OEvoabPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- Any aRet = OStatement_BASE2::queryInterface(rType);
+ Any aRet = OCommonStatement::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPreparedStatement_BASE::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OEvoabPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
+Sequence< Type > SAL_CALL OEvoabPreparedStatement::getTypes( ) throw(RuntimeException)
{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes());
+ return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
}
// -------------------------------------------------------------------------
Reference< XResultSetMetaData > SAL_CALL OEvoabPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- if(!m_xMetaData.is())
- m_xMetaData = new OEvoabResultSetMetaData(m_pConnection->getCurrentTableName());
+ // the meta data should have been created at construction time
+ ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
return m_xMetaData;
}
// -------------------------------------------------------------------------
@@ -105,13 +121,13 @@ Reference< XResultSetMetaData > SAL_CALL OEvoabPreparedStatement::getMetaData(
void SAL_CALL OEvoabPreparedStatement::close( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
free_column_resources();
// Reset last warning message
try {
clearWarnings ();
- OStatement_BASE2::close();
+ OCommonStatement::close();
}
catch (SQLException &) {
// If we get an error, ignore
@@ -123,11 +139,9 @@ void SAL_CALL OEvoabPreparedStatement::close( ) throw(SQLException, RuntimeExce
sal_Bool SAL_CALL OEvoabPreparedStatement::execute( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = OStatement_Base::executeQuery( m_sSqlStatement );
- // same as in statement with the difference that this statement also can contain parameter
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
+ Reference< XResultSet> xRS = impl_executeQuery_throw( m_aQueryData );
return xRS.is();
}
// -------------------------------------------------------------------------
@@ -135,9 +149,8 @@ sal_Bool SAL_CALL OEvoabPreparedStatement::execute( ) throw(SQLException, Runti
sal_Int32 SAL_CALL OEvoabPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- // same as in statement with the difference that this statement also can contain parameter
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
return 0;
}
// -------------------------------------------------------------------------
@@ -151,19 +164,18 @@ void SAL_CALL OEvoabPreparedStatement::setString( sal_Int32 /*parameterIndex*/,
Reference< XConnection > SAL_CALL OEvoabPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- return (Reference< XConnection >)m_pConnection;
+ return impl_getConnection();
}
// -------------------------------------------------------------------------
Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
- Reference< XResultSet > rs = OStatement_Base::executeQuery( m_sSqlStatement );
- return rs;
+ return impl_executeQuery_throw( m_aQueryData );
}
// -------------------------------------------------------------------------
@@ -268,7 +280,7 @@ void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 parameterIndex, cons
{
if(!::dbtools::implSetObject(this,parameterIndex,x))
{
- const ::rtl::OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
+ const ::rtl::OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
STR_UNKNOWN_PARA_TYPE,
"$position$", ::rtl::OUString::valueOf(parameterIndex)
) );
@@ -290,13 +302,13 @@ void SAL_CALL OEvoabPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, c
// -------------------------------------------------------------------------
-void SAL_CALL OEvoabPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OEvoabPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
{
::dbtools::throwFunctionNotSupportedException( "XParameters::setCharacterStream", *this );
}
// -------------------------------------------------------------------------
-void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
+void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
{
::dbtools::throwFunctionNotSupportedException( "XParameters::setBinaryStream", *this );
}
@@ -305,35 +317,18 @@ void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterInd
void SAL_CALL OEvoabPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
{
}
-// -------------------------------------------------------------------------
-void OEvoabPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_USEBOOKMARKS:
- break;
- default:
- OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- }
-}
// -----------------------------------------------------------------------------
-::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OEvoabPreparedStatement::getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::getResultSet( ) throw(SQLException, RuntimeException)
{
return NULL;
}
// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OEvoabPreparedStatement::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL OEvoabPreparedStatement::getUpdateCount( ) throw(SQLException, RuntimeException)
{
return 0;
}
// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OEvoabPreparedStatement::getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+sal_Bool SAL_CALL OEvoabPreparedStatement::getMoreResults( ) throw(SQLException, RuntimeException)
{
return sal_False;
}
diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
index b86e5a4db64b..a20ef1e7f084 100644
--- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
+++ b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NPreparedStatement.hxx,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -53,8 +50,8 @@ namespace connectivity
::com::sun::star::sdbc::XMultipleResults,
::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
- class OEvoabPreparedStatement : public OStatement_BASE2,
- public OPreparedStatement_BASE
+ class OEvoabPreparedStatement :public OCommonStatement
+ ,public OPreparedStatement_BASE
{
protected:
struct Parameter
@@ -74,25 +71,23 @@ namespace connectivity
// Data attributes
//====================================================================
- sal_Int32 m_nNumParams; // Number of parameter markers
- // for the prepared statement
-
- ::rtl::OUString m_sSqlStatement;
+ // our SQL statement
+ ::rtl::OUString m_sSqlStatement;
+ // the EBookQuery we're working with
+ QueryData m_aQueryData;
+ // our meta data
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
- sal_Bool m_bPrepared;
-
protected:
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception);
virtual ~OEvoabPreparedStatement();
+
public:
- DECLARE_SERVICE_INFO();
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- //OEvoabPreparedStatement( OEvoabConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql);
- OEvoabPreparedStatement( OEvoabConnection* _pConnection, const ::rtl::OUString& sql);
+ OEvoabPreparedStatement( OEvoabConnection* _pConnection );
+ void construct( const ::rtl::OUString& _sql );
+
+ protected:
+ DECLARE_SERVICE_INFO();
//XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire() throw();
@@ -137,7 +132,6 @@ namespace connectivity
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
};
}
}
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 0001f12ae158..d71908e0afd8 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NResultSet.cxx,v $
- * $Revision: 1.8.56.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -30,34 +27,43 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
-#include <comphelper/property.hxx>
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <comphelper/extract.hxx>
+
+#include "NDatabaseMetaData.hxx"
+#include "NConnection.hxx"
+#include "NResultSet.hxx"
+#include "propertyids.hxx"
+#include "resource/evoab2_res.hrc"
+#include "TSortIndex.hxx"
+#include <algorithm>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbexception.hxx>
-#include <TSortIndex.hxx>
+#include <connectivity/sqlerror.hxx>
+#include <cppuhelper/typeprovider.hxx>
#include <rtl/string.hxx>
+#include <tools/diagnose_ex.h>
+#include <svtools/syslocale.hxx>
+#include <unotools/intlwrapper.hxx>
+
+#include <cstring>
#include <vector>
-#include <algorithm>
-#include "NResultSet.hxx"
-#include "NDatabaseMetaData.hxx"
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "propertyids.hxx"
-#include <svtools/logindlg.hxx>
-#include "resource/evoab2_res.hrc"
+
+namespace connectivity { namespace evoab {
using namespace ::comphelper;
-using namespace connectivity;
-using namespace connectivity::evoab;
-using namespace cppu;
+using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
@@ -65,7 +71,7 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
-using namespace ::com::sun::star::util;
+namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition;
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException) \
@@ -92,9 +98,9 @@ sal_Bool SAL_CALL OEvoabResultSet::supportsService( const ::rtl::OUString& _rSer
}
// -------------------------------------------------------------------------
-OEvoabResultSet::OEvoabResultSet(OStatement_Base* pStmt,OEvoabConnection *pConnection,OSQLParseTreeIterator& _aSQLIterator)
- : OResultSet_BASE(m_aMutex)
- ,OPropertySetHelper(OResultSet_BASE::rBHelper)
+OEvoabResultSet::OEvoabResultSet( OCommonStatement* pStmt, OEvoabConnection *pConnection )
+ :OResultSet_BASE(m_aMutex)
+ ,::comphelper::OPropertyContainer( OResultSet_BASE::rBHelper )
,m_pStatement(pStmt)
,m_pConnection(pConnection)
,m_xMetaData(NULL)
@@ -106,18 +112,24 @@ OEvoabResultSet::OEvoabResultSet(OStatement_Base* pStmt,OEvoabConnection *pConne
,m_pContacts(NULL)
,m_nIndex(-1)
,m_nLength(0)
- ,m_aSQLIterator(_aSQLIterator)
{
-}
+ #define REGISTER_PROP( id, member ) \
+ registerProperty( \
+ OMetaConnection::getPropMap().getNameByIndex( id ), \
+ id, \
+ PropertyAttribute::READONLY, \
+ &member, \
+ ::getCppuType( &member ) \
+ );
-// -------------------------------------------------------------------------
-OEvoabResultSet::~OEvoabResultSet()
-{
+ REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
+ REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
+ REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
+ REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
}
// -------------------------------------------------------------------------
-
-void OEvoabResultSet::construct(void)
+OEvoabResultSet::~OEvoabResultSet()
{
}
@@ -188,11 +200,29 @@ static rtl::OString getUserName( EBook *pBook )
return aName;
}
+static ::rtl::OUString
+valueToOUString( GValue& _rValue )
+{
+ const char *pStr = g_value_get_string( &_rValue );
+ rtl::OString aStr( pStr ? pStr : "" );
+ ::rtl::OUString sResult( ::rtl::OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) );
+ g_value_unset( &_rValue );
+ return sResult;
+}
+
+static bool
+valueToBool( GValue& _rValue )
+{
+ bool bResult = g_value_get_boolean( &_rValue );
+ g_value_unset( &_rValue );
+ return bResult;
+}
+
static bool
-executeQuery (EBook *pBook, EBookQuery *pQuery, GList **ppList,
+executeQuery (EBook* pBook, EBookQuery* pQuery, GList **ppList,
rtl::OString &rPassword, GError **pError)
{
- ESource *pSource = e_book_get_source (pBook);
+ ESource *pSource = e_book_get_source( pBook );
bool bSuccess = false;
bool bAuthSuccess = true;
@@ -211,63 +241,6 @@ executeQuery (EBook *pBook, EBookQuery *pQuery, GList **ppList,
return bSuccess;
}
-void OEvoabResultSet::construct( EBookQuery *pQuery, rtl::OString aTable, bool bIsWithoutWhere )
-{
- EBook *pBook = openBook( aTable );
-
- if (pBook)
- {
- g_list_free(m_pContacts);
- m_pContacts = NULL;
- if( bIsWithoutWhere && !isLocal( pBook ) )
- {
- OSL_TRACE( "large query on non-local book - ignored" );
- m_pConnection->throwGenericSQLException(STR_USE_WHERE_CRIT,*this);
- }
- else
- {
- OSL_TRACE( "Query without where ? '%d'", bIsWithoutWhere );
- rtl::OString aPassword = m_pConnection->getPassword();
- executeQuery( pBook, pQuery, &m_pContacts, aPassword, NULL );
- m_pConnection->setPassword( aPassword );
- }
- m_nLength = g_list_length( m_pContacts );
-
- OSL_TRACE( "Query return %d records", m_nLength );
- m_nIndex = -1;
- }
-}
-
-// -------------------------------------------------------------------------
-void OEvoabResultSet::disposing(void)
-{
- OPropertySetHelper::disposing();
-
- ::osl::MutexGuard aGuard(m_aMutex);
- g_list_free(m_pContacts);
- m_pContacts = NULL;
- m_pStatement = NULL;
- m_xMetaData = NULL;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OPropertySetHelper::queryInterface(rType);
- if(!aRet.hasValue())
- aRet = OResultSet_BASE::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OEvoabResultSet::getTypes( ) throw( RuntimeException)
-{
- OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
-
- /* Dont know what is this yet */
- return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
-}
-
static int
whichAddress(int value)
{
@@ -311,7 +284,7 @@ whichAddress(int value)
* The search order is Work->Home->other(defaults).
*/
static EContactAddress *
-getDefaultContactAddress(EContact *pContact,int *value)
+getDefaultContactAddress( EContact *pContact,int *value )
{
EContactAddress *ec = (EContactAddress *)e_contact_get(pContact,whichAddress(WORK_ADDR_LINE1));
if ( ec && (strlen(ec->street)>0) )
@@ -334,7 +307,7 @@ getDefaultContactAddress(EContact *pContact,int *value)
}
static EContactAddress*
-getContactAddress(EContact *pContact, int * address_enum)
+getContactAddress( EContact *pContact, int * address_enum )
{
EContactAddress *ec = NULL;
switch (*address_enum) {
@@ -353,9 +326,8 @@ getContactAddress(EContact *pContact, int * address_enum)
}
static bool
-handleSplitAddress(EContact *pContact,GValue *pStackValue,int value)
+handleSplitAddress( EContact *pContact,GValue *pStackValue, int value )
{
-
EContactAddress *ec = getContactAddress(pContact,&value) ;
if (ec==NULL)
@@ -403,65 +375,232 @@ handleSplitAddress(EContact *pContact,GValue *pStackValue,int value)
}
-return false;
+ return false;
}
-// -------------------------------------------------------------------------
-// XRow Interface
-
-bool
-OEvoabResultSet::getValue( sal_Int32 nColumnNum, GType nType, GValue *pStackValue)
+static bool
+getValue( EContact* pContact, sal_Int32 nColumnNum, GType nType, GValue* pStackValue, bool& _out_rWasNull )
{
- const ColumnProperty * pSpecs = evoab::getField (nColumnNum );
- if (!pSpecs)
- return sal_False;
- GParamSpec *pSpec = pSpecs->pField;
- gboolean bIsSplittedColumn=pSpecs->bIsSplittedValue;
- EContact *pContact = getCur();
+ const ColumnProperty * pSpecs = evoab::getField( nColumnNum );
+ if ( !pSpecs )
+ return false;
+
+ GParamSpec* pSpec = pSpecs->pField;
+ gboolean bIsSplittedColumn = pSpecs->bIsSplittedValue;
- m_bWasNull = true;
- if (!pSpec || !pContact) {
+ _out_rWasNull = true;
+ if ( !pSpec || !pContact)
return false;
- }
- if (G_PARAM_SPEC_VALUE_TYPE (pSpec) != nType)
+
+ if ( G_PARAM_SPEC_VALUE_TYPE (pSpec) != nType )
{
-#ifdef DEBUG
- g_warning ("Wrong type (0x%x) (0x%x) '%s'",
+
+ OSL_TRACE( "Wrong type (0x%x) (0x%x) '%s'",
(int)G_PARAM_SPEC_VALUE_TYPE (pSpec), (int) nType,
pSpec->name ? pSpec->name : "<noname>");
-#endif
return false;
}
- g_value_init (pStackValue, nType);
- if (bIsSplittedColumn)
+
+ g_value_init( pStackValue, nType );
+ if ( bIsSplittedColumn )
{
const SplitEvoColumns* evo_addr( get_evo_addr() );
for (int i=0;i<OTHER_ZIP;i++)
{
if (0 == strcmp (g_param_spec_get_name ((GParamSpec *)pSpec), evo_addr[i].pColumnName))
{
- m_bWasNull = handleSplitAddress (pContact, pStackValue, evo_addr[i].value);
+ _out_rWasNull = handleSplitAddress( pContact, pStackValue, evo_addr[i].value );
return true;
}
}
}
else
{
- g_object_get_property (G_OBJECT (pContact),
+ g_object_get_property( G_OBJECT (pContact),
g_param_spec_get_name ((GParamSpec *) pSpec),
- pStackValue);
- if (G_VALUE_TYPE (pStackValue) != nType)
+ pStackValue );
+ if ( G_VALUE_TYPE( pStackValue ) != nType )
{
-#ifdef DEBUG
- g_warning ("Fetched type mismatch");
-#endif
- g_value_unset (pStackValue);
+ OSL_TRACE( "Fetched type mismatch" );
+ g_value_unset( pStackValue );
return false;
}
}
- m_bWasNull = false;
+ _out_rWasNull = false;
return true;
}
+namespace
+{
+ struct ComparisonData
+ {
+ const SortDescriptor& rSortOrder;
+ IntlWrapper aIntlWrapper;
+
+ ComparisonData( const SortDescriptor& _rSortOrder, const Reference< XMultiServiceFactory >& _rxFactory )
+ :rSortOrder( _rSortOrder )
+ ,aIntlWrapper( _rxFactory, SvtSysLocale().GetLocaleData().getLocale() )
+ {
+ }
+ };
+}
+
+extern "C"
+int CompareContacts( gconstpointer _lhs, gconstpointer _rhs, gpointer _userData )
+{
+ EContact* lhs = static_cast< EContact* >( const_cast< gpointer >( _lhs ) );
+ EContact* rhs = static_cast< EContact* >( const_cast< gpointer >( _rhs ) );
+
+ GValue aLhsValue = { 0, { { 0 } } };
+ GValue aRhsValue = { 0, { { 0 } } };
+ bool bLhsNull = true;
+ bool bRhsNull = true;
+
+ ::rtl::OUString sLhs, sRhs;
+ bool bLhs(false), bRhs(false);
+
+ const ComparisonData& rCompData = *static_cast< const ComparisonData* >( _userData );
+ for ( SortDescriptor::const_iterator sortCol = rCompData.rSortOrder.begin();
+ sortCol != rCompData.rSortOrder.end();
+ ++sortCol
+ )
+ {
+ sal_Int32 nField = sortCol->nField;
+ GType eFieldType = evoab::getGFieldType( nField );
+
+ bool success = getValue( lhs, nField, eFieldType, &aLhsValue, bLhsNull )
+ && getValue( rhs, nField, eFieldType, &aRhsValue, bRhsNull );
+ OSL_ENSURE( success, "CompareContacts: could not retrieve both values!" );
+ if ( !success )
+ return 0;
+
+ if ( bLhsNull && !bRhsNull )
+ return -1;
+ if ( !bLhsNull && bRhsNull )
+ return 1;
+ if ( bLhsNull && bRhsNull )
+ continue;
+
+ if ( eFieldType == G_TYPE_STRING )
+ {
+ sLhs = valueToOUString( aLhsValue );
+ sRhs = valueToOUString( aRhsValue );
+ sal_Int32 nCompResult = rCompData.aIntlWrapper.getCaseCollator()->compareString( sLhs, sRhs );
+ if ( nCompResult != 0 )
+ return nCompResult;
+ continue;
+ }
+
+ bLhs = valueToBool( aLhsValue );
+ bRhs = valueToBool( aRhsValue );
+ if ( bLhs && !bRhs )
+ return -1;
+ if ( !bLhs && bRhs )
+ return 1;
+ continue;
+ }
+
+ return 0;
+}
+
+static GList*
+sortContacts( GList* _pContactList, const ComparisonData& _rCompData )
+{
+ OSL_ENSURE( !_rCompData.rSortOrder.empty(), "sortContacts: no need to call this without any sort order!" );
+ ENSURE_OR_THROW( _rCompData.aIntlWrapper.getCaseCollator(), "no collator for comparing strings" );
+
+ return g_list_sort_with_data( _pContactList, &CompareContacts, const_cast< gpointer >( static_cast< gconstpointer >( &_rCompData ) ) );
+}
+
+// -------------------------------------------------------------------------
+void OEvoabResultSet::construct( const QueryData& _rData )
+{
+ ENSURE_OR_THROW( _rData.getQuery(), "internal error: no EBookQuery" );
+
+ EBook *pBook = openBook( ::rtl::OUStringToOString( _rData.sTable, RTL_TEXTENCODING_UTF8 ) );
+ if ( !pBook )
+ m_pConnection->throwGenericSQLException( STR_CANNOT_OPEN_BOOK, *this );
+
+ g_list_free(m_pContacts);
+ m_pContacts = NULL;
+ bool bExecuteQuery = true;
+ switch ( _rData.eFilterType )
+ {
+ case eFilterNone:
+ if ( !isLocal( pBook ) )
+ {
+ SQLError aErrorFactory( m_pConnection->getDriver().getMSFactory() );
+ SQLException aAsException = aErrorFactory.getSQLException( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED, *this );
+ m_aWarnings.appendWarning( SQLWarning(
+ aAsException.Message,
+ aAsException.Context,
+ aAsException.SQLState,
+ aAsException.ErrorCode,
+ aAsException.NextException
+ ) );
+ bExecuteQuery = false;
+ }
+ break;
+ case eFilterAlwaysFalse:
+ bExecuteQuery = false;
+ break;
+ case eFilterOther:
+ bExecuteQuery = true;
+ break;
+ }
+ if ( bExecuteQuery )
+ {
+ rtl::OString aPassword = m_pConnection->getPassword();
+ executeQuery( pBook, _rData.getQuery(), &m_pContacts, aPassword, NULL );
+ m_pConnection->setPassword( aPassword );
+
+ if ( m_pContacts && !_rData.aSortOrder.empty() )
+ {
+ ComparisonData aCompData( _rData.aSortOrder, getConnection()->getDriver().getMSFactory() );
+ m_pContacts = sortContacts( m_pContacts, aCompData );
+ }
+ }
+ m_nLength = g_list_length( m_pContacts );
+ OSL_TRACE( "Query return %d records", m_nLength );
+ m_nIndex = -1;
+
+ // create our meta data (need the EBookQuery for this)
+ OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( _rData.sTable );
+ m_xMetaData = pMeta;
+
+ pMeta->setEvoabFields( _rData.xSelectColumns );
+}
+
+// -------------------------------------------------------------------------
+void OEvoabResultSet::disposing(void)
+{
+ ::comphelper::OPropertyContainer::disposing();
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ g_list_free(m_pContacts);
+ m_pContacts = NULL;
+ m_pStatement = NULL;
+m_xMetaData.clear();
+}
+// -------------------------------------------------------------------------
+Any SAL_CALL OEvoabResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = OResultSet_BASE::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+Sequence< Type > SAL_CALL OEvoabResultSet::getTypes( ) throw( RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ OResultSet_BASE::getTypes(),
+ ::comphelper::OPropertyContainer::getTypes()
+ );
+}
+
+// -------------------------------------------------------------------------
+// XRow Interface
+
/**
* getString:
* @nColumnNum: The column index from the table.
@@ -475,17 +614,12 @@ OEvoabResultSet::getValue( sal_Int32 nColumnNum, GType nType, GValue *pStackValu
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
rtl::OUString aResult;
if ( m_xMetaData.is())
- {
- OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
- sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
- GValue aValue = {0, {{0}}};
- if (getValue (nFieldNumber, G_TYPE_STRING, &aValue))
- {
- const char *pStr = g_value_get_string (&aValue);
- rtl::OString aStr (pStr ? pStr : "");
- aResult = rtl::OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 );
- g_value_unset (&aValue);
- }
+ {
+ OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
+ sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
+ GValue aValue = { 0, { { 0 } } };
+ if ( getValue( getCur(), nFieldNumber, G_TYPE_STRING, &aValue, m_bWasNull ) )
+ aResult = valueToOUString( aValue );
}
return aResult;
}
@@ -497,15 +631,12 @@ sal_Bool SAL_CALL OEvoabResultSet::getBoolean( sal_Int32 nColumnNum ) throw(SQLE
sal_Bool bResult = sal_False;
if ( m_xMetaData.is())
- {
- OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
- sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
- GValue aValue = {0, {{0}}};
- if (getValue (nFieldNumber, G_TYPE_BOOLEAN, &aValue))
- {
- bResult = g_value_get_boolean (&aValue);
- g_value_unset (&aValue);
- }
+ {
+ OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) m_xMetaData.get();
+ sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
+ GValue aValue = { 0, { { 0 } } };
+ if ( getValue( getCur(), nFieldNumber, G_TYPE_BOOLEAN, &aValue, m_bWasNull ) )
+ bResult = valueToBool( aValue );
}
return bResult ? sal_True : sal_False;
}
@@ -558,7 +689,7 @@ sal_Int16 SAL_CALL OEvoabResultSet::getShort( sal_Int32 /*nColumnNum*/ ) throw(S
return ::com::sun::star::util::Time();
}
// -------------------------------------------------------------------------
-DateTime SAL_CALL OEvoabResultSet::getTimestamp( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
+util::DateTime SAL_CALL OEvoabResultSet::getTimestamp( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
{
::dbtools::throwFunctionNotSupportedException( "XRow::getTimestamp", *this );
return ::com::sun::star::util::DateTime();
@@ -620,9 +751,8 @@ Reference< XResultSetMetaData > SAL_CALL OEvoabResultSet::getMetaData( ) throw(
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- OSL_TRACE("OEvoabResultSet::getMetaData");
- if(!m_xMetaData.is())
- m_xMetaData = new OEvoabResultSetMetaData(m_pConnection->getCurrentTableName());
+ // the meta data should have been created at construction time
+ ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
return m_xMetaData;
}
// XResultSetMetaDataSupplier Interface Ends
@@ -829,12 +959,13 @@ void SAL_CALL OEvoabResultSet::close( ) throw(SQLException, RuntimeException)
void SAL_CALL OEvoabResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
{
OSL_TRACE("In/Out: OEvoabResultSet::clearWarnings" );
+ m_aWarnings.clearWarnings();
}
// -------------------------------------------------------------------------
Any SAL_CALL OEvoabResultSet::getWarnings( ) throw(SQLException, RuntimeException)
{
OSL_TRACE("In/Out: OEvoabResultSet::getWarnings" );
- return Any();
+ return m_aWarnings.getWarnings();
}
// -------------------------------------------------------------------------
//XColumnLocate Interface
@@ -857,93 +988,17 @@ sal_Int32 SAL_CALL OEvoabResultSet::findColumn( const ::rtl::OUString& columnNam
//XColumnLocate interface ends
// -------------------------------------------------------------------------
-IPropertyArrayHelper* OEvoabResultSet::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* OEvoabResultSet::createArrayHelper( ) const
{
- Sequence< Property > aProps(6);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
- DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
-
- return new OPropertyArrayHelper(aProps);
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
}
// -------------------------------------------------------------------------
-IPropertyArrayHelper & OEvoabResultSet::getInfoHelper()
+::cppu::IPropertyArrayHelper & OEvoabResultSet::getInfoHelper()
{
return *const_cast<OEvoabResultSet*>(this)->getArrayHelper();
}
-// -------------------------------------------------------------------------
-sal_Bool OEvoabResultSet::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 nHandle,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw ::com::sun::star::lang::IllegalArgumentException();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- default:
- ;
- }
- return sal_False;
-}
-// -------------------------------------------------------------------------
-void OEvoabResultSet::setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const Any& /*rValue*/) throw (Exception)
-{
- switch(nHandle)
- {
- case PROPERTY_ID_ISBOOKMARKABLE:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- throw Exception();
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- break;
- case PROPERTY_ID_FETCHSIZE:
- break;
- default:
- ;
- }
-}
-// -------------------------------------------------------------------------
-void OEvoabResultSet::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
-{
-
- switch(nHandle)
- {
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- rValue <<= (sal_Int32)m_nResultSetConcurrency;
- break;
- case PROPERTY_ID_RESULTSETTYPE:
- rValue <<= m_nResultSetType;
- break;
- case PROPERTY_ID_FETCHDIRECTION:
- rValue <<= m_nFetchDirection;
- break;
- case PROPERTY_ID_FETCHSIZE:
- rValue <<= m_nFetchSize;
- break;
- }
-
-}
// -----------------------------------------------------------------------------
void SAL_CALL OEvoabResultSet::acquire() throw()
{
@@ -961,3 +1016,5 @@ OEvoabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeExce
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
// -----------------------------------------------------------------------------
+
+} } // connectivity::evoab
diff --git a/connectivity/source/drivers/evoab2/NResultSet.hxx b/connectivity/source/drivers/evoab2/NResultSet.hxx
index 927db78f319f..b01928ab19e7 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.hxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.hxx
@@ -42,12 +42,12 @@
#include <com/sun/star/sdbc/XRowUpdate.hpp>
#include <com/sun/star/sdbcx/XRowLocate.hpp>
#include <com/sun/star/sdbcx/XDeleteRows.hpp>
-#ifndef _CPPUHELPER_COMPBASE12_HXX_
#include <cppuhelper/compbase8.hxx>
-#endif
#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
#include "connectivity/CommonTools.hxx"
#include "connectivity/FValue.hxx"
+#include "connectivity/warningscontainer.hxx"
#include "NStatement.hxx"
#include "OSubComponent.hxx"
#include "NResultSetMetaData.hxx"
@@ -56,76 +56,61 @@ namespace connectivity
{
namespace evoab
{
- typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::sdbc::XResultSet,
- ::com::sun::star::sdbc::XRow,
- ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- ::com::sun::star::util::XCancellable,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable,
- ::com::sun::star::sdbc::XColumnLocate,
- ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
-
-
- class OEvoabResultSet : public comphelper::OBaseMutex,
- public OResultSet_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet>
+ typedef ::cppu::WeakComponentImplHelper8 < ::com::sun::star::sdbc::XResultSet
+ , ::com::sun::star::sdbc::XRow
+ , ::com::sun::star::sdbc::XResultSetMetaDataSupplier
+ , ::com::sun::star::util::XCancellable
+ , ::com::sun::star::sdbc::XWarningsSupplier
+ , ::com::sun::star::sdbc::XCloseable
+ , ::com::sun::star::sdbc::XColumnLocate
+ , ::com::sun::star::lang::XServiceInfo
+ > OResultSet_BASE;
+
+
+ class OEvoabResultSet :public comphelper::OBaseMutex
+ ,public OResultSet_BASE
+ ,public ::comphelper::OPropertyContainer
+ ,public ::comphelper::OPropertyArrayUsageHelper<OEvoabResultSet>
{
protected:
- OStatement_Base *m_pStatement;
- OEvoabConnection *m_pConnection;
- ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
+ OCommonStatement* m_pStatement;
+ OEvoabConnection* m_pConnection;
+ ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
+ ::dbtools::WarningsContainer m_aWarnings;
- sal_Bool m_bWasNull;
+ bool m_bWasNull;
+ // <properties>
sal_Int32 m_nFetchSize;
sal_Int32 m_nResultSetType;
sal_Int32 m_nFetchDirection;
sal_Int32 m_nResultSetConcurrency;
+ // </properties>
// Data & iteration
GList *m_pContacts;
sal_Int32 m_nIndex;
sal_Int32 m_nLength;
- connectivity::OSQLParseTreeIterator& m_aSQLIterator;
EContact *getCur()
{
gpointer pData = g_list_nth_data (m_pContacts, m_nIndex);
return pData ? E_CONTACT (pData) : NULL;
}
- bool getValue( sal_Int32 nColumnIndex, GType nType, GValue *pStackValue);
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle
- ) const;
-
// you can't delete objects of this type
virtual ~OEvoabResultSet();
public:
DECLARE_SERVICE_INFO();
- OEvoabResultSet(OStatement_Base *pStmt, OEvoabConnection *pConnection,OSQLParseTreeIterator& _aSQLIterator);
- virtual void construct(void);
- void construct( EBookQuery *pQuery, rtl::OString aTable, bool bIsWithoutWhere );
+ OEvoabResultSet( OCommonStatement *pStmt, OEvoabConnection *pConnection );
+ void construct( const QueryData& _rData );
OEvoabConnection * getConnection() { return m_pConnection; }
diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
index f8b79f01a561..b36a86fb96b0 100644
--- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NResultSetMetaData.cxx,v $
- * $Revision: 1.7.56.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -177,7 +174,7 @@ sal_Int32 SAL_CALL OEvoabResultSetMetaData::isNullable( sal_Int32 /*nColumnNum*/
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OEvoabResultSetMetaData::isSearchable( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
{
- return sal_False;
+ return sal_True;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OEvoabResultSetMetaData::isReadOnly( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/evoab2/NServices.cxx b/connectivity/source/drivers/evoab2/NServices.cxx
index bbecf7a0c9a2..efa9b6d56c72 100644
--- a/connectivity/source/drivers/evoab2/NServices.cxx
+++ b/connectivity/source/drivers/evoab2/NServices.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NServices.cxx,v $
- * $Revision: 1.7 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -117,7 +114,7 @@ struct ProviderRequest
//---------------------------------------------------------------------------------------
-extern "C" void SAL_CALL component_getImplementationEnvironment(
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
const sal_Char **ppEnvTypeName,
uno_Environment ** /*ppEnv*/
)
@@ -126,7 +123,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
}
//---------------------------------------------------------------------------------------
-extern "C" sal_Bool SAL_CALL component_writeInfo(
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
void* /*pServiceManager*/,
void* pRegistryKey
)
@@ -151,7 +148,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(
}
//---------------------------------------------------------------------------------------
-extern "C" void* SAL_CALL component_getFactory(
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pServiceManager,
void* /*pRegistryKey*/)
diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx
index 76f9f0885033..2ddcd84c87a0 100644
--- a/connectivity/source/drivers/evoab2/NStatement.cxx
+++ b/connectivity/source/drivers/evoab2/NStatement.cxx
@@ -1,4 +1,4 @@
- /*************************************************************************
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NStatement.cxx,v $
- * $Revision: 1.12.2.1 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -42,12 +39,16 @@
#include "propertyids.hxx"
#include "NStatement.hxx"
#include "NConnection.hxx"
+#include "NDatabaseMetaData.hxx"
#include "NResultSet.hxx"
#include "NDebug.hxx"
+#include "resource/evoab2_res.hrc"
#include <resource/common_res.hrc>
#include <connectivity/dbexception.hxx>
+#include <tools/diagnose_ex.h>
+
+namespace connectivity { namespace evoab {
-using namespace connectivity::evoab;
//------------------------------------------------------------------------------
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -58,25 +59,53 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
//------------------------------------------------------------------------------
-OStatement_Base::OStatement_Base(OEvoabConnection* _pConnection)
- : OStatement_BASE(m_aMutex)
- , OPropertySetHelper(OStatement_BASE::rBHelper)
+OCommonStatement::OCommonStatement(OEvoabConnection* _pConnection)
+ : OCommonStatement_IBase(m_aMutex)
+ , ::comphelper::OPropertyContainer(OCommonStatement_IBase::rBHelper)
+ , OStatement_CBase( (::cppu::OWeakObject*)_pConnection, this )
, m_xResultSet(NULL)
, m_pResultSet(NULL)
, m_pConnection(_pConnection)
- , m_aParser(_pConnection->getDriver()->getMSFactory())
+ , m_aParser(_pConnection->getDriver().getMSFactory())
, m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL )
, m_pParseTree(NULL)
- , rBHelper(OStatement_BASE::rBHelper)
+ , m_nMaxFieldSize(0)
+ , m_nMaxRows(0)
+ , m_nQueryTimeOut(0)
+ , m_nFetchSize(0)
+ , m_nResultSetType(ResultSetType::FORWARD_ONLY)
+ , m_nFetchDirection(FetchDirection::FORWARD)
+ , m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
+ , m_bEscapeProcessing(sal_True)
+ , rBHelper(OCommonStatement_IBase::rBHelper)
{
m_pConnection->acquire();
+
+#define REGISTER_PROP( id, member ) \
+ registerProperty( \
+ OMetaConnection::getPropMap().getNameByIndex( id ), \
+ id, \
+ 0, \
+ &member, \
+ ::getCppuType( &member ) \
+ );
+
+ REGISTER_PROP( PROPERTY_ID_CURSORNAME, m_aCursorName );
+ REGISTER_PROP( PROPERTY_ID_MAXFIELDSIZE, m_nMaxFieldSize );
+ REGISTER_PROP( PROPERTY_ID_MAXROWS, m_nMaxRows );
+ REGISTER_PROP( PROPERTY_ID_QUERYTIMEOUT, m_nQueryTimeOut );
+ REGISTER_PROP( PROPERTY_ID_FETCHSIZE, m_nFetchSize );
+ REGISTER_PROP( PROPERTY_ID_RESULTSETTYPE, m_nResultSetType );
+ REGISTER_PROP( PROPERTY_ID_FETCHDIRECTION, m_nFetchDirection );
+ REGISTER_PROP( PROPERTY_ID_ESCAPEPROCESSING, m_bEscapeProcessing );
+ REGISTER_PROP( PROPERTY_ID_RESULTSETCONCURRENCY, m_nResultSetConcurrency );
}
// -----------------------------------------------------------------------------
-OStatement_Base::~OStatement_Base()
+OCommonStatement::~OCommonStatement()
{
}
//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
+void OCommonStatement::disposeResultSet()
{
// free the cursor if alive
Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
@@ -85,7 +114,7 @@ void OStatement_Base::disposeResultSet()
m_xResultSet = Reference< XResultSet>();
}
//------------------------------------------------------------------------------
-void OStatement_BASE2::disposing()
+void OCommonStatement::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
@@ -96,55 +125,50 @@ void OStatement_BASE2::disposing()
m_pConnection = NULL;
dispose_ChildImpl();
- OStatement_Base::disposing();
-}
-//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::release() throw()
-{
- relase_ChildImpl();
+ OCommonStatement_IBase::disposing();
}
//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- Any aRet = OStatement_BASE::queryInterface(rType);
+ Any aRet = OCommonStatement_IBase::queryInterface(rType);
if(!aRet.hasValue())
- aRet = OPropertySetHelper::queryInterface(rType);
+ aRet = ::comphelper::OPropertyContainer::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
+Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
{
::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
::getCppuType( (const Reference< XFastPropertySet > *)0 ),
::getCppuType( (const Reference< XPropertySet > *)0 ));
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+ return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBase::getTypes());
}
// -------------------------------------------------------------------------
-//void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
+//void SAL_CALL OCommonStatement::cancel( ) throw(RuntimeException)
//{
//::osl::MutexGuard aGuard( m_aMutex );
-//checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+//checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
//// cancel the current sql statement
//}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
{
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
}
dispose();
}
// -------------------------------------------------------------------------
-void OStatement_Base::reset() throw (SQLException)
+void OCommonStatement::reset() throw (SQLException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
clearWarnings ();
@@ -153,10 +177,10 @@ void OStatement_Base::reset() throw (SQLException)
clearMyResultSet();
}
-void OStatement_Base::clearMyResultSet () throw (SQLException)
+void OCommonStatement::clearMyResultSet () throw (SQLException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
try
{
@@ -170,48 +194,105 @@ void OStatement_Base::clearMyResultSet () throw (SQLException)
}
EBookQuery *
-OStatement_Base::createTrue()
+OCommonStatement::createTrue()
{ // Not the world's most efficient unconditional true but ...
return e_book_query_from_string("(exists \"full_name\")");
}
EBookQuery *
-OStatement_Base::createTest( const ::rtl::OUString &aColumnName,
+OCommonStatement::createTest( const ::rtl::OUString &aColumnName,
EBookQueryTest eTest,
- const ::rtl::OUString &aMatch,
- bool bGeneric )
+ const ::rtl::OUString &aMatch )
{
- rtl::OString sMatch = rtl::OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 );
- rtl::OString sColumnName = rtl::OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 );
- if ( bGeneric && (aColumnName.equalsAscii("0") ||
- aColumnName.equalsAscii("1")))
- {
- if( aMatch.equals( aColumnName ) )
- return createTrue();
- else
- return NULL;
- }
+ ::rtl::OString sMatch = rtl::OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 );
+ ::rtl::OString sColumnName = rtl::OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 );
return e_book_query_field_test( e_contact_field_id( sColumnName ),
eTest, sMatch );
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+
+::rtl::OUString OCommonStatement::impl_getColumnRefColumnName_throw( const OSQLParseNode& _rColumnRef )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ ENSURE_OR_THROW( SQL_ISRULE( &_rColumnRef, column_ref ), "internal error: only column_refs supported as LHS" );
+
+ ::rtl::OUString sColumnName;
+ switch ( _rColumnRef.count() )
+ {
+ case 3: // SQL_TOKEN_NAME '.' column_val
+ {
+ const OSQLParseNode* pPunct = _rColumnRef.getChild( 1 );
+ const OSQLParseNode* pColVal = _rColumnRef.getChild( 2 );
+ if ( SQL_ISPUNCTUATION( pPunct, "." )
+ && ( pColVal->count() == 1 )
+ )
+ {
+ sColumnName = pColVal->getChild( 0 )->getTokenValue();
+ }
+ }
+ break;
+
+ case 1: // column
+ {
+ sColumnName = _rColumnRef.getChild( 0 )->getTokenValue();
+ }
+ break;
+ }
+
+ if ( !sColumnName.getLength() )
+ m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
+
+ return sColumnName;
+}
+
+// -------------------------------------------------------------------------
+void OCommonStatement::orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort )
+{
+ ENSURE_OR_THROW( _pOrderByClause, "NULL node" );
+ ENSURE_OR_THROW( SQL_ISRULE( _pOrderByClause, opt_order_by_clause ), "wrong node type" );
+
+ _out_rSort.clear();
+
+ const OSQLParseNode* pOrderList = _pOrderByClause->getByRule( OSQLParseNode::ordering_spec_commalist );
+ ENSURE_OR_THROW( pOrderList, "unexpected parse tree structure" );
- executeQuery( sql );
- return m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT;
+ for ( sal_uInt32 i=0; i<pOrderList->count(); ++i )
+ {
+ const OSQLParseNode* pOrderBy = pOrderList->getChild(i);
+ if ( !pOrderBy || !SQL_ISRULE( pOrderBy, ordering_spec ) )
+ continue;
+ const OSQLParseNode* pColumnRef = pOrderBy->count() == 2 ? pOrderBy->getChild(0) : NULL;
+ const OSQLParseNode* pAscDesc = pOrderBy->count() == 2 ? pOrderBy->getChild(1) : NULL;
+ ENSURE_OR_THROW(
+ ( pColumnRef != NULL )
+ && ( pAscDesc != NULL )
+ && SQL_ISRULE( pAscDesc, opt_asc_desc )
+ && ( pAscDesc->count() < 2 ),
+ "ordering_spec structure error" );
+
+ // column name -> column field
+ if ( !SQL_ISRULE( pColumnRef, column_ref ) )
+ m_pConnection->throwGenericSQLException( STR_SORT_BY_COL_ONLY, *this );
+ const ::rtl::OUString sColumnName( impl_getColumnRefColumnName_throw( *pColumnRef ) );
+ guint nField = evoab::findEvoabField( sColumnName );
+ // ascending/descending?
+ bool bAscending = true;
+ if ( ( pAscDesc->count() == 1 )
+ && SQL_ISTOKEN( pAscDesc->getChild( 0 ), DESC )
+ )
+ bAscending = false;
+
+ _out_rSort.push_back( FieldSort( nField, bAscending ) );
+ }
}
-EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) throw(SQLException, RuntimeException)
+// -------------------------------------------------------------------------
+EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree )
{
EBookQuery *pResult = NULL;
- if (!parseTree)
- return NULL;
+ ENSURE_OR_THROW( parseTree, "invalid parse tree" );
// Nested brackets
if( parseTree->count() == 3 &&
@@ -226,83 +307,87 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr
SQL_ISRULE( parseTree, boolean_term ) ) &&
parseTree->count() == 3 )
{
+ ENSURE_OR_THROW( SQL_ISTOKEN( parseTree->getChild( 1 ), OR )
+ || SQL_ISTOKEN( parseTree->getChild( 1 ), AND ),
+ "unexpected search_condition structure" );
+
EBookQuery *pArgs[2];
pArgs[0] = whereAnalysis( parseTree->getChild( 0 ) );
pArgs[1] = whereAnalysis( parseTree->getChild( 2 ) );
if( SQL_ISTOKEN( parseTree->getChild( 1 ), OR ) )
- pResult = e_book_query_or( 2, pArgs, TRUE );
- else if( SQL_ISTOKEN( parseTree->getChild( 1 ), AND ) )
- pResult = e_book_query_and( 2, pArgs, TRUE );
+ pResult = e_book_query_or( 2, pArgs, TRUE );
else
- {
- OSL_ASSERT("analyseSQL: Error in Parse Tree");
- e_book_query_unref( pArgs[ 0 ] );
- e_book_query_unref( pArgs[ 1 ] );
- return NULL;
- }
+ pResult = e_book_query_and( 2, pArgs, TRUE );
}
// SQL =, !=
else if( SQL_ISRULE( parseTree, comparison_predicate ) )
{
OSQLParseNode *pPrec = parseTree->getChild( 1 );
- if( parseTree->count() != 3 )
+ ENSURE_OR_THROW( parseTree->count() == 3, "unexpected comparison_predicate structure" );
+
+ OSQLParseNode* pLHS = parseTree->getChild( 0 );
+ OSQLParseNode* pRHS = parseTree->getChild( 2 );
+
+ if ( ( !( SQL_ISRULE( pLHS, column_ref ) ) // on the LHS, we accept a column or a constant int value
+ && ( pLHS->getNodeType() != SQL_NODE_INTNUM )
+ )
+ || ( ( pRHS->getNodeType() != SQL_NODE_STRING ) // on the RHS, certain literals are acceptable
+ && ( pRHS->getNodeType() != SQL_NODE_INTNUM )
+ && ( pRHS->getNodeType() != SQL_NODE_APPROXNUM )
+ && !( SQL_ISTOKEN( pRHS, TRUE ) )
+ && !( SQL_ISTOKEN( pRHS, FALSE ) )
+ )
+ || ( ( pLHS->getNodeType() == SQL_NODE_INTNUM ) // an int on LHS requires an int on RHS
+ && ( pRHS->getNodeType() != SQL_NODE_INTNUM )
+ )
+ )
{
- OSL_ASSERT("analyseSQL: Error in Parse Tree");
- return NULL;
+ m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
- if( !( SQL_ISRULE( parseTree->getChild( 0 ), column_ref) ||
- parseTree->getChild( 2 )->getNodeType() == SQL_NODE_STRING ||
- parseTree->getChild( 2 )->getNodeType() == SQL_NODE_INTNUM ||
- parseTree->getChild( 2 )->getNodeType() == SQL_NODE_APPROXNUM ||
- SQL_ISTOKEN( parseTree->getChild( 2 ), TRUE ) ||
- SQL_ISTOKEN( parseTree->getChild( 2 ), FALSE ) ||
- SQL_ISRULE( parseTree->getChild( 2 ), parameter ) ||
- // odbc date
- (SQL_ISRULE( parseTree->getChild( 2 ), set_fct_spec ) &&
- SQL_ISPUNCTUATION( parseTree->getChild( 2 )->getChild( 0 ), "{" ) ) ) )
- m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
-
- if (pPrec->getNodeType() != SQL_NODE_EQUAL && pPrec->getNodeType() != SQL_NODE_NOTEQUAL)
- m_pConnection->throwGenericSQLException(STR_OPERATOR_TOO_COMPLEX,*this);
-
- rtl::OUString aMatchString;
- rtl::OUString aColumnName;
- if( SQL_ISRULE( parseTree->getChild( 0 ), column_ref ) )
+ if ( ( pPrec->getNodeType() != SQL_NODE_EQUAL )
+ && ( pPrec->getNodeType() != SQL_NODE_NOTEQUAL )
+ )
{
- aColumnName = parseTree->getChild( 0 )->getChild( 0 )->getTokenValue();
-
- if( parseTree->getChild( 2 )->isToken() )
- aMatchString = parseTree->getChild( 2 )->getTokenValue();
- else
- aMatchString = parseTree->getChild( 2 )->getChild( 0 )->getTokenValue();
+ m_pConnection->throwGenericSQLException( STR_OPERATOR_TOO_COMPLEX, *this );
}
- else
+
+ // recognize the special "0 = 1" condition
+ if ( ( pLHS->getNodeType() == SQL_NODE_INTNUM )
+ && ( pRHS->getNodeType() == SQL_NODE_INTNUM )
+ && ( pPrec->getNodeType() == SQL_NODE_EQUAL )
+ )
{
- aColumnName = parseTree->getChild( 0 )->getTokenValue();
- aMatchString = parseTree->getChild( 2 )->getTokenValue();
+ const sal_Int32 nLHS = pLHS->getTokenValue().toInt64();
+ const sal_Int32 nRHS = pRHS->getTokenValue().toInt64();
+ return ( nLHS == nRHS ) ? createTrue() : NULL;
}
- pResult = createTest( aColumnName, E_BOOK_QUERY_IS, aMatchString, true );
+ ::rtl::OUString aColumnName( impl_getColumnRefColumnName_throw( *pLHS ) );
+
+ ::rtl::OUString aMatchString;
+ if ( pRHS->isToken() )
+ aMatchString = pRHS->getTokenValue();
+ else
+ aMatchString = pRHS->getChild( 0 )->getTokenValue();
+
+ pResult = createTest( aColumnName, E_BOOK_QUERY_IS, aMatchString );
- if (pResult && pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
+ if ( pResult && ( pPrec->getNodeType() == SQL_NODE_NOTEQUAL ) )
pResult = e_book_query_not( pResult, TRUE );
}
// SQL like
else if( SQL_ISRULE( parseTree, like_predicate ) )
{
- if( parseTree->count() < 4 )
- {
- OSL_ASSERT( "analyseSQL: Error in parsing LIKE predicate" );
- return NULL;
- }
+ ENSURE_OR_THROW( parseTree->count() >= 4, "unexpected like_predicate structure" );
if( ! SQL_ISRULE( parseTree->getChild( 0 ), column_ref) )
m_pConnection->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
- OSQLParseNode *pColumn = parseTree->getChild( 0 ); // Match Item
+ ::rtl::OUString aColumnName( impl_getColumnRefColumnName_throw( *parseTree->getChild( 0 ) ) );
+
OSQLParseNode *pAtom = parseTree->getChild( parseTree->count() - 2 ); // Match String
bool bNotLike = parseTree->count() == 5;
@@ -318,62 +403,54 @@ EBookQuery *OStatement_Base::whereAnalysis( const OSQLParseNode* parseTree ) thr
const sal_Unicode WILDCARD = '%';
- rtl::OUString aColumnName;
rtl::OUString aMatchString;
+ aMatchString = pAtom->getTokenValue();
- if( SQL_ISRULE( pColumn, column_ref ))
+ // Determine where '%' character is...
+ if( aMatchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
{
- aColumnName = parseTree->getChild(0)->getChild(0)->getTokenValue();
- aMatchString = pAtom->getTokenValue();
-
- // Determine where '%' character is...
- if( aMatchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
- {
- // String containing only a '%' and nothing else matches everything
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS,
- rtl::OUString::createFromAscii( "" ) );
- }
- else if( aMatchString.indexOf( WILDCARD ) == -1 )
- { // Simple string , eg. "to match" "contains in evo"
- EVO_TRACE_STRING( "Plain contains '%s'", aMatchString );
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString );
- if( pResult && bNotLike )
- pResult = e_book_query_not( pResult, TRUE );
- }
- else if( bNotLike )
- {
- // We currently can't handle a 'NOT LIKE' when there are '%'
- m_pConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
- }
- else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) )
- { // One occurance of '%' matches...
- if ( aMatchString.indexOf ( WILDCARD ) == 0 )
- pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) );
- else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 )
- pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) );
- else
- m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this);
-
- if( pResult && bNotLike )
- pResult = e_book_query_not( pResult, TRUE );
- }
- else if( aMatchString.getLength() >= 3 &&
- aMatchString.indexOf ( WILDCARD ) == 0 &&
- aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) {
- // one '%' at the start and another at the end
- pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) );
- }
+ // String containing only a '%' and nothing else matches everything
+ pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS,
+ rtl::OUString::createFromAscii( "" ) );
+ }
+ else if( aMatchString.indexOf( WILDCARD ) == -1 )
+ { // Simple string , eg. "to match" "contains in evo"
+ EVO_TRACE_STRING( "Plain contains '%s'", aMatchString );
+ pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString );
+ if( pResult && bNotLike )
+ pResult = e_book_query_not( pResult, TRUE );
+ }
+ else if( bNotLike )
+ {
+ // We currently can't handle a 'NOT LIKE' when there are '%'
+ m_pConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
+ }
+ else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) )
+ { // One occurance of '%' matches...
+ if ( aMatchString.indexOf ( WILDCARD ) == 0 )
+ pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) );
+ else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 )
+ pResult = createTest( aColumnName, E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) );
else
- m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this);
+ m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD,*this);
+
+ if( pResult && bNotLike )
+ pResult = e_book_query_not( pResult, TRUE );
+ }
+ else if( aMatchString.getLength() >= 3 &&
+ aMatchString.indexOf ( WILDCARD ) == 0 &&
+ aMatchString.indexOf ( WILDCARD, 1) == aMatchString.getLength() - 1 ) {
+ // one '%' at the start and another at the end
+ pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) );
}
else
- OSL_ASSERT( "Serious internal error" );
+ m_pConnection->throwGenericSQLException(STR_QUERY_LIKE_WILDCARD_MANY,*this);
}
return pResult;
}
-rtl::OUString OStatement_Base::getTableName()
+rtl::OUString OCommonStatement::getTableName()
{
::rtl::OUString aTableName;
@@ -386,7 +463,7 @@ rtl::OUString OStatement_Base::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 ) )
{
@@ -395,238 +472,210 @@ rtl::OUString OStatement_Base::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_ASSERT( "odd table layout" );
+ OSL_ENSURE( false, "odd table layout" );
}
else
- OSL_ASSERT( "unusual table layout" );
+ OSL_ENSURE( false, "unusual table layout" );
}
return aTableName;
}
-EBookQuery *OStatement_Base::parseSql( const rtl::OUString& sql,
- rtl::OString &rTable,
- bool &bIsWithoutWhere )
- throw ( SQLException, RuntimeException )
+void OCommonStatement::parseSql( const rtl::OUString& sql, QueryData& _out_rQueryData )
{
- ::rtl::OUString aErr;
+ EVO_TRACE_STRING( "parsing %s", sql );
+ _out_rQueryData.eFilterType = eFilterOther;
+
+ ::rtl::OUString aErr;
m_pParseTree = m_aParser.parseTree( aErr, sql );
m_aSQLIterator.setParseTree( m_pParseTree );
m_aSQLIterator.traverseAll();
- const OSQLTables aTables = m_aSQLIterator.getTables();
- rTable = rtl::OUStringToOString( getTableName(), RTL_TEXTENCODING_UTF8 );
- m_pConnection->setCurrentTableName(getTableName());
- const OSQLParseNode* pParseTree = m_aSQLIterator.getWhereTree();
- if ( pParseTree && SQL_ISRULE( pParseTree, where_clause ) )
- return whereAnalysis( pParseTree->getChild( 1 ) );
- else
+ _out_rQueryData.sTable = getTableName();
+
+ // to be sorted?
+ const OSQLParseNode* pOrderByClause = m_aSQLIterator.getOrderTree();
+ if ( pOrderByClause )
{
- bIsWithoutWhere = true;
- return createTrue();
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OUString sTreeDebug;
+ pOrderByClause->showParseTree( sTreeDebug );
+ EVO_TRACE_STRING( "found order-by tree:\n%s", sTreeDebug );
+ #endif
+ orderByAnalysis( pOrderByClause, _out_rQueryData.aSortOrder );
}
-}
-
-// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- EVO_TRACE_STRING( "NConnection::executeQuery(%s)\n", sql );
-
- OEvoabResultSet* pResult = createResultSet();
- Reference< XResultSet > xRS = pResult;
-
-#ifdef DEBUG
- g_message( "Parse SQL '%s'\n",
- (const sal_Char *)OUStringToOString( sql, RTL_TEXTENCODING_UTF8 ) );
-#endif
-
- rtl::OString aTable;
- bool bIsWithoutWhere = false;
- EBookQuery *pQuery = parseSql( sql, aTable, bIsWithoutWhere );
-
-#ifdef DEBUG
- char *pSexpr = pQuery ? e_book_query_to_string( pQuery ) : g_strdup( "<map failed>" );
- g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
- g_free( pSexpr );
-#endif
- ::vos::ORef<connectivity::OSQLColumns> xColumns;
- if (pQuery)
+ const OSQLParseNode* pWhereClause = m_aSQLIterator.getWhereTree();
+ if ( pWhereClause && SQL_ISRULE( pWhereClause, where_clause ) )
{
- pResult->construct( pQuery, aTable, bIsWithoutWhere );
- e_book_query_unref( pQuery );
- xColumns = m_aSQLIterator.getSelectColumns();
- if (!xColumns.isValid())
- m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
-
- OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) pResult->getMetaData().get();
- pMeta->setEvoabFields(xColumns);
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OUString sTreeDebug;
+ pWhereClause->showParseTree( sTreeDebug );
+ EVO_TRACE_STRING( "found where tree:\n%s", sTreeDebug );
+ #endif
+ EBookQuery* pQuery = whereAnalysis( pWhereClause->getChild( 1 ) );
+ if ( !pQuery )
+ {
+ _out_rQueryData.eFilterType = eFilterAlwaysFalse;
+ pQuery = createTrue();
+ }
+ _out_rQueryData.setQuery( pQuery );
+ }
+ else
+ {
+ _out_rQueryData.eFilterType = eFilterNone;
+ _out_rQueryData.setQuery( createTrue() );
}
- m_xResultSet = xRS;
-
- return xRS;
-}
-// -------------------------------------------------------------------------
-OEvoabResultSet* OStatement_Base::createResultSet()
-{
- return new OEvoabResultSet(this,m_pConnection,m_aSQLIterator);
}
// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
+Reference< XConnection > SAL_CALL OStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
// just return our connection here
- return (Reference< XConnection >)m_pConnection;
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
- if(!aRet.hasValue())
- aRet = OStatement_Base::queryInterface(rType);
- return aRet;
-}
-// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- // the return values gives information about how many rows are affected by executing the sql statement
- return 0;
+ return impl_getConnection();
}
// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
+Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
return makeAny(SQLWarning());
}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
}
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
{
- // this properties are define by the service statement
- // they must in alphabetic order
- Sequence< Property > aProps(10);
- Property* pProperties = aProps.getArray();
- sal_Int32 nPos = 0;
- DECL_PROP0(CURSORNAME, ::rtl::OUString);
- DECL_BOOL_PROP0(ESCAPEPROCESSING);
- DECL_PROP0(FETCHDIRECTION,sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE,sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT,sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
- DECL_PROP0(RESULTSETTYPE,sal_Int32);
- DECL_BOOL_PROP0(USEBOOKMARKS);
-
- return new ::cppu::OPropertyArrayHelper(aProps);
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
}
-
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+ return *const_cast< OCommonStatement* >( this )->getArrayHelper();
}
-// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
- Any & /*rConvertedValue*/,
- Any & /*rOldValue*/,
- sal_Int32 /*nHandle*/,
- const Any& /*rValue*/ )
- throw (::com::sun::star::lang::IllegalArgumentException)
+
+// -----------------------------------------------------------------------------
+void SAL_CALL OCommonStatement::acquire() throw()
{
- sal_Bool bModified = sal_False;
- // here we have to try to convert
- return bModified;
+ OCommonStatement_IBase::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OCommonStatement::release() throw()
+{
+ relase_ChildImpl();
}
+
// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
+QueryData OCommonStatement::impl_getEBookQuery_throw( const ::rtl::OUString& _rSql )
{
- // set the value to what ever is nescessary
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
+ QueryData aData;
+ parseSql( _rSql, aData );
+
+#ifdef DEBUG
+ char *pSexpr = aData.getQuery() ? e_book_query_to_string( aData.getQuery() ) : g_strdup( "<map failed>" );
+ g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
+ g_free( pSexpr );
+#endif
+
+ if ( !aData.getQuery() )
+ m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
+
+ // a postcondition of this method is that we properly determined the SELECT columns
+ aData.xSelectColumns = m_aSQLIterator.getSelectColumns();
+ if ( !aData.xSelectColumns.isValid() )
+ m_pConnection->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
+
+ return aData;
}
+
// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
+Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryData& _rQueryData )
{
- switch(nHandle)
- {
- case PROPERTY_ID_QUERYTIMEOUT:
- case PROPERTY_ID_MAXFIELDSIZE:
- case PROPERTY_ID_MAXROWS:
- case PROPERTY_ID_CURSORNAME:
- case PROPERTY_ID_RESULTSETCONCURRENCY:
- case PROPERTY_ID_RESULTSETTYPE:
- case PROPERTY_ID_FETCHDIRECTION:
- case PROPERTY_ID_FETCHSIZE:
- case PROPERTY_ID_ESCAPEPROCESSING:
- case PROPERTY_ID_USEBOOKMARKS:
- default:
- ;
- }
+ // create result set
+ OEvoabResultSet* pResult = new OEvoabResultSet( this, m_pConnection );
+ Reference< XResultSet > xRS = pResult;
+ pResult->construct( _rQueryData );
+
+ // done
+ m_xResultSet = xRS;
+ return xRS;
}
+
// -------------------------------------------------------------------------
-IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
+Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const ::rtl::OUString& _rSql )
{
- OStatement_BASE::acquire();
+ EVO_TRACE_STRING( "OCommonStatement::impl_executeQuery_throw(%s)\n", _rSql );
+
+#ifdef DEBUG
+ g_message( "Parse SQL '%s'\n",
+ (const sal_Char *)OUStringToOString( _rSql, RTL_TEXTENCODING_UTF8 ) );
+#endif
+
+ return impl_executeQuery_throw( impl_getEBookQuery_throw( _rSql ) );
}
+
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::release() throw()
+Reference< XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
{
- OStatement_BASE::release();
+ return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
}
+
+// =============================================================================
+// = OStatement
+// =============================================================================
+// -----------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO( OStatement, "com.sun.star.comp.sdbcx.evoab.OStatement", "com.sun.star.sdbc.Statement" );
+
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( OStatement, OCommonStatement, OStatement_IBase )
+
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::acquire() throw()
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( OStatement, OCommonStatement, OStatement_IBase )
+
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OStatement::execute( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException)
{
- OStatement_BASE2::acquire();
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
+
+ Reference< XResultSet > xRS = impl_executeQuery_throw( _sql );
+ return xRS.is();
}
-// -----------------------------------------------------------------------------
-void SAL_CALL OStatement::release() throw()
+
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL OStatement::executeQuery( const ::rtl::OUString& _sql ) throw(SQLException, RuntimeException)
{
- OStatement_BASE2::release();
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
+
+ return impl_executeQuery_throw( _sql );
}
+
// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+sal_Int32 SAL_CALL OStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
{
- return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
+ return 0;
}
-// -----------------------------------------------------------------------------
+} } // namespace ::connectivity::evoab
diff --git a/connectivity/source/drivers/evoab2/NStatement.hxx b/connectivity/source/drivers/evoab2/NStatement.hxx
index cfab28883bad..ef3b2af4dbcf 100644
--- a/connectivity/source/drivers/evoab2/NStatement.hxx
+++ b/connectivity/source/drivers/evoab2/NStatement.hxx
@@ -37,52 +37,149 @@
#include <com/sun/star/sdbc/XCloseable.hpp>
#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <comphelper/proparrhlp.hxx>
-#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase2.hxx>
#include <comphelper/uno3.hxx>
#include "connectivity/CommonTools.hxx"
-#ifndef INCLUDED_LIST
-#include <list>
-#define INCLUDED_LIST
-#endif
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/broadcasthelper.hxx>
#include "connectivity/sqliterator.hxx"
-#ifndef _CONNECTIVITY_PARSE_SQLPARSE_HXX_
#include "connectivity/sqlparse.hxx"
-#endif
#include <connectivity/FValue.hxx>
#include "OSubComponent.hxx"
#include <com/sun/star/util/XCancellable.hpp>
#include <cppuhelper/compbase5.hxx>
+#include <comphelper/propertycontainer.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+
#include "EApi.h"
+
+#include <list>
+
namespace connectivity
{
namespace evoab
{
class OEvoabResultSet;
class OEvoabConnection;
- typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement,
- ::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable> OStatement_BASE;
+ typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::sdbc::XWarningsSupplier
+ , ::com::sun::star::sdbc::XCloseable
+ > OCommonStatement_IBase;
+
+ struct FieldSort
+ {
+ sal_Int32 nField;
+ bool bAscending;
+
+ FieldSort() : nField(0), bAscending( true ) { }
+ FieldSort( const sal_Int32 _nField, const bool _bAscending ) : nField( _nField ), bAscending( _bAscending ) { }
+ };
+ typedef ::std::vector< FieldSort > SortDescriptor;
+
+ enum QueryFilterType
+ {
+ eFilterAlwaysFalse,
+ eFilterNone,
+ eFilterOther
+ };
+
+ struct QueryData
+ {
+ private:
+ EBookQuery* pQuery;
+
+ public:
+ ::rtl::OUString sTable;
+ QueryFilterType eFilterType;
+ ::vos::ORef< ::connectivity::OSQLColumns > xSelectColumns;
+ SortDescriptor aSortOrder;
+
+ QueryData()
+ :pQuery( NULL )
+ ,sTable()
+ ,eFilterType( eFilterOther )
+ ,xSelectColumns()
+ ,aSortOrder()
+ {
+ }
+
+ QueryData( const QueryData& _rhs )
+ :pQuery( NULL )
+ ,sTable()
+ ,eFilterType( eFilterType )
+ ,xSelectColumns()
+ ,aSortOrder()
+ {
+ *this = _rhs;
+ }
+
+ QueryData& operator=( const QueryData& _rhs )
+ {
+ if ( this == &_rhs )
+ return *this;
+
+ setQuery( _rhs.pQuery );
+ sTable = _rhs.sTable;
+ eFilterType = _rhs.eFilterType;
+ xSelectColumns = _rhs.xSelectColumns;
+ aSortOrder = _rhs.aSortOrder;
+
+ return *this;
+ }
+
+ ~QueryData()
+ {
+ setQuery( NULL );
+ }
+
+ EBookQuery* getQuery() const { return pQuery; }
+
+ void setQuery( EBookQuery* _pQuery )
+ {
+ if ( pQuery )
+ e_book_query_unref( pQuery );
+ pQuery = _pQuery;
+ if ( pQuery )
+ e_book_query_ref( pQuery );
+ }
+ };
//**************************************************************
- //************ Class: OStatement_Base
+ //************ Class: OCommonStatement
// is a base class for the normal statement and for the prepared statement
//**************************************************************
- class OStatement_Base : public comphelper::OBaseMutex,
- public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
+ class OCommonStatement;
+ typedef OSubComponent< OCommonStatement, OCommonStatement_IBase > OStatement_CBase;
+ class OCommonStatement :public comphelper::OBaseMutex
+ ,public OCommonStatement_IBase
+ ,public ::comphelper::OPropertyContainer
+ ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
+ ,public OStatement_CBase
{
- protected:
+ friend class OSubComponent< OCommonStatement, OCommonStatement_IBase >;
+
+ private:
::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
OEvoabResultSet *m_pResultSet;
OEvoabConnection *m_pConnection;
connectivity::OSQLParser m_aParser;
connectivity::OSQLParseTreeIterator m_aSQLIterator;
connectivity::OSQLParseNode *m_pParseTree;
+
+ // <properties>
+ ::rtl::OUString m_aCursorName;
+ sal_Int32 m_nMaxFieldSize;
+ sal_Int32 m_nMaxRows;
+ sal_Int32 m_nQueryTimeOut;
+ sal_Int32 m_nFetchSize;
+ sal_Int32 m_nResultSetType;
+ sal_Int32 m_nFetchDirection;
+ sal_Int32 m_nResultSetConcurrency;
+ sal_Bool m_bEscapeProcessing;
+ // </properties>
+
+ ::cppu::OBroadcastHelper& rBHelper;
+
protected:
void disposeResultSet();
@@ -91,48 +188,33 @@ namespace connectivity
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- virtual sal_Bool SAL_CALL convertFastPropertyValue(
- ::com::sun::star::uno::Any & rConvertedValue,
- ::com::sun::star::uno::Any & rOldValue,
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue )
- throw (::com::sun::star::lang::IllegalArgumentException);
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
- virtual ~OStatement_Base();
- protected:
- /* Driver Internal Methods */
- OEvoabResultSet *createResultSet();
+ virtual ~OCommonStatement();
+ protected:
void reset () throw( ::com::sun::star::sdbc::SQLException);
void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
- EBookQuery *parseSql( const ::rtl::OUString& sql, ::rtl::OString &rTable, bool &bIsWithoutWhere )
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- EBookQuery *whereAnalysis( const OSQLParseNode* parseTree )
- throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ void parseSql( const ::rtl::OUString& sql, QueryData& _out_rQueryData );
+ EBookQuery *whereAnalysis( const OSQLParseNode* parseTree );
+ void orderByAnalysis( const OSQLParseNode* _pOrderByClause, SortDescriptor& _out_rSort );
rtl::OUString getTableName();
EBookQuery *createTrue();
EBookQuery *createTest( const ::rtl::OUString &aColumnName,
EBookQueryTest eTest,
- const ::rtl::OUString &aMatch,
- bool bGeneric = false );
+ const ::rtl::OUString &aMatch );
public:
// other methods
OEvoabConnection* getOwnConnection() const { return m_pConnection;}
- ::cppu::OBroadcastHelper& rBHelper;
- OStatement_Base(OEvoabConnection* _pConnection );
- using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+ using OCommonStatement_IBase::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+
+ protected:
+ OCommonStatement( OEvoabConnection* _pConnection );
// OComponentHelper
- virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
+ virtual void SAL_CALL disposing(void);
// XInterface
virtual void SAL_CALL release() throw();
virtual void SAL_CALL acquire() throw();
@@ -143,46 +225,66 @@ namespace connectivity
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // XStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+
// XWarningsSupplier
virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
// XCloseable
virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- };
+ protected:
+ /** will return the EBookQuery representing the stamement's WHERE condition, or throw
- class OStatement_BASE2 : public OStatement_Base,
- public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
+ Also, all statement dependent members (such as the parser/iterator) will be inited afterwards.
+ */
+ QueryData
+ impl_getEBookQuery_throw( const ::rtl::OUString& _rSql );
- {
- friend class OSubComponent<OStatement_BASE2, OStatement_BASE>;
- public:
- OStatement_BASE2(OEvoabConnection* _pConnection ) : OStatement_Base(_pConnection ),
- ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ impl_executeQuery_throw( const ::rtl::OUString& _rSql );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ impl_executeQuery_throw( const QueryData& _rData );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ impl_getConnection() { return ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >( (::com::sun::star::sdbc::XConnection*)m_pConnection ); }
+
+ ::rtl::OUString
+ impl_getColumnRefColumnName_throw( const ::connectivity::OSQLParseNode& _rColumnRef );
};
- class OStatement : public OStatement_BASE2,
- public ::com::sun::star::lang::XServiceInfo
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::sdbc::XStatement
+ > OStatement_IBase;
+ class OStatement :public OCommonStatement
+ ,public OStatement_IBase
{
protected:
virtual ~OStatement(){}
+
public:
- // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OStatement( OEvoabConnection* _pConnection) : OStatement_BASE2( _pConnection){}
- DECLARE_SERVICE_INFO();
+ OStatement( OEvoabConnection* _pConnection)
+ :OCommonStatement( _pConnection)
+ {
+ }
+ // XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire() throw();
virtual void SAL_CALL release() throw();
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+
+ // XStatement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
};
}
}
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/evoab2/evoab2.xcu b/connectivity/source/drivers/evoab2/evoab2.xcu
new file mode 100755
index 000000000000..ddfc3b070e81
--- /dev/null
+++ b/connectivity/source/drivers/evoab2/evoab2.xcu
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:evolution:local" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution Local</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:ldap" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Evolution LDAP</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:evolution:groupwise" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.evoab.OEvoabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Groupwise</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/evoab2/makefile.mk b/connectivity/source/drivers/evoab2/makefile.mk
index 3e59c8ecb442..e9bb9fdc4d70 100644
--- a/connectivity/source/drivers/evoab2/makefile.mk
+++ b/connectivity/source/drivers/evoab2/makefile.mk
@@ -6,10 +6,6 @@
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.8 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
@@ -42,18 +38,18 @@ dummy:
.ELSE
# --- Settings ----------------------------------
-.IF "$(DBGUTIL_OJ)"!=""
-ENVCFLAGS+=/FR$(SLO)$/
-.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
+PKGCONFIG_MODULES=gtk+-2.0
+.INCLUDE : pkg_config.mk
+
CFLAGS+=$(GOBJECT_CFLAGS)
# --- Files -------------------------------------
-EXCEPTIONSFILES=\
+SLOFILES=\
$(SLO)$/NDriver.obj \
$(SLO)$/NTable.obj \
$(SLO)$/NColumns.obj \
@@ -66,13 +62,9 @@ EXCEPTIONSFILES=\
$(SLO)$/NServices.obj \
$(SLO)$/NResultSet.obj \
$(SLO)$/NResultSetMetaData.obj \
- $(SLO)$/EApi.obj
-
-SLOFILES=\
- $(EXCEPTIONSFILES) \
+ $(SLO)$/EApi.obj \
$(SLO)$/NDebug.obj
-
SHL1VERSIONMAP=$(TARGET).map
@@ -100,6 +92,15 @@ SHL1STDLIBS+= ifile.lib
.ENDIF
SHL1STDLIBS+=$(GOBJECT_LIBS)
+
+SHL1STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//)
+# hack for faked SO environment
+.IF "$(PKGCONFIG_ROOT)"!=""
+SHL1SONAME+=-z nodefs
+SHL1NOCHECK=TRUE
+.ENDIF # "$(PKGCONFIG_ROOT)"!=""
+
+
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
@@ -110,4 +111,4 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
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 ca86fb2a3d73..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() )
@@ -1303,8 +1303,9 @@ void OResultSet::sortRows()
OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
{
- case DataType::CHAR:
+ case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
eKeyType[i] = SQL_ORDERBYKEY_STRING;
break;
@@ -1471,6 +1472,7 @@ BOOL OResultSet::OpenImpl()
if(IsSorted())
{
aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end());
+ m_aOrderbyColumnNumber.clear();
aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end());
bWasSorted = TRUE;
}
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 2692f02d7614..07cdf95d7b44 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -639,7 +639,7 @@ void OStatement_Base::GetAssignValues()
aColumnNameList.push_back(pCol->getTokenValue());
}
}
- if(!aColumnNameList.size())
+ if ( aColumnNameList.empty() )
throwFunctionSequenceException(*this);
// Werte ...
@@ -652,10 +652,10 @@ void OStatement_Base::GetAssignValues()
if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES))
throwFunctionSequenceException(*this);
- OSL_ENSURE(pValuesOrQuerySpec->count() == 2,"OResultSet: pValuesOrQuerySpec->count() != 2");
+ OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4");
// Liste von Werten
- OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(1);
+ OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2);
OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!");
OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0");
@@ -665,40 +665,22 @@ void OStatement_Base::GetAssignValues()
for (sal_uInt32 i = 0; i < pInsertAtomCommalist->count(); i++)
{
pRow_Value_Const = pInsertAtomCommalist->getChild(i); // row_value_constructor
- if(pRow_Value_Const->count() == 3) // '(' row_value_const_list ')'
+ OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!");
+ if(SQL_ISRULE(pRow_Value_Const,parameter))
{
- pRow_Value_Const = pRow_Value_Const->getChild(1); // row_value_const_list
- OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!");
- if(SQL_ISRULE(pRow_Value_Const,parameter))
- {
- if(pRow_Value_Const->count() == aColumnNameList.size())
- ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife
- else
- {
-// aStatus.Set(SQL_STAT_ERROR,
-// String::CreateFromAscii("S1000"),
-// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_SYNTAX_ERROR))),
-// 0, String() );
- throwFunctionSequenceException(*this);
- }
- }
- else if(pRow_Value_Const->isToken())
- ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i));
- else
- {
- if(pRow_Value_Const->count() == aColumnNameList.size())
- {
- for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j)
- ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
- }
- else
- throwFunctionSequenceException(*this);
- }
+ ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife
}
+ else if(pRow_Value_Const->isToken())
+ ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i));
else
{
- // aStatus.SetStatementTooComplex();
- throwFunctionSequenceException(*this);
+ if(pRow_Value_Const->count() == aColumnNameList.size())
+ {
+ for (sal_uInt32 j = 0; j < pRow_Value_Const->count(); ++j)
+ ParseAssignValues(aColumnNameList,pRow_Value_Const->getChild(j),nIndex++);
+ }
+ else
+ throwFunctionSequenceException(*this);
}
}
}
@@ -814,6 +796,7 @@ void OStatement_Base::SetAssignValue(const String& aColumnName,
// Kriterium je nach Typ als String oder double in die Variable packen ...
case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
*(m_aAssignValues->get())[nId] = ORowSetValue(aValue);
// Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde
break;
diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx
index e3eeb52f2d7d..07e620763b79 100644
--- a/connectivity/source/drivers/file/FStringFunctions.cxx
+++ b/connectivity/source/drivers/file/FStringFunctions.cxx
@@ -32,6 +32,7 @@
#include "precompiled_connectivity.hxx"
#include "file/FStringFunctions.hxx"
+#include <rtl/ustrbuf.hxx>
#include <rtl/logfile.hxx>
using namespace connectivity;
@@ -102,7 +103,7 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const
if ( lhs.empty() )
return ORowSetValue();
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
::std::vector<ORowSetValue>::const_reverse_iterator aIter = lhs.rbegin();
::std::vector<ORowSetValue>::const_reverse_iterator aEnd = lhs.rend();
for (; aIter != aEnd; ++aIter)
@@ -110,10 +111,10 @@ ORowSetValue OOp_Concat::operate(const ::std::vector<ORowSetValue>& lhs) const
if ( aIter->isNull() )
return ORowSetValue();
- sRet += *aIter;
+ sRet.append(aIter->operator ::rtl::OUString());
}
- return sRet;
+ return sRet.makeStringAndClear();
}
//------------------------------------------------------------------
ORowSetValue OOp_Locate::operate(const ::std::vector<ORowSetValue>& lhs) const
@@ -183,13 +184,13 @@ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const
return lhs;
const sal_Char c = ' ';
- ::rtl::OUString sRet;
+ ::rtl::OUStringBuffer sRet;
sal_Int32 nCount = lhs;
for (sal_Int32 i=0; i < nCount; ++i)
{
- sRet += ::rtl::OUString(&c,1,RTL_TEXTENCODING_ASCII_US);
+ sRet.appendAscii(&c,1);
}
- return sRet;
+ return sRet.makeStringAndClear();
}
//------------------------------------------------------------------
ORowSetValue OOp_Replace::operate(const ::std::vector<ORowSetValue>& lhs) const
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/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx
index c866db55275e..eceb58e10611 100644
--- a/connectivity/source/drivers/file/fanalyzer.cxx
+++ b/connectivity/source/drivers/file/fanalyzer.cxx
@@ -90,6 +90,9 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
|| SQL_ISRULE(pColumnRef,position_exp)
|| SQL_ISRULE(pColumnRef,fold)
|| SQL_ISRULE(pColumnRef,length_exp)
+ || SQL_ISRULE(pColumnRef,num_value_exp)
+ || SQL_ISRULE(pColumnRef,term)
+ || SQL_ISRULE(pColumnRef,factor)
|| SQL_ISRULE(pColumnRef,set_fct_spec) )
{
::vos::ORef<OPredicateCompiler> pCompiler = new OPredicateCompiler(this);
diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx
index 0bd0d354ba02..4b2865a67aa2 100644
--- a/connectivity/source/drivers/file/fcode.cxx
+++ b/connectivity/source/drivers/file/fcode.cxx
@@ -65,6 +65,7 @@ TYPEINIT1(OStopOperand, OOperandValue);
TYPEINIT1(OOperator, OCode);
TYPEINIT1(OBoolOperator,OOperator);
+TYPEINIT1(OOp_NOT, OBoolOperator);
TYPEINIT1(OOp_AND, OBoolOperator);
TYPEINIT1(OOp_OR, OBoolOperator);
TYPEINIT1(OOp_ISNULL, OBoolOperator);
@@ -242,6 +243,29 @@ void OBoolOperator::Exec(OCodeStack& rCodeStack)
if (IS_TYPE(OOperandResult,pRight))
delete pRight;
}
+//------------------------------------------------------------------
+sal_Bool OOp_NOT::operate(const OOperand* pLeft, const OOperand* ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
+ return !pLeft->isValid();
+}
+//------------------------------------------------------------------
+void OOp_NOT::Exec(OCodeStack& rCodeStack)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
+ OOperand* pOperand = rCodeStack.top();
+ rCodeStack.pop();
+
+ rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
+ if (IS_TYPE(OOperandResult,pOperand))
+ delete pOperand;
+}
+//------------------------------------------------------------------
+sal_uInt16 OOp_NOT::getRequestedOperands() const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOT::getRequestedOperands" );
+ return 1;
+}
//------------------------------------------------------------------
sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const
@@ -331,6 +355,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con
{
case DataType::CHAR:
case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
{
rtl::OUString sLH = aLH, sRH = aRH;
INT32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength
diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx
index de243f83c71c..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;}
@@ -166,7 +166,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
}
else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term)))
&& // AND/OR-Verknuepfung:
- pPredicateNode->count() == 3)
+ pPredicateNode->count() == 3)
{
execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs
execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs
@@ -183,6 +183,11 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode)
DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree");
}
}
+ else if (SQL_ISRULE(pPredicateNode,boolean_factor))
+ {
+ execute(pPredicateNode->getChild(1));
+ m_aCodeList.push_back(new OOp_NOT());
+ }
else if (SQL_ISRULE(pPredicateNode,comparison_predicate))
{
execute_COMPARE(pPredicateNode);
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx
index 5cf56aec9375..abd2d3b51e44 100644
--- a/connectivity/source/drivers/file/quotedstring.cxx
+++ b/connectivity/source/drivers/file/quotedstring.cxx
@@ -113,7 +113,7 @@ namespace connectivity
if ( nStartPos >= nLen )
return;
- sal_Unicode* pData = _rStr.AllocBuffer(nLen - nStartPos);
+ sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 );
const sal_Unicode* pStart = pData;
// Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
for( xub_StrLen i = nStartPos; i < nLen; ++i )
@@ -135,6 +135,7 @@ namespace connectivity
{
// String-Ende
bInString = FALSE;
+ *pData = 0;
}
}
else
@@ -151,6 +152,7 @@ namespace connectivity
// Vorzeitiger Abbruch der Schleife moeglich, denn
// wir haben, was wir wollten.
nStartPos = i+1;
+ *pData = 0;
break;
}
else
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index b91bee0917f6..fa4f281ea794 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -180,13 +180,15 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
{
bNumeric = TRUE;
xub_StrLen nDot = 0;
+ xub_StrLen nDecimalDelCount = 0;
for (xub_StrLen j = 0; j < aField2.Len(); j++)
{
const sal_Unicode c = aField2.GetChar(j);
// nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen?
- if ((!cDecimalDelimiter || c != cDecimalDelimiter) &&
- (!cThousandDelimiter || c != cThousandDelimiter) &&
- !aCharClass.isDigit(aField2,j))
+ if ( ( !cDecimalDelimiter || c != cDecimalDelimiter ) &&
+ ( !cThousandDelimiter || c != cThousandDelimiter ) &&
+ !aCharClass.isDigit(aField2,j) &&
+ ( j != 0 || (c != '+' && c != '-' ) ) )
{
bNumeric = FALSE;
break;
@@ -195,11 +197,13 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
{
nPrecision = 15; // we have an decimal value
nScale = 2;
- nDot++;
- }
+ ++nDecimalDelCount;
+ } // if (cDecimalDelimiter && c == cDecimalDelimiter)
+ if ( c == '.' )
+ ++nDot;
}
- if (nDot > 1) // if there is more than one dot it isn't a number
+ if (nDecimalDelCount > 1 || nDot > 1 ) // if there is more than one dot it isn't a number
bNumeric = FALSE;
if (bNumeric && cThousandDelimiter)
{
@@ -656,7 +660,10 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal
}
return sal_True;
}
-
+void OFlatTable::refreshHeader()
+{
+ m_nRowPos = 0;
+}
// -----------------------------------------------------------------------------
sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos)
{
@@ -688,7 +695,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
m_pFileStream->Seek(m_nFilePos);
if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
{
- m_nMaxRowCount = m_nRowPos;
+ m_nMaxRowCount = m_nRowPos -1;
return sal_False;
} // if ( m_pFileStream->IsEof() || !readLine(nCurPos) /*|| !checkHeaderLine()*/)
@@ -793,7 +800,10 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int
TRowPositionsInFile::const_iterator aFind = m_aFilePosToEndLinePos.find(nOffset);
m_bNeedToReadLine = aFind != m_aFilePosToEndLinePos.end();
if ( m_bNeedToReadLine )
+ {
+ m_nFilePos = aFind->first;
nCurPos = aFind->second;
+ }
else
{
m_nFilePos = nOffset;
diff --git a/connectivity/source/drivers/flat/flat.xcu b/connectivity/source/drivers/flat/flat.xcu
new file mode 100755
index 000000000000..953d1179aa64
--- /dev/null
+++ b/connectivity/source/drivers/flat/flat.xcu
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:flat:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.flat.ODriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Text</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="Extension" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="HeaderLine" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FieldDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>,</value>
+ </prop>
+ </node>
+ <node oor:name="StringDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>"</value>
+ </prop>
+ </node>
+ <node oor:name="DecimalDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>.</value>
+ </prop>
+ </node>
+ <node oor:name="ThousandDelimiter" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="EnableSQL92Check" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FileSystemBased" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="MediaType" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>text/csv</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/flat/makefile.mk b/connectivity/source/drivers/flat/makefile.mk
index 0cc44de7c55e..d044eab2796a 100644
--- a/connectivity/source/drivers/flat/makefile.mk
+++ b/connectivity/source/drivers/flat/makefile.mk
@@ -41,7 +41,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -106,6 +106,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
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/hsqldb/hsqldb.xcu b/connectivity/source/drivers/hsqldb/hsqldb.xcu
new file mode 100755
index 000000000000..8fbee4f4c00a
--- /dev/null
+++ b/connectivity/source/drivers/hsqldb/hsqldb.xcu
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:embedded:hsqldb" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.sdbcx.comp.hsqldb.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">HSQL database engine</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementIsPrimaryKey" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk
index a97365a4d835..9ed5acb17d4c 100644
--- a/connectivity/source/drivers/hsqldb/makefile.mk
+++ b/connectivity/source/drivers/hsqldb/makefile.mk
@@ -39,7 +39,7 @@ VISIBILITY_HIDDEN=TRUE
USE_DEFFILE=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(SOLAR_JAVA)"==""
@@ -115,6 +115,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index b6d18be2a346..b0341a3fd564 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -169,7 +169,6 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables(
args[3].l = pObjArray;
}
}
-
// if we are to display "all catalogs", then respect m_aCatalogRestriction
Any aCatalogFilter( catalog );
if ( !aCatalogFilter.hasValue() )
@@ -617,7 +616,8 @@ Reference< XResultSet > java_sql_DatabaseMetaData::impl_callResultSetMethodWithS
const ::rtl::OUString* _pOptionalAdditionalString )
{
bool bCatalog = _rCatalog.hasValue();
- ::rtl::OUString sCatalog( ::comphelper::getString( _rCatalog ) );
+ ::rtl::OUString sCatalog;
+ _rCatalog >>= sCatalog;
bool bSchema = _rSchemaPattern.toChar() != '%';
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/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index beef4792ba1e..dbf7241885da 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -120,7 +120,7 @@ sal_Int32 SAL_CALL java_sql_PreparedStatement::executeUpdate( ) throw(::com::su
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
m_aLogger.log( LogLevel::FINE, STR_LOG_EXECUTING_PREPARED_UPDATE );
static jmethodID mID(NULL);
- return impl_getProperty("executeUpdate",mID);
+ return callIntMethod("executeUpdate",mID);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx
index 9b8de989bb51..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!");
@@ -261,7 +261,7 @@ sal_Int64 SAL_CALL java_sql_ResultSet::getLong( sal_Int32 columnIndex ) throw(SQ
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getLong" );
static jmethodID mID(NULL);
jlong (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) = &JNIEnv::CallLongMethod;
- return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)L",mID,columnIndex);
+ return callMethodWithIntArg<jlong>(pCallMethod,"getLong","(I)J",mID,columnIndex);
}
// -------------------------------------------------------------------------
@@ -348,6 +348,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen
} //t.pEnv
// ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!!
+ ::dbtools::throwFunctionNotSupportedException( "XRow::getObject", *this );
return out==0 ? Any() : Any();//new java_lang_Object( t.pEnv, out );
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
new file mode 100755
index 000000000000..ae1bbad227e7
--- /dev/null
+++ b/connectivity/source/drivers/jdbc/jdbc.xcu
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="jdbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.JDBCDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">JDBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClassPath" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoRetrievingStatement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AddIndexAppendix" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="ParameterNameSubstitution" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="jdbc:oracle:thin:*" oor:op="replace">
+ <prop oor:name="ParentURLPattern">
+ <value>jdbc:*</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Oracle JDBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="IgnoreCurrency" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="TypeInfoSettings" oor:op="replace">
+ <prop oor:name="Value" oor:type="oor:string-list">
+ <value oor:separator=",">Column(2) = -5,Column(6) = PRECISION,Column(2) = -4,Column(6) = PRECISION,Column(2) = -3,Column(6) = PRECISION,Column(2) = -2,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = -1,Column(6) = PRECISION,Column(2) = 2,Column(6) = PRECISION,Column(2) = 12,Column(6) = PRECISION</value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>oracle.jdbc.driver.OracleDriver</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="IgnoreCurrency" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk
index b8d6a54dd065..831a6755af91 100644
--- a/connectivity/source/drivers/jdbc/makefile.mk
+++ b/connectivity/source/drivers/jdbc/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -110,6 +110,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index 6f50a6b1affd..daaed46acdd9 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -150,6 +150,9 @@ java_util_Properties* connectivity::createStringPropertyArray(const Sequence< Pr
&& pBegin->Name.compareToAscii( "IgnoreDriverPrivileges" )
&& pBegin->Name.compareToAscii( "ImplicitCatalogRestriction" )
&& pBegin->Name.compareToAscii( "ImplicitSchemaRestriction" )
+ && pBegin->Name.compareToAscii( "SupportsTableCreation" )
+ && pBegin->Name.compareToAscii( "UseJava" )
+ && pBegin->Name.compareToAscii( "Authentication" )
)
{
::rtl::OUString aStr;
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/kab/kab.xcu b/connectivity/source/drivers/kab/kab.xcu
new file mode 100755
index 000000000000..cc8e6b5329b5
--- /dev/null
+++ b/connectivity/source/drivers/kab/kab.xcu
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:kab" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.kab.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">KDE Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk
index 4ee330345625..2c0a86f8562b 100644
--- a/connectivity/source/drivers/kab/makefile.mk
+++ b/connectivity/source/drivers/kab/makefile.mk
@@ -40,7 +40,7 @@ VISIBILITY_HIDDEN=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(GUI)" == "UNX"
@@ -137,5 +137,5 @@ dummy:
@echo "Nothing to build for GUI $(GUI)"
.ENDIF
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
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/macab/macab.xcu b/connectivity/source/drivers/macab/macab.xcu
new file mode 100755
index 000000000000..3818c7db882b
--- /dev/null
+++ b/connectivity/source/drivers/macab/macab.xcu
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:macab:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.macab.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mac OS X Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk
index 67f40f2d45cf..8edc8951fa95 100755
--- a/connectivity/source/drivers/macab/makefile.mk
+++ b/connectivity/source/drivers/macab/makefile.mk
@@ -39,7 +39,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(GUI)" == "UNX"
@@ -133,5 +133,5 @@ dummy:
@echo "Nothing to build for GUI $(GUI)"
.ENDIF
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
index 8055e25585bc..79fa31551701 100644
--- a/connectivity/source/drivers/mozab/MColumnAlias.cxx
+++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx
@@ -32,12 +32,15 @@
#include "precompiled_connectivity.hxx"
#include "MColumnAlias.hxx"
#include "MConnection.hxx"
+#include "MExtConfigAccess.hxx"
+
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
-#include "MExtConfigAccess.hxx"
-#endif
+#include <tools/diagnose_ex.h>
+
+#include <algorithm>
+#include <functional>
using namespace ::connectivity;
using namespace ::connectivity::mozab;
@@ -46,56 +49,57 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-static const ::rtl::OUString sProgrammaticNames[] =
-{
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
-};
//------------------------------------------------------------------------------
OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
{
- for ( size_t i = 0; i < END - BEGIN; ++i )
- m_aAliasMap[ sProgrammaticNames[i] ] = AliasDescription( sProgrammaticNames[i], static_cast< ProgrammaticName>( i ) );
+ static const sal_Char* s_pProgrammaticNames[] =
+ {
+ "FirstName",
+ "LastName",
+ "DisplayName",
+ "NickName",
+ "PrimaryEmail",
+ "SecondEmail",
+ "PreferMailFormat",
+ "WorkPhone",
+ "HomePhone",
+ "FaxNumber",
+ "PagerNumber",
+ "CellularNumber",
+ "HomeAddress",
+ "HomeAddress2",
+ "HomeCity",
+ "HomeState",
+ "HomeZipCode",
+ "HomeCountry",
+ "WorkAddress",
+ "WorkAddress2",
+ "WorkCity",
+ "WorkState",
+ "WorkZipCode",
+ "WorkCountry",
+ "JobTitle",
+ "Department",
+ "Company",
+ "WebPage1",
+ "WebPage2",
+ "BirthYear",
+ "BirthMonth",
+ "BirthDay",
+ "Custom1",
+ "Custom2",
+ "Custom3",
+ "Custom4",
+ "Notes",
+ };
+
+ for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
+ m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
initialize( _rxORB );
}
-//------------------------------------------------------------------
+//------------------------------------------------------------------------------
void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
{
// open our driver settings config node
@@ -112,34 +116,26 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
// this is a set of string nodes
- Sequence< ::rtl::OUString > aColumnProgrammaticNames;
+ Sequence< ::rtl::OUString > aProgrammaticNames;
if ( xAliasesNode.is() )
- aColumnProgrammaticNames = xAliasesNode->getElementNames();
+ aProgrammaticNames = xAliasesNode->getElementNames();
//.............................................................
// travel through all the set elements
- const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray();
- const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.getLength();
+ const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
+ const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
::rtl::OUString sAssignedAlias;
for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
{
- OSL_ENSURE( m_aAliasMap.end() != m_aAliasMap.find( *pProgrammaticNames ),
- "OColumnAlias::setAlias: found an invalid programmtic name!" );
- // if this asserts, somebody stored a programmatic name in the configuration
- // which is not allowed (i.e. not in the list of known programmatics).
-
-#if OSL_DEBUG_LEVEL > 0
- sal_Bool bExtractionSuccess =
-#endif
- xAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias;
- OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid config data!" );
+ OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
// normalize in case the config data is corrupted
// (what we really don't need is an empty alias ...)
if ( 0 == sAssignedAlias.getLength() )
sAssignedAlias = *pProgrammaticNames;
+ ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
//.............................................................
#if OSL_DEBUG_LEVEL > 0
bool bFound = false;
@@ -149,15 +145,11 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
++search
)
{
- if ( search->second.sProgrammaticName == *pProgrammaticNames )
+ if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
{
- AliasDescription aDescription( search->second );
-
- // delete this old entry for this programmatic name
+ AliasEntry entry( search->second );
m_aAliasMap.erase( search );
-
- // insert the same AliasDescription under a new name - its alias
- m_aAliasMap[ sAssignedAlias ] = aDescription;
+ m_aAliasMap[ sAssignedAlias ] = entry;
#if OSL_DEBUG_LEVEL > 0
bFound = true;
@@ -172,29 +164,31 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
//------------------------------------------------------------------
-OColumnAlias::ProgrammaticName OColumnAlias::getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const
+::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAliasName );
+ AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
if ( pos == m_aAliasMap.end() )
{
- OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameIndex: unknown column alias!" );
- return END;
+ OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
+ return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
}
-
- return pos->second.eProgrammaticNameIndex;
+ return pos->second.programmaticAsciiName;
}
//------------------------------------------------------------------
-::rtl::OUString OColumnAlias::getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const
+bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
{
- AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
- if ( pos == m_aAliasMap.end() )
- return _rAlias;
- return pos->second.sProgrammaticName;
+ ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
+
+ return ( !sProgrammatic.equals( "HomeCountry" )
+ && !sProgrammatic.equals( "WorkCountry" )
+ );
+ // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
+ // There might be more ...
}
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx
index f19273be8ae4..64c9e3b3561b 100644
--- a/connectivity/source/drivers/mozab/MColumnAlias.hxx
+++ b/connectivity/source/drivers/mozab/MColumnAlias.hxx
@@ -36,7 +36,7 @@
#include <osl/mutex.hxx>
#include <vector>
-#include <map>
+#include <hash_map>
namespace connectivity
{
@@ -45,88 +45,41 @@ namespace connectivity
class OColumnAlias
{
public:
- typedef enum {
- BEGIN = 0,
-
- FIRSTNAME = BEGIN,
- LASTNAME,
- DISPLAYNAME,
- NICKNAME,
- PRIMARYEMAIL,
- SECONDEMAIL,
- PREFERMAILFORMAT,
- WORKPHONE,
- HOMEPHONE,
- FAXNUMBER,
- PAGERNUMBER,
- CELLULARNUMBER,
- HOMEADDRESS,
- HOMEADDRESS2,
- HOMECITY,
- HOMESTATE,
- HOMEZIPCODE,
- HOMECOUNTRY,
- WORKADDRESS,
- WORKADDRESS2,
- WORKCITY,
- WORKSTATE,
- WORKZIPCODE,
- WORKCOUNTRY,
- JOBTITLE,
- DEPARTMENT,
- COMPANY,
- WEBPAGE1,
- WEBPAGE2,
- BIRTHYEAR,
- BIRTHMONTH,
- BIRTHDAY,
- CUSTOM1,
- CUSTOM2,
- CUSTOM3,
- CUSTOM4,
- NOTES,
-
- END
- } ProgrammaticName;
-
- struct AliasDescription
+ struct AliasEntry
{
- ::rtl::OUString sProgrammaticName;
- ProgrammaticName eProgrammaticNameIndex;
+ ::rtl::OString programmaticAsciiName;
+ sal_Int32 columnPosition;
- AliasDescription()
- :eProgrammaticNameIndex( END )
+ AliasEntry()
+ :programmaticAsciiName()
+ ,columnPosition( 0 )
{
}
-
- AliasDescription( const ::rtl::OUString& _rName, ProgrammaticName _eIndex )
- :sProgrammaticName( _rName ), eProgrammaticNameIndex( _eIndex )
+ AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
+ :programmaticAsciiName( _programmaticAsciiName )
+ ,columnPosition( _columnPosition )
{
}
};
-
- typedef ::std::map< ::rtl::OUString, AliasDescription > AliasMap;
+ typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
private:
AliasMap m_aAliasMap;
- protected:
- ::osl::Mutex m_aMutex;
-
public:
- OColumnAlias(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
- ProgrammaticName getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const;
inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
{
return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
}
- ::rtl::OUString getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const;
+ ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
+ bool isColumnSearchable( const ::rtl::OUString _alias ) const;
+
private:
void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
};
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
index 2f9386b09f98..80da4df794fc 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -30,22 +30,26 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
-#include "MConnection.hxx"
+#include "diagnose_ex.h"
+#include "MConnection.hxx"
#include "MDatabaseMetaData.hxx"
#include "MDriver.hxx"
#include "MColumnAlias.hxx"
#include "MStatement.hxx"
#include "MPreparedStatement.hxx"
-#include <com/sun/star/sdbc/ColumnValue.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+
#include <connectivity/dbcharset.hxx>
#include <connectivity/dbexception.hxx>
-#include "diagnose_ex.h"
+#include <connectivity/sqlerror.hxx>
#include "resource/mozab_res.hrc"
#include "resource/common_res.hrc"
+
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+
#include <comphelper/officeresourcebundle.hxx>
#if OSL_DEBUG_LEVEL > 0
@@ -173,7 +177,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
else
{
OSL_TRACE( "No subschema given!!!\n");
- throwGenericSQLException( STR_URI_SYNTAX_ERROR,*this );
+ throwSQLException( STR_URI_SYNTAX_ERROR, *this );
}
}
else
@@ -284,7 +288,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
m_sMozillaURI += m_sHostName;
}
else
- throwGenericSQLException( STR_NO_HOSTNAME ,*this);
+ throwSQLException( STR_NO_HOSTNAME, *this );
if ( nPortNumber > 0 ) {
m_sMozillaURI += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(":") );
@@ -296,7 +300,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
m_sMozillaURI += sBaseDN;
}
else
- throwGenericSQLException( STR_NO_BASEDN ,*this);
+ throwSQLException( STR_NO_BASEDN, *this );
// Addition of a fake query to enable the Mozilla LDAP directory to work correctly.
m_sMozillaURI += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?(or(DisplayName,=,DontDoThisAtHome)))"));
@@ -313,7 +317,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
else
{
OSL_TRACE("Invalid subschema given!!!\n");
- throwGenericSQLException( STR_URI_SYNTAX_ERROR ,*this);
+ throwSQLException( STR_URI_SYNTAX_ERROR, *this );
}
OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ? (OUtoCStr(m_sMozillaURI)):("NULL")), usesFactory() ? "uses factory" : "no factory");
@@ -324,12 +328,15 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
// The creation of the nsIAbDirectory i/f for LDAP doesn't actually test
// the validity of the connection, it's normally delayed until the query
// is executed, but it's a bit late then to fail...
- if ( isLDAP() ) {
- if ( !_aDbHelper.testLDAPConnection( this ) ) {
+ if ( isLDAP() )
+ {
+ if ( !_aDbHelper.testLDAPConnection( this ) )
+ {
OSL_TRACE("testLDAPConnection : FAILED\n" );
- throwGenericSQLException( _aDbHelper.getErrorResourceId() ,*this);
+ throwSQLException( _aDbHelper.getError(), *this );
}
- else {
+ else
+ {
OSL_TRACE("testLDAPConnection : SUCCESS\n" );
}
}
@@ -337,8 +344,9 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
// Test connection by getting to get the Table Names
::std::vector< ::rtl::OUString > tables;
::std::vector< ::rtl::OUString > types;
- if ( !_aDbHelper.getTableStrings( this, tables, types ) ) {
- throwGenericSQLException( _aDbHelper.getErrorResourceId() ,*this);
+ if ( !_aDbHelper.getTableStrings( this, tables, types ) )
+ {
+ throwSQLException( _aDbHelper.getError(), *this );
}
}
@@ -370,8 +378,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
// the statement can only be executed more than once
OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql);
Reference< XPreparedStatement > xReturn = pPrepared;
- if ( !pPrepared->lateInit() )
- throw SQLException();
+ pPrepared->lateInit();
m_aStatements.push_back(WeakReferenceHelper(xReturn));
return xReturn;
@@ -550,6 +557,50 @@ MNameMapper* OConnection::getNameMapper ()
return m_aNameMapper;
}
+
+// -----------------------------------------------------------------------------
+void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Reference< XInterface >& _rxContext )
+{
+ if ( _rError.getResId() != 0 )
+ {
+ OSL_ENSURE( ( _rError.getErrorCondition() == 0 ),
+ "OConnection::throwSQLException: unsupported error code combination!" );
+
+ ::rtl::OUString sParameter( _rError.getParameter() );
+ if ( sParameter.getLength() )
+ {
+ const ::rtl::OUString sError( getResources().getResourceStringWithSubstitution(
+ _rError.getResId(),
+ "$1$", sParameter
+ ) );
+ ::dbtools::throwGenericSQLException( sError, _rxContext );
+ OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (1)!" );
+ }
+
+ throwGenericSQLException( _rError.getResId(), _rxContext );
+ OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (2)!" );
+ }
+
+ if ( _rError.getErrorCondition() != 0 )
+ {
+ SQLError aErrorHelper( getDriver()->getMSFactory() );
+ ::rtl::OUString sParameter( _rError.getParameter() );
+ if ( sParameter.getLength() )
+ aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter );
+ else
+ aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext);
+ OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (3)!" );
+ }
+
+ throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext );
+}
+
// -----------------------------------------------------------------------------
+void OConnection::throwSQLException( const sal_uInt16 _nErrorResourceId, const Reference< XInterface >& _rxContext )
+{
+ ErrorDescriptor aError;
+ aError.setResId( _nErrorResourceId );
+ throwSQLException( aError, _rxContext );
+}
} } // namespace connectivity::mozab
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
index 883c003ba883..d29a36f60a14 100644
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -30,23 +30,19 @@
#ifndef CONNECTIVITY_SCONNECTION_HXX
#define CONNECTIVITY_SCONNECTION_HXX
+#include "connectivity/CommonTools.hxx"
+
+#include "MCatalog.hxx"
#include "MColumnAlias.hxx"
-#ifndef _CONNECTIVITY_MAB_CATALOG_HXX_
-#include "MCatalog.hxx"
-#endif
-
+#include "OSubComponent.hxx"
+#include "TConnection.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/mozilla/MozillaProductType.hpp>
#include <com/sun/star/sdbc/SQLWarning.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include "OSubComponent.hxx"
-// #include <map>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include "connectivity/CommonTools.hxx"
-#include "TConnection.hxx"
+
#include <cppuhelper/weakref.hxx>
-#ifndef _COM_SUN_STAR_MOZILLA_MOZILLPRODUCTTYPE_HPP_
-#include <com/sun/star/mozilla/MozillaProductType.hpp>
-#endif
#include <memory>
@@ -55,10 +51,10 @@ namespace connectivity
namespace mozab
{
- class OStatement_Base;
class MozabDriver;
class ODatabaseMetaData;
class MNameMapper;
+ class ErrorDescriptor;
namespace SDBCAddress {
typedef enum {
@@ -225,7 +221,12 @@ namespace connectivity
void setForceLoadTables(sal_Bool aForce){ m_bForceLoadTable = aForce;}
sal_Bool getForceLoadTables() { return m_bForceLoadTable;}
- // End of Additions from the land of mozilla
+ void throwSQLException( const ErrorDescriptor& _rError, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+ void throwSQLException( const sal_uInt16 _nErrorResourceId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+
+ private:
+ // make this private - clients should use throwSQLException instead
+ using OConnection_BASE::throwGenericSQLException;
};
}
}
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
index 6f19e821e476..3ba479abc764 100644
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
@@ -97,7 +97,7 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
::std::vector< ::rtl::OUString > tables;
::std::vector< ::rtl::OUString > types;
if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types) ) {
- getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId(),*this );
+ getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
}
// ****************************************************
@@ -157,7 +157,7 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
// COLUMN_NAME
aRow[4] = new ORowSetValueDecorator( compare->first );
// ORDINAL_POSITION
- aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.eProgrammaticNameIndex ) + 1 );
+ aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
aRows.push_back(aRow);
}
}
@@ -961,7 +961,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
// pResultSet->setRows( aRows );
ODatabaseMetaDataResultSet::ORows _rRows;
if ( !m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern, types,_rRows ) ) {
- getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ,*this);
+ getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
}
pResultSet->setRows( _rRows );
@@ -979,7 +979,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
::std::vector< ::rtl::OUString > tables;
::std::vector< ::rtl::OUString > types;
if ( !m_pDbMetaDataHelper->getTableStrings( m_pConnection, tables, types ) )
- getOwnConnection()->throwGenericSQLException( m_pDbMetaDataHelper->getErrorResourceId() ,*this);
+ getOwnConnection()->throwSQLException( m_pDbMetaDataHelper->getError(), *this );
::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8);
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
index d7f1fb9d6e2d..bdb9d9447cfe 100644
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -304,9 +304,9 @@ bool MozabDriver::ensureInit()
const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" ));
- // load the dbtools library
+ // load the mozabdrv library
m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0);
- OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the dbtools library!");
+ OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the mozabdrv library!");
if ( !m_hModule )
return false;
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
index 79c58bc6a90c..098fc8b9e055 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
@@ -67,11 +67,11 @@ IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStat
OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
- :OStatement_BASE2(_pConnection)
+ :OCommonStatement(_pConnection)
,m_nNumParams(0)
,m_sSqlStatement(sql)
,m_bPrepared(sal_False)
- ,m_pResultSet( NULL )
+ ,m_pResultSet()
{
}
// -----------------------------------------------------------------------------
@@ -79,23 +79,19 @@ OPreparedStatement::~OPreparedStatement()
{
}
// -----------------------------------------------------------------------------
-sal_Bool OPreparedStatement::lateInit()
+void OPreparedStatement::lateInit()
{
- return parseSql( m_sSqlStatement );
+ if ( eSelect != parseSql( m_sSqlStatement ) )
+ throw SQLException();
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
- if(m_pResultSet)
- m_pResultSet->release();
+ OCommonStatement::disposing();
- clearMyResultSet();
-
- OStatement_BASE2::disposing();
-
- m_xMetaData = NULL;
+ m_xMetaData.clear();
if(m_aParameterRow.isValid())
{
m_aParameterRow->get().clear();
@@ -105,63 +101,61 @@ void SAL_CALL OPreparedStatement::disposing()
}
// -----------------------------------------------------------------------------
-sal_Bool OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted ) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
+OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted )
+ throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
{
- OSL_TRACE("in :: OPreparedStatement::parseSql()");
- if (!OStatement_Base::parseSql( sql, bAdjusted ))
- return sal_False;
+ StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
+ if ( eStatementType != eSelect )
+ return eStatementType;
m_xParamColumns = new OSQLColumns();
- Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
-
// describe all parameters need for the resultset
describeParameter();
- OResultSet::setBoundedColumns(m_aRow,m_xParamColumns,xNames,sal_False,m_xDBMetaData,m_aColMapping);
+ Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+ OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping );
- m_pResultSet = createResultSet();
- m_pResultSet->acquire();
- m_xResultSet = Reference<XResultSet>(m_pResultSet);
- initializeResultSet(m_pResultSet);
- OSL_TRACE("Out :: OPreparedStatement::parseSql()");
- return sal_True;
+ return eStatementType;
}
// -----------------------------------------------------------------------------
-
-OResultSet* OPreparedStatement::createResultSet( )
+void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
{
- OSL_TRACE("In/Out : OPreparedStatement::createResultSet( )");
- return new OResultSet( this, m_pSQLIterator );
+ OCommonStatement::initializeResultSet( _pResult );
+ _pResult->setParameterColumns( m_xParamColumns );
+ _pResult->setParameterRow( m_aParameterRow );
}
// -----------------------------------------------------------------------------
-void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
+void OPreparedStatement::clearCachedResultSet()
{
- OSL_TRACE("In : OPreparedStatement::initializeResultSet( )");
- OStatement_Base::initializeResultSet( _pResult );
-
- _pResult->setParameterColumns(m_xParamColumns);
- _pResult->setParameterRow(m_aParameterRow);
- OSL_TRACE("Out : OPreparedStatement::initializeResultSet( )");
+ OCommonStatement::clearCachedResultSet();
+ m_pResultSet.clear();
+ m_xMetaData.clear();
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
+{
+ OCommonStatement::cacheResultSet( _pResult );
+ OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
+ m_pResultSet = _pResult;
}
// -----------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::acquire() throw()
{
- OStatement_BASE2::acquire();
+ OCommonStatement::acquire();
}
// -----------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::release() throw()
{
- OStatement_BASE2::release();
+ OCommonStatement::release();
}
// -----------------------------------------------------------------------------
Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- Any aRet = OStatement_BASE2::queryInterface(rType);
+ Any aRet = OCommonStatement::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPreparedStatement_BASE::queryInterface(rType);
return aRet;
@@ -169,61 +163,41 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt
// -------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
{
- return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes());
+ return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
}
// -------------------------------------------------------------------------
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- sal_Bool bReadOnly= sal_True;
- if (m_pResultSet)
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
+
+ sal_Bool bReadOnly = sal_True;
+ if ( m_pResultSet.is() )
bReadOnly = m_pResultSet->determineReadOnly();
- if(!m_xMetaData.is())
+ // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
+ // okay, /me thinks.
+
+ if ( !m_xMetaData.is() )
m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
+
return m_xMetaData;
}
-// -------------------------------------------------------------------------
-
-void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
-
- // Reset last warning message
-
- try {
- clearWarnings ();
- clearMyResultSet();
- // OStatement_BASE2::close();
- }
- catch (SQLException &) {
- // If we get an error, ignore
- }
- // Remove this Statement object from the Connection object's
- // list
-}
// -------------------------------------------------------------------------
-
sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-
- Reference< XResultSet> xRS = OStatement_Base::executeQuery( m_sSqlStatement );
- // same as in statement with the difference that this statement also can contain parameter
-
- OSL_TRACE("In/Out: OPreparedStatement::execute" );
- return xRS.is();
+ Reference< XResultSet> xResult = executeQuery();
+ return xResult.is();
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
{
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
return 0;
}
// -------------------------------------------------------------------------
@@ -231,7 +205,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
setParameter( parameterIndex, x );
@@ -241,7 +215,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r
Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
return (Reference< XConnection >)m_pConnection;
}
@@ -251,12 +225,11 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE
{
::osl::MutexGuard aGuard( m_aMutex );
OSL_TRACE("In: OPreparedStatement::executeQuery" );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- Reference< XResultSet > rs = OStatement_Base::executeQuery( m_sSqlStatement );
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- OSL_TRACE("Out: OPreparedStatement::executeQuery" );
- return rs;
+ // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
+ // stuff again. Just execute.
+ return impl_executeCurrentQuery();
}
// -------------------------------------------------------------------------
@@ -318,7 +291,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
checkAndResizeParameters(parameterIndex);
@@ -410,7 +383,7 @@ void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons
case PROPERTY_ID_USEBOOKMARKS:
break;
default:
- OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+ OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
}
// -----------------------------------------------------------------------------
@@ -422,7 +395,7 @@ void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
// -----------------------------------------------------------------------------
void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
{
- ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
if ( !m_aParameterRow.isValid() ) {
m_aParameterRow = new OValueVector();
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
index 70f6d0060b6e..f2830654fcfe 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
@@ -53,7 +53,7 @@ namespace connectivity
::com::sun::star::sdbc::XMultipleResults,
::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
- class OPreparedStatement : public OStatement_BASE2,
+ class OPreparedStatement : public OCommonStatement,
public OPreparedStatement_BASE
{
protected:
@@ -79,7 +79,7 @@ namespace connectivity
::rtl::OUString m_sSqlStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
sal_Bool m_bPrepared;
- OResultSet* m_pResultSet;
+ ::rtl::Reference< OResultSet > m_pResultSet;
::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
OValueRow m_aParameterRow;
@@ -93,29 +93,29 @@ namespace connectivity
virtual ~OPreparedStatement();
virtual void SAL_CALL disposing();
- virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- virtual OResultSet* createResultSet();
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> initResultSet();
+ // OCommonStatement overridables
+ virtual StatementType
+ parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ virtual void initializeResultSet( OResultSet* _pResult );
+ virtual void clearCachedResultSet();
+ virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
+
void checkAndResizeParameters(sal_Int32 parameterIndex);
void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x);
-
sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol);
void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes);
void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable);
void describeParameter();
- virtual void initializeResultSet( OResultSet* _pResult );
-
public:
DECLARE_SERVICE_INFO();
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql);
- sal_Bool lateInit();
+ void lateInit();
//XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
@@ -153,8 +153,6 @@ namespace connectivity
virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- // XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XResultSetMetaDataSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XMultipleResults
@@ -163,9 +161,9 @@ namespace connectivity
virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
public:
- using OStatement_Base::executeQuery;
- using OStatement_Base::executeUpdate;
- using OStatement_Base::execute;
+ using OCommonStatement::executeQuery;
+ using OCommonStatement::executeUpdate;
+ using OCommonStatement::execute;
protected:
using OPropertySetHelper::getFastPropertyValue;
};
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
index 4ae7b695390a..8e0193f303c8 100644
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ b/connectivity/source/drivers/mozab/MResultSet.cxx
@@ -99,7 +99,7 @@ sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceN
}
// -------------------------------------------------------------------------
-OResultSet::OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
+OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
: OResultSet_BASE(m_aMutex)
,OPropertySetHelper(OResultSet_BASE::rBHelper)
,m_pStatement(pStmt)
@@ -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)
@@ -357,8 +357,9 @@ sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, Runtime
//
// Everything in the addressbook is a string!
//
- if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) {
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this );
+ if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
}
}
@@ -398,8 +399,9 @@ sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(
//
// Everything in the addressbook is a string!
//
- if ( !m_aQuery.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR )) {
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this );
+ if ( !m_aQuery.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
}
}
@@ -510,7 +512,7 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
{
ResultSetEntryGuard aGuard( *this );
OSL_TRACE("In/Out: OResultSet::close" );
- // dispose();
+ dispose();
}
// -------------------------------------------------------------------------
@@ -613,7 +615,7 @@ void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
{
OSL_TRACE("In/Out: OResultSet::refreshRow" );
if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_REFRESH_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
}
// -------------------------------------------------------------------------
IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
@@ -852,7 +854,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
// odbc date
(SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{"))))
{
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
OSQLParseNode *pPrec = parseTree->getChild(1);
@@ -889,7 +891,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) )
{
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_COLUMN,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_COLUMN, *this );
}
@@ -909,7 +911,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
{
OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() );
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_LIKE_STRING,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_STRING, *this );
}
const sal_Unicode WILDCARD = '%';
@@ -971,7 +973,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
{
// We currently can't handle a 'NOT LIKE' when there are '%' or
// '_' dispersed throughout
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_NOT_LIKE_TOO_COMPLEX, *this );
}
else
{
@@ -1026,7 +1028,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
{
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_INVALID_IS_NULL_COLUMN,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this );
}
if (SQL_ISTOKEN(parseTree->getChild(2),NOT))
@@ -1045,7 +1047,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT
{
OSL_TRACE( "Unexpected statement!!!" );
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
}
@@ -1123,15 +1125,12 @@ void OResultSet::fillRowData()
m_aQuery.setExpression( queryExpression );
- // We need a unique id for caching mechanism so should fetch card:URI
- m_aQuery.setAttributes( m_aAttributeStrings );
-
rtl::OUString aStr( m_pTable->getName() );
m_aQuery.setAddressbook( aStr );
sal_Int32 rv = m_aQuery.executeQuery(xConnection);
if ( rv == -1 ) {
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERR_EXECUTING_QUERY,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
}
//determine whether the address book is readonly
determineReadOnly();
@@ -1179,7 +1178,7 @@ sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
}
}
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_BOOKMARK,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
return 0;
}
@@ -1194,7 +1193,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
{
const OSQLTables& xTabs = m_pSQLIterator->getTables();
if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
@@ -1219,7 +1218,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
}
else if(isCount())
{
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_NO_COUNT_SUPPORT,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
}
else
{
@@ -1284,8 +1283,9 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
OSL_TRACE("Query is to be sorted");
if( ! m_aQuery.queryComplete() )
- if ( !m_aQuery.waitForQueryComplete() ) {
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this );
+ if ( !m_aQuery.waitForQueryComplete() )
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!");
@@ -1360,7 +1360,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
case SQL_STATEMENT_INSERT:
break;
default:
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_STMT_TYPE_NOT_SUPPORTED,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
break;
}
}
@@ -1472,8 +1472,9 @@ sal_Bool OResultSet::validRow( sal_uInt32 nRow )
OSL_TRACE("validRow: waiting...");
#endif
m_aQuery.checkRowAvailable( nRow );
- if ( m_aQuery.errorOccurred() ) {
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this);
+ if ( m_aQuery.hadError() )
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
nNumberOfRecords = m_aQuery.getRealRowCount();
}
@@ -1515,7 +1516,7 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
{
ResultSetEntryGuard aGuard( *this );
if ( !m_pKeySet.isValid() )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ILLEGAL_MOVEMENT,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
sal_Int32 nRetrivedRows = currentRowCount();
@@ -1567,8 +1568,9 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) {
m_aQuery.checkRowAvailable( nCurCard );
- if ( m_aQuery.errorOccurred() ) {
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId(),*this );
+ if ( m_aQuery.hadError() )
+ {
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
nNumberOfRecords = m_aQuery.getRealRowCount();
}
@@ -1602,7 +1604,7 @@ void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMappin
OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row");
return makeAny((sal_Int32)(m_aRow->get())[0]);
@@ -1633,7 +1635,7 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c
sal_Int32 nResult=0;
if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_BOOKMARK,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
if(nFirst < nSecond)
nResult = -1;
@@ -1686,7 +1688,7 @@ void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw
OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
checkPendingUpdate();
@@ -1706,7 +1708,7 @@ void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException
OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if ( fetchCurrentRow() == sal_False )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
checkPendingUpdate();
checkIndex(columnIndex );
@@ -1847,21 +1849,21 @@ void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLExcepti
impl_ensureKeySet();
if (!m_nRowPos || m_pKeySet->get().size() < m_nRowPos )
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_INVALID_ROW_UPDATE,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_ROW_UPDATE, *this );
const sal_Int32 nCurrentCard = getCurrentCardNumber();
if (!pushCard(nCurrentCard))
{
m_RowStates = RowStates_Error;
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ROW_CAN_NOT_SAVE,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this );
}
if (!m_aQuery.commitRow(nCurrentCard))
{
m_RowStates = RowStates_Error;
m_nUpdatedRow = 0;
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
}
m_nUpdatedRow = 0;
@@ -1874,16 +1876,16 @@ void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLExcepti
OSL_TRACE("deleteRow, m_nRowPos = %u", m_nRowPos );
ResultSetEntryGuard aGuard( *this );
if (rowDeleted())
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ROW_ALREADY_DELETED,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this );
const sal_Int32 nCurrentRow = getCurrentCardNumber();
//fetchRow(nCurrentRow);
if (!nCurrentRow)
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_ERROR_GET_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
sal_Bool m_bRowDeleted = ( m_aQuery.deleteRow( nCurrentRow ) > 0 );
if (!m_bRowDeleted)
- m_pStatement->getOwnConnection()->throwGenericSQLException( m_aQuery.getErrorResourceId() ,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
m_aQuery.setRowStates(nCurrentRow,RowStates_Deleted);
m_pKeySet->get().erase(m_pKeySet->get().begin() + m_nRowPos -1);
@@ -1896,7 +1898,7 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQL
ResultSetEntryGuard aGuard( *this );
OSL_TRACE("cancelRowUpdates, m_nRowPos = %u", m_nRowPos );
if (fetchRow(getCurrentCardNumber(),sal_True)) //force fetch current row will cause we lose all change to the current row
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_CAN_NOT_CANCEL_ROW_UPDATE,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CANCEL_ROW_UPDATE, *this );
}
// -------------------------------------------------------------------------
void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
@@ -1916,7 +1918,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLE
}
m_nNewRow = m_aQuery.createNewCard();
if (!m_nNewRow)
- m_pStatement->getOwnConnection()->throwGenericSQLException(STR_CAN_NOT_CREATE_ROW,*this);
+ m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this );
m_RowStates = RowStates_Normal;
fillKeySet(m_nNewRow);
diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx
index 09d53ee616ee..8eccf4cc7673 100644
--- a/connectivity/source/drivers/mozab/MResultSet.hxx
+++ b/connectivity/source/drivers/mozab/MResultSet.hxx
@@ -83,7 +83,7 @@ namespace connectivity
public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
{
protected:
- OStatement_Base* m_pStatement;
+ OCommonStatement* m_pStatement;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
sal_uInt32 m_nRowPos;
@@ -126,7 +126,7 @@ namespace connectivity
public:
DECLARE_SERVICE_INFO();
- OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
+ OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
index b0caef93c15c..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;
}
// -----------------------------------------------------------------------------
@@ -184,12 +184,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL
if ( m_pTable->getConnection()->isLDAP() )
{
const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
- OColumnAlias::ProgrammaticName eProgrammatic( aAliases.getProgrammaticNameIndex( sColumnName ) );
- if ( ( eProgrammatic == OColumnAlias::HOMECOUNTRY )
- || ( eProgrammatic == OColumnAlias::WORKCOUNTRY )
- )
- // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
- // There might be more ...
+ if ( !aAliases.isColumnSearchable( sColumnName ) )
return sal_False;
}
diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx
index a74128532dc6..852cad9dbc44 100644
--- a/connectivity/source/drivers/mozab/MStatement.cxx
+++ b/connectivity/source/drivers/mozab/MStatement.cxx
@@ -36,6 +36,7 @@
#include <comphelper/property.hxx>
#include <comphelper/uno3.hxx>
#include <osl/thread.h>
+#include <tools/diagnose_ex.h>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp>
@@ -78,39 +79,33 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
//------------------------------------------------------------------------------
-OStatement_Base::OStatement_Base(OConnection* _pConnection )
- :OStatement_BASE(m_aMutex)
- ,OPropertySetHelper(OStatement_BASE::rBHelper)
+OCommonStatement::OCommonStatement(OConnection* _pConnection )
+ :OCommonStatement_IBASE(m_aMutex)
+ ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
+ ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this)
,m_xDBMetaData(_pConnection->getMetaData())
,m_pTable(NULL)
,m_pConnection(_pConnection)
,m_aParser(_pConnection->getDriver()->getMSFactory())
,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) )
,m_pParseTree(NULL)
- ,rBHelper(OStatement_BASE::rBHelper)
+ ,rBHelper(OCommonStatement_IBASE::rBHelper)
{
m_pConnection->acquire();
- OSL_TRACE("In/Out: OStatement_Base::OStatement_Base" );
+ OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" );
}
// -----------------------------------------------------------------------------
-OStatement_Base::~OStatement_Base()
+OCommonStatement::~OCommonStatement()
{
}
+
//------------------------------------------------------------------------------
-void OStatement_Base::disposeResultSet()
-{
- // free the cursor if alive
- Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- m_xResultSet = Reference< XResultSet>();
-}
-//------------------------------------------------------------------------------
-void OStatement_BASE2::disposing()
+void OCommonStatement::disposing()
{
::osl::MutexGuard aGuard(m_aMutex);
- disposeResultSet();
+ clearWarnings();
+ clearCachedResultSet();
if (m_pConnection)
m_pConnection->release();
@@ -119,76 +114,38 @@ void OStatement_BASE2::disposing()
m_pSQLIterator->dispose();
dispose_ChildImpl();
- OStatement_Base::disposing();
+ OCommonStatement_IBASE::disposing();
}
//-----------------------------------------------------------------------------
-void SAL_CALL OStatement_BASE2::release() throw()
+Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
- relase_ChildImpl();
-}
-//-----------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aRet = OStatement_BASE::queryInterface(rType);
+ Any aRet = OCommonStatement_IBASE::queryInterface(rType);
if(!aRet.hasValue())
aRet = OPropertySetHelper::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OStatement_Base::getTypes( ) throw(RuntimeException)
+Sequence< Type > SAL_CALL OCommonStatement::getTypes( ) throw(RuntimeException)
{
::cppu::OTypeCollection aTypes( ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
::getCppuType( (const Reference< XFastPropertySet > *)0 ),
::getCppuType( (const Reference< XPropertySet > *)0 ));
- return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
+ return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes());
}
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::close( ) throw(SQLException, RuntimeException)
{
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
}
dispose();
}
-// -------------------------------------------------------------------------
-
-void OStatement_Base::reset() throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- clearWarnings ();
-
- if (m_xResultSet.get().is())
- clearMyResultSet();
-}
-//--------------------------------------------------------------------
-// clearMyResultSet
-// If a ResultSet was created for this Statement, close it
-//--------------------------------------------------------------------
-
-void OStatement_Base::clearMyResultSet () throw (SQLException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-
- try
- {
- Reference<XCloseable> xCloseable;
- if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
- xCloseable->close();
- }
- catch( const DisposedException& ) { }
-
- m_xResultSet = Reference< XResultSet >();
-}
-
-void OStatement_Base::createTable( )
- throw ( SQLException, RuntimeException )
+// -------------------------------------------------------------------------
+void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
{
if(m_pParseTree)
{
@@ -222,7 +179,7 @@ void OStatement_Base::createTable( )
MDatabaseMetaDataHelper _aDbHelper;
if (!_aDbHelper.NewAddressBook(m_pConnection,ouTableName))
{
- getOwnConnection()->throwGenericSQLException( _aDbHelper.getErrorResourceId(),*this );
+ getOwnConnection()->throwSQLException( _aDbHelper.getError(), *this );
}
m_pSQLIterator.reset( new ::connectivity::OSQLParseTreeIterator(
m_pConnection, m_pConnection->createCatalog()->getTables(), m_aParser, NULL ) );
@@ -230,16 +187,14 @@ void OStatement_Base::createTable( )
}
else
- getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
+ getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
}
// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
+OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
throw ( SQLException, RuntimeException )
{
::rtl::OUString aErr;
- OSL_TRACE("In/Out :: OStatement::parseSql(%s)\n", OUtoCStr( sql ) );
-
m_pParseTree = m_aParser.parseTree(aErr,sql);
#if OSL_DEBUG_LEVEL > 0
@@ -256,7 +211,7 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus
m_pSQLIterator->traverseAll();
const OSQLTables& xTabs = m_pSQLIterator->getTables();
if(xTabs.empty())
- getOwnConnection()->throwGenericSQLException( STR_QUERY_AT_LEAST_ONE_TABLES,*this );
+ getOwnConnection()->throwSQLException( STR_QUERY_AT_LEAST_ONE_TABLES, *this );
#if OSL_DEBUG_LEVEL > 0
OSQLTables::const_iterator citer;
@@ -285,12 +240,14 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus
createColumnMapping();
analyseSQL();
- break;
+ return eSelect;
+
case SQL_STATEMENT_CREATE_TABLE:
createTable();
- return sal_False;
+ return eCreateTable;
+
default:
- getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
+ break;
}
}
else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo"
@@ -298,35 +255,71 @@ sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjus
{
return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
}
- else
- getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
- return sal_True;
+
+ getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
+ OSL_ENSURE( false, "OCommonStatement::parseSql: unreachable!" );
+ return eSelect;
}
// -------------------------------------------------------------------------
-
-OResultSet* OStatement_Base::createResultSet()
+Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery()
{
- return new OResultSet( this, m_pSQLIterator );
+ clearCachedResultSet();
+
+ ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) );
+ initializeResultSet( pResult.get() );
+
+ pResult->executeQuery();
+ cacheResultSet( pResult ); // only cache if we survived the execution
+
+ return pResult.get();
+
}
-// -------------------------------------------------------------------------
-void OStatement_Base::initializeResultSet( OResultSet* _pResult )
+// -------------------------------------------------------------------------
+void OCommonStatement::initializeResultSet( OResultSet* _pResult )
{
- OSL_TRACE("In : initializeResultSet");
+ ENSURE_OR_THROW( _pResult, "invalid result set" );
+
_pResult->setColumnMapping(m_aColMapping);
_pResult->setOrderByColumns(m_aOrderbyColumnNumber);
_pResult->setOrderByAscending(m_aOrderbyAscending);
_pResult->setBindingRow(m_aRow);
_pResult->setTable(m_pTable);
- OSL_TRACE("Out : initializeResultSet");
}
// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+void OCommonStatement::clearCachedResultSet()
+{
+ Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY );
+ if ( !xResultSet.is() )
+ return;
+
+ try
+ {
+ Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW );
+ xCloseable->close();
+ }
+ catch( const DisposedException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_xResultSet = Reference< XResultSet >();
+}
+
+// -------------------------------------------------------------------------
+void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
+{
+ ENSURE_OR_THROW( _pResult.is(), "invalid result set" );
+ m_xResultSet = Reference< XResultSet >( _pResult.get() );
+}
+
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
@@ -336,31 +329,26 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S
}
// -------------------------------------------------------------------------
-Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_ThreadMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
- if (!parseSql( sql )) //parseSql return false means this sql is a create table statement
+ // parse the statement
+ StatementType eStatementType = parseSql( sql );
+ if ( eStatementType != eSelect )
return NULL;
- OResultSet* pResult = createResultSet();
- Reference< XResultSet > xRS = pResult;
- initializeResultSet( pResult );
-
- pResult->executeQuery();
- m_xResultSet = xRS; // we need a reference to it for later use
-
- return xRS;
+ return impl_executeCurrentQuery();
}
// -------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
+Reference< XConnection > SAL_CALL OCommonStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
// just return our connection here
return (Reference< XConnection >)m_pConnection;
@@ -370,37 +358,37 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep
{
Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
if(!aRet.hasValue())
- aRet = OStatement_Base::queryInterface(rType);
+ aRet = OCommonStatement::queryInterface(rType);
return aRet;
}
// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
+sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
{
- ::dbtools::throwFeatureNotImplementedException( "XPreparedStatement::executeUpdate", *this );
+ ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
return 0;
}
// -------------------------------------------------------------------------
-Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
+Any SAL_CALL OCommonStatement::getWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
return makeAny(m_aLastWarning);
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
+void SAL_CALL OCommonStatement::clearWarnings( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
m_aLastWarning = SQLWarning();
}
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
{
// this properties are define by the service resultset
// they must in alphabetic order
@@ -421,12 +409,12 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce
}
// -------------------------------------------------------------------------
-::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
{
- return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+ return *const_cast<OCommonStatement*>(this)->getArrayHelper();
}
// -------------------------------------------------------------------------
-sal_Bool OStatement_Base::convertFastPropertyValue(
+sal_Bool OCommonStatement::convertFastPropertyValue(
Any & /*rConvertedValue*/,
Any & /*rOldValue*/,
sal_Int32 /*nHandle*/,
@@ -438,7 +426,7 @@ sal_Bool OStatement_Base::convertFastPropertyValue(
return bConverted;
}
// -------------------------------------------------------------------------
-void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
+void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
{
// set the value to what ever is nescessary
switch(nHandle)
@@ -456,7 +444,7 @@ void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const A
}
}
// -------------------------------------------------------------------------
-void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
+void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
{
switch(nHandle)
{
@@ -475,32 +463,32 @@ void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) co
// -------------------------------------------------------------------------
IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::acquire() throw()
+void SAL_CALL OCommonStatement::acquire() throw()
{
- OStatement_BASE::acquire();
+ OCommonStatement_IBASE::acquire();
}
// -----------------------------------------------------------------------------
-void SAL_CALL OStatement_Base::release() throw()
+void SAL_CALL OCommonStatement::release() throw()
{
- OStatement_BASE::release();
+ relase_ChildImpl();
}
// -----------------------------------------------------------------------------
void SAL_CALL OStatement::acquire() throw()
{
- OStatement_BASE2::acquire();
+ OCommonStatement::acquire();
}
// -----------------------------------------------------------------------------
void SAL_CALL OStatement::release() throw()
{
- OStatement_BASE2::release();
+ OCommonStatement::release();
}
// -----------------------------------------------------------------------------
-Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo( ) throw(RuntimeException)
{
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
// -----------------------------------------------------------------------------
-void OStatement_Base::createColumnMapping()
+void OCommonStatement::createColumnMapping()
{
size_t i;
@@ -524,7 +512,7 @@ void OStatement_Base::createColumnMapping()
}
// -----------------------------------------------------------------------------
-void OStatement_Base::analyseSQL()
+void OCommonStatement::analyseSQL()
{
const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
if(pOrderbyClause)
@@ -549,7 +537,7 @@ void OStatement_Base::analyseSQL()
}
}
//------------------------------------------------------------------
-void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef,
+void OCommonStatement::setOrderbyColumn( OSQLParseNode* pColumnRef,
OSQLParseNode* pAscendingDescending)
{
::rtl::OUString aColumnName;
diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx
index 48e66568b85e..1c3f3f93e8cc 100644
--- a/connectivity/source/drivers/mozab/MStatement.hxx
+++ b/connectivity/source/drivers/mozab/MStatement.hxx
@@ -64,21 +64,28 @@ namespace connectivity
typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XStatement,
::com::sun::star::sdbc::XWarningsSupplier,
- ::com::sun::star::sdbc::XCloseable> OStatement_BASE;
+ ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
//**************************************************************
- //************ Class: OStatement_Base
+ //************ Class: OCommonStatement
// is a base class for the normal statement and for the prepared statement
//**************************************************************
- class OStatement_Base : public comphelper::OBaseMutex,
- public OStatement_BASE,
- public ::cppu::OPropertySetHelper,
- public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
-
+ class OCommonStatement;
+ typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE > OCommonStatement_SBASE;
+
+ class OCommonStatement :public comphelper::OBaseMutex
+ ,public OCommonStatement_IBASE
+ ,public ::cppu::OPropertySetHelper
+ ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
+ ,public OCommonStatement_SBASE
{
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
+ friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
+
+ private:
+ ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
+
protected:
- ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet > m_xResultSet;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
@@ -105,8 +112,6 @@ namespace connectivity
protected:
- void disposeResultSet();
-
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
// OPropertySetHelper
@@ -123,23 +128,37 @@ namespace connectivity
virtual void SAL_CALL getFastPropertyValue(
::com::sun::star::uno::Any& rValue,
sal_Int32 nHandle) const;
- virtual ~OStatement_Base();
+ virtual ~OCommonStatement();
protected:
//
// Driver Internal Methods
//
- virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw (
- ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ enum StatementType { eSelect, eCreateTable };
+ /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
+ */
+ virtual StatementType
+ parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ /** called to initialize a result set, according to a previously parsed SQL statement
+ */
+ virtual void initializeResultSet( OResultSet* _pResult );
+ /** called when a possible cached instance of our last result set should be cleared
+ */
+ virtual void clearCachedResultSet();
+ /** caches a result set which has just been created by an execution of an SQL statement
+ */
+ virtual void cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
+
+
+ /** executes the current query (the one which has been passed to the last parseSql call)
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ impl_executeCurrentQuery();
- OResultSet* createResultSet();
- virtual void initializeResultSet( OResultSet* _pResult );
void createColumnMapping();
void analyseSQL();
void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
connectivity::OSQLParseNode* pAscendingDescending);
- void reset () throw( ::com::sun::star::sdbc::SQLException);
- void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
virtual void createTable( ) throw (
::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
@@ -147,11 +166,12 @@ namespace connectivity
// other methods
OConnection* getOwnConnection() const { return m_pConnection;}
- OStatement_Base(OConnection* _pConnection );
- using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+ OCommonStatement(OConnection* _pConnection );
+ using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
// OComponentHelper
- virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
+ virtual void SAL_CALL disposing(void);
+
// XInterface
virtual void SAL_CALL release() throw();
virtual void SAL_CALL acquire() throw();
@@ -177,28 +197,14 @@ namespace connectivity
using OPropertySetHelper::getFastPropertyValue;
};
- class OStatement_BASE2 :public OStatement_Base
- ,public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
-
- {
- friend class OSubComponent<OStatement_BASE2, OStatement_BASE>;
- public:
- OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ),
- ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
- // OComponentHelper
- virtual void SAL_CALL disposing(void);
- // XInterface
- virtual void SAL_CALL release() throw();
- };
-
- class OStatement : public OStatement_BASE2,
+ class OStatement : public OCommonStatement,
public ::com::sun::star::lang::XServiceInfo
{
protected:
~OStatement(){}
public:
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
+ OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){}
DECLARE_SERVICE_INFO();
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
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/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
index 4853a9796898..94dc9387d876 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx
@@ -30,6 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
+
#include "MMozillaBootstrap.hxx"
using namespace com::sun::star::uno;
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
index 180c67a30006..ee983a005920 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
@@ -34,12 +34,13 @@
#include "mozilla_nsinit.h"
+#include <MNSInit.hxx>
+
#include <sal/types.h>
#include <osl/diagnose.h>
#include <osl/conditn.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <MNSInit.hxx>
#ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
#include "MConfigAccess.hxx"
@@ -77,7 +78,8 @@ extern "C" void NS_SetupRegistry();
const PRUnichar* pUsedProfile = *_pValidProfiles;
// have a look what the configuration suggests as preferred profile
- const PRUnichar* pPreferredProfile = static_cast< const PRUnichar* >( getUserProfile( ) );
+ // PRUnichar != sal_Unicode in mingw
+ const PRUnichar* pPreferredProfile = reinterpret_cast_mingw_only< const PRUnichar* >( getUserProfile( ) );
if ( pPreferredProfile && *pPreferredProfile )
{
PRUnichar const* const* pLoop = _pValidProfiles;
@@ -128,7 +130,12 @@ sal_Bool MNS_InitXPCOM(sal_Bool* aProfileExists)
nsCOMPtr<nsILocalFile> binDir;
// Note: if path3 construction fails, mozilla will default to using MOZILLA_FIVE_HOME in the NS_InitXPCOM2()
rtl::OUString path1(
- RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program"));
+#if defined WNT
+ RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program")
+#else
+ RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program")
+#endif
+ );
rtl::Bootstrap::expandMacros(path1);
rtl::OString path2;
if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
index 82d0dc4db693..276f87f43b18 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx
@@ -179,7 +179,8 @@ NS_IMETHODIMP nsProfile::ProfileExists(const PRUnichar *profileName, PRBool *exi
NS_ENSURE_ARG_POINTER(profileName);
NS_ENSURE_ARG_POINTER(exists);
- *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),profileName);
+ // PRUnichar != sal_Unicode in mingw
+ *exists = xMozillaBootstrap->getProfileExists(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
return NS_OK;
}
// Returns the name of the current profile i.e., the last used profile
@@ -463,10 +464,12 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **p
nsresult rv = NS_OK;
- rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),profileName);
+ // PRUnichar != sal_Unicode in mingw
+ rtl::OUString path = xMozillaBootstrap->getProfilePath(xMozillaBootstrap->getCurrentProduct(),reinterpret_cast_mingw_only<const sal_Unicode *>(profileName));
nsCOMPtr<nsILocalFile> localFile;
- nsAutoString filePath(path.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
rv = NS_NewLocalFile(filePath, PR_TRUE,
getter_AddRefs(localFile));
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
index 142da2237daf..a9ab5c015ace 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
@@ -129,7 +129,8 @@ namespace connectivity
nsAutoString path;
nsresult rv = profilePath->GetPath(path);
NS_ENSURE_SUCCESS(rv, ::rtl::OUString());
- return ::rtl::OUString(path.get());
+ // PRUnichar != sal_Unicode in mingw
+ return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(path.get()));
}
else
return ::rtl::OUString();
@@ -170,7 +171,8 @@ namespace connectivity
//step 1 : get mozilla registry file
nsCOMPtr<nsILocalFile> localFile;
::rtl::OUString regDir( getRegistryFileName( MozillaProductType_Mozilla ) );
- nsAutoString registryDir(regDir.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString registryDir(reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()));
rv = NS_NewLocalFile(registryDir, PR_TRUE,
getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv,rv);
@@ -190,7 +192,8 @@ namespace connectivity
//step 3:Enumerator it
rv = registry->GetKey(nsIRegistry::Common,
- szProfileSubtreeString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szProfileSubtreeString.getStr()),
&profilesTreeKey);
if (NS_FAILED(rv)) return rv;
@@ -198,12 +201,14 @@ namespace connectivity
// Get the current profile
rv = registry->GetString(profilesTreeKey,
- szCurrentProfileString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szCurrentProfileString.getStr()),
getter_Copies(tmpCurrentProfile));
if (tmpCurrentProfile)
{
- m_Product.setCurrentProfile ( NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile));
+ // PRUnichar != sal_Unicode in mingw
+ m_Product.setCurrentProfile ( reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile)));
}
@@ -243,7 +248,8 @@ namespace connectivity
nsXPIDLString regData;
rv = registry->GetString(profKey,
- szDirectoryString.getStr(),
+ // PRUnichar != sal_Unicode in mingw
+ reinterpret_cast_mingw_only<const PRUnichar *>(szDirectoryString.getStr()),
getter_Copies(regData));
if (NS_FAILED(rv)) continue;
@@ -257,7 +263,8 @@ namespace connectivity
//Add found profile to profile lists
if (NS_SUCCEEDED(rv) && tempLocal)
{
- ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,NS_STATIC_CAST(const PRUnichar*, profile),tempLocal);
+ // PRUnichar != sal_Unicode in mingw
+ ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, profile)),tempLocal);
m_Product.mProfileList[profileItem->getProfileName()] = profileItem;
}
@@ -330,7 +337,8 @@ namespace connectivity
nsCAutoString filePath(sPath.getStr());
if (isRelative) {
- nsAutoString registryDir( regDir.getStr() );
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString registryDir( reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()) );
nsCOMPtr<nsILocalFile> mAppData;
rv = NS_NewLocalFile(registryDir, PR_TRUE,
getter_AddRefs(mAppData));
@@ -490,7 +498,8 @@ namespace connectivity
if (!path.getLength())
return sal_True;
- nsAutoString filePath(path.getStr());
+ // PRUnichar != sal_Unicode in mingw
+ nsAutoString filePath(reinterpret_cast_mingw_only<const PRUnichar *>(path.getStr()));
nsresult rv;
nsCOMPtr<nsILocalFile> localFile;
diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
index 91f3f273085b..cd098757d7a3 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileManager.cxx
@@ -83,7 +83,8 @@ namespace connectivity
rv = theProfile->GetCurrentProfile(getter_Copies(currentProfileStr));
if (NS_FAILED(rv) || currentProfileStr.get() == nsnull)
return ::rtl::OUString();
- return ::rtl::OUString(currentProfileStr.get());
+ // PRUnichar != sal_Unicode in mingw
+ return ::rtl::OUString(reinterpret_cast_mingw_only<const sal_Unicode *>(currentProfileStr.get()));
}
::rtl::OUString ProfileManager::setCurrentProfile( ::com::sun::star::mozilla::MozillaProductType product, const ::rtl::OUString& profileName ) throw (::com::sun::star::uno::RuntimeException)
{
@@ -102,7 +103,8 @@ namespace connectivity
nsCOMPtr<nsIProfile> theProfile(do_GetService(NS_PROFILE_CONTRACTID,&rv));
if (NS_FAILED(rv)) return ::rtl::OUString();
- const PRUnichar* pUsedProfile = profileName.getStr();
+ // PRUnichar != sal_Unicode in mingw
+ const PRUnichar* pUsedProfile = reinterpret_cast_mingw_only<const PRUnichar *>(profileName.getStr());
//set current profile
rv = theProfile->SetCurrentProfile( pUsedProfile );
if (NS_FAILED(rv)) return ::rtl::OUString();
diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
index 5e4927f811fd..9b4b05868cd2 100644
--- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk
+++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
@@ -44,6 +44,11 @@ USE_DEFFILE=TRUE
ENABLE_EXCEPTIONS=TRUE
VISIBILITY_HIDDEN=TRUE
+.IF "$(OS)" == "OS2"
+all:
+ @echo " Not building under OS/2"
+.ENDIF
+
# --- Settings ----------------------------------
.IF "$(DBGUTIL_OJ)"!=""
ENVCFLAGS+=/FR$(SLO)$/
@@ -88,6 +93,8 @@ SLOFILES += \
$(SLO)$/MNSProfileDirServiceProvider.obj
.ENDIF
+CDEFS += -DMOZILLA_INTERNAL_API
+
.IF "$(GUI)"=="UNX"
.IF "$(COMNAME)"=="sunpro5"
CFLAGS += -features=tmplife
@@ -167,7 +174,7 @@ CFLAGS += -fPIC
CFLAGSCXX += \
-fno-rtti -Wconversion -Wpointer-arith \
-Wcast-align -Woverloaded-virtual -Wsynth \
- -Wno-long-long
+ -Wno-long-long -Wno-deprecated
CDEFS += -DTRACING
.ENDIF
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
index a842c75c7a72..677e605096c4 100644
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -35,7 +35,7 @@ TARGET=mozab
TARGET2=$(TARGET)drv
VISIBILITY_HIDDEN=TRUE
-.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" )
+.IF ( "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || ( "$(OS)" == "MACOSX" ) || ( "$(OS)" == "OS2" )
all:
@echo " Not building the mozilla address book driver"
@echo " dependency to Mozilla developer snapshots not feasable at the moment"
@@ -66,30 +66,32 @@ MOZ_REG_LIB := $(MOZ_LIB)$/mozreg.lib
.IF "$(OS)"=="WNT"
.IF "$(COM)"=="GCC"
-MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core
.ELSE
LIB += $(MOZ_LIB)
-MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib
+MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib
.ENDIF
.ELSE "$(OS)"=="WNT"
-MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s
.ENDIF
#End of mozilla specific stuff.
-# Disable '-z defs' due to broken libxpcom.
-LINKFLAGSDEFS=$(0)
-
USE_DEFFILE=TRUE
ENABLE_EXCEPTIONS=TRUE
VISIBILITY_HIDDEN=TRUE
+.IF "$(OS)"!="WNT"
+COMPONENT_CONFIG_DATA=$(TARGET)2.xcu
+COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs
+.ENDIF
+
# --- Settings ----------------------------------
.IF "$(DBGUTIL_OJ)"!=""
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -98,7 +100,6 @@ ENVCFLAGS+=/FR$(SLO)$/
SLOFILES=\
$(SLO)$/MDriver.obj \
$(SLO)$/MServices.obj
-
# --- MOZAB BASE Library -----------------------------------
@@ -140,7 +141,8 @@ MOZSLOFILES=\
$(SLO)$/MNSINIParser.obj \
$(SLO)$/MNSRunnable.obj \
$(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj
+ $(SLO)$/MNSProfileDirServiceProvider.obj \
+ $(SLO)$/MLdapAttributeMap.obj
SLO2FILES=\
@@ -186,7 +188,7 @@ DEF2NAME= $(SHL2TARGET)
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
# --- filter file ------------------------------
diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu
new file mode 100755
index 000000000000..f47e1708e690
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab.xcu
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:outlook" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Outlook Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:outlookexp" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Microsoft Windows Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:mozilla:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mozilla Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Thunderbird Address Book</value>
+ </prop>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:ldap:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">LDAP Address Book</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="BaseDN" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="MaxRowCount" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>100</value>
+ </prop>
+ </node>
+ <node oor:name="PortNumber" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>389</value>
+ </prop>
+ </node>
+ <node oor:name="UseSSL" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu
new file mode 100755
index 000000000000..41d99391c540
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab2.xcu
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:address:mozilla:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Mozilla Address Book</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:thunderbird:" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">Thunderbird Address Book</value>
+ </prop>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:address:ldap:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.MozabDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">LDAP Address Book</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="BaseDN" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="MaxRowCount" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>100</value>
+ </prop>
+ </node>
+ <node oor:name="PortNumber" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:int">
+ <value>389</value>
+ </prop>
+ </node>
+ <node oor:name="UseSSL" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
index ee637ff763a6..369adf92a6bc 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
@@ -48,10 +48,12 @@
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
+#include <nsIAbDirFactoryService.h>
#include <MNSInit.hxx>
#include <MNameMapper.hxx>
#include "MNSMozabProxy.hxx"
#include <MNSDeclares.hxx>
+
static ::osl::Mutex m_aMetaMutex;
#include <osl/diagnose.h>
@@ -64,6 +66,7 @@ static ::osl::Mutex m_aMetaMutex;
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
#include <unotools/processfactory.hxx>
#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
@@ -86,6 +89,7 @@ using namespace com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace com::sun::star::mozilla;
+using namespace com::sun::star::sdb;
namespace connectivity
{
@@ -341,43 +345,43 @@ static nsresult getSubsFromURI(const rtl::OString& aUri, nsIEnumerator **aSubs)
return retCode ;
}
-void MDatabaseMetaDataHelper::setAbSpecificError( OConnection* _pCon, sal_Bool bGivenURI )
+namespace
{
- if ( ! bGivenURI && m_ProductType ==::com::sun::star::mozilla::MozillaProductType_Mozilla)
- {
- setError( STR_NO_MOZIILA_ADDRESSBOOK );
- }
- else
+ static void lcl_setNoAddressBookFoundError( ErrorDescriptor& _rError, OConnection& _rCon, MozillaProductType _eProductType,
+ sal_Bool bGivenURI )
{
- if ( m_ProductType ==::com::sun::star::mozilla::MozillaProductType_Thunderbird)
+ sal_uInt16 nAddressBookNameRes = 0;
+ if ( !bGivenURI && _eProductType == MozillaProductType_Mozilla)
{
- setError( STR_NO_THUNDERBIRD_ADDRESSBOOK );
+ nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
}
else
{
- if (_pCon->usesFactory())
+ if ( _eProductType == MozillaProductType_Thunderbird )
{
- if ( _pCon->isOutlookExpress() )
- {
- setError( STR_NO_OUTLOOKEXPRESS_ADDRESSBOOK );
- }
- else
- {
- setError( STR_NO_OUTLOOK_ADDRESSBOOK );
- }
+ nAddressBookNameRes = STR_THUNDERBIRD_ADDRESSBOOKS;
}
else
{
- if (_pCon->isLDAP())
+ if ( _rCon.usesFactory() )
{
- setError( STR_COULDNOTCONNECT_TO_LDAP );
+ if ( _rCon.isOutlookExpress() )
+ {
+ nAddressBookNameRes = STR_OE_ADDRESSBOOK;
+ }
+ else
+ {
+ nAddressBookNameRes = STR_OUTLOOK_MAPI_ADDRESSBOOK;
+ }
}
else
{
- setError( STR_NO_MOZIILA_ADDRESSBOOK );
+ OSL_ENSURE( !_rCon.isLDAP(), "lcl_setNoAddressBookFoundError: not to be called for LDAP connections!" );
+ nAddressBookNameRes = STR_MOZILLA_ADDRESSBOOKS;
}
}
}
+ _rError.set( 0, ErrorCondition::AB_ADDRESSBOOK_NOT_FOUND, _rCon.getResources().getResourceString( nAddressBookNameRes ) );
}
}
@@ -521,7 +525,7 @@ sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection*
nsresult rv = NS_OK;
nsCOMPtr<nsIEnumerator> subDirectories;
sal_Int32 nDirectoryType=0;
- m_ProductType=::com::sun::star::mozilla::MozillaProductType_Mozilla;
+ m_ProductType = MozillaProductType_Mozilla;
m_ProfileName = _pCon->getMozProfile();
@@ -530,30 +534,35 @@ sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection*
if (!bGivenURI)
sAbURIString = s_pADDRESSBOOKROOTDIR;
nDirectoryType = SDBCAddress::ThunderBird;
- m_ProductType = ::com::sun::star::mozilla::MozillaProductType_Thunderbird;
+ m_ProductType = MozillaProductType_Thunderbird;
}
- else
- if (!bGivenURI) {
+ else if (!bGivenURI)
+ {
sAbURIString = s_pADDRESSBOOKROOTDIR;
nDirectoryType = SDBCAddress::Mozilla;
}
- else {
- if (_pCon->usesFactory()) {
+ else
+ {
+ if (_pCon->usesFactory())
+ {
nDirectoryType = SDBCAddress::Outlook;
}
- else {
- if (_pCon->isLDAP()) {
+ else
+ {
+ if (_pCon->isLDAP())
+ {
nDirectoryType = SDBCAddress::LDAP;
}
- else {
+ else
+ {
sAbURIString = s_pADDRESSBOOKROOTDIR;
nDirectoryType = SDBCAddress::Mozilla;
}
}
}
- if (!m_bProfileExists)
- {
+ if ( !_pCon->isLDAP() && !m_bProfileExists )
+ { // no need to boot up a Mozilla profile for an LDAP connection
Reference<XMozillaBootstrap> xMozillaBootstrap;
Reference<XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory();
OSL_ENSURE( xFactory.is(), "can't get service factory" );
@@ -572,11 +581,14 @@ sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection*
m_bProfileExists = sal_True;
}
- if ( ( nDirectoryType == SDBCAddress::Mozilla
- || m_ProductType ==::com::sun::star::mozilla::MozillaProductType_Thunderbird)
- && !m_bProfileExists)
+ if ( !m_bProfileExists
+ && !_pCon->isLDAP()
+ && ( ( nDirectoryType == SDBCAddress::Mozilla )
+ || ( nDirectoryType == SDBCAddress::ThunderBird )
+ )
+ )
{
- setAbSpecificError( _pCon, bGivenURI );
+ lcl_setNoAddressBookFoundError( m_aError, *_pCon, m_ProductType, bGivenURI );
return sal_False;
}
@@ -596,11 +608,12 @@ sal_Bool MDatabaseMetaDataHelper::getTableStrings( OConnection*
args.arg5 = (void*)&m_aTableTypes;
args.arg6 = (void*)&nErrorResourceId;
rv = xMProxy.StartProxy(&args,m_ProductType,m_ProfileName);
- setError( static_cast<sal_uInt16>(nErrorResourceId) );
+ m_aError.setResId( static_cast<sal_uInt16>(nErrorResourceId) );
if (NS_FAILED(rv))
{
- setAbSpecificError( _pCon, bGivenURI );
+ if ( nErrorResourceId == 0 )
+ m_aError.setResId( STR_UNSPECIFIED_ERROR );
return sal_False;
}
OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTableStrings()\n" );
@@ -729,7 +742,7 @@ MDatabaseMetaDataHelper::testLDAPConnection( OConnection* _pCon )
osl_waitThread( &timeValue );
}
}
- setError( STR_COULD_NOT_CONNECT_LDAP );
+ m_aError.setResId( STR_COULD_NOT_CONNECT_LDAP );
return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
}
@@ -741,7 +754,7 @@ sal_Bool MDatabaseMetaDataHelper::NewAddressBook(OConnection* _pCon,const ::rtl:
if ( !bIsMozillaAB )
{
- setError( STR_NO_TABLE_CREATION_SUPPORT );
+ m_aError.setResId( STR_NO_TABLE_CREATION_SUPPORT );
return sal_False;
}
else
@@ -760,11 +773,11 @@ sal_Bool MDatabaseMetaDataHelper::NewAddressBook(OConnection* _pCon,const ::rtl:
_pCon->setForceLoadTables(sal_True); //force reload table next time
if (rv == NS_ERROR_FILE_IS_LOCKED)
{
- setError( STR_MOZILLA_IS_RUNNING );
+ m_aError.setResId( STR_MOZILLA_IS_RUNNING );
}
else if (NS_FAILED(rv))
{
- setAbSpecificError( _pCon, !bIsMozillaAB );
+ m_aError.set( STR_COULD_NOT_CREATE_ADDRESSBOOK, 0, ::rtl::OUString::valueOf( sal_Int32(rv), 16 ) );
}
OSL_TRACE( "OUT MDatabaseMetaDataHelper::NewAddressBook()\n" );
return( NS_SUCCEEDED(rv) ? sal_True : sal_False );
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
index 9fcdc90d9a3e..8d2971f3e57f 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
@@ -48,7 +48,7 @@ namespace connectivity
{
namespace mozab
{
- class MDatabaseMetaDataHelper : public ErrorResourceAccess
+ class MDatabaseMetaDataHelper
{
private:
sal_Bool m_bProfileExists ;
@@ -56,6 +56,7 @@ namespace connectivity
::std::vector< ::rtl::OUString > m_aTableTypes;
::com::sun::star::mozilla::MozillaProductType m_ProductType;
::rtl::OUString m_ProfileName;
+ ErrorDescriptor m_aError;
public:
MDatabaseMetaDataHelper();
@@ -73,8 +74,7 @@ namespace connectivity
sal_Bool testLDAPConnection( OConnection* _pCon );
sal_Bool NewAddressBook( OConnection* _pCon,const ::rtl::OUString & aTableName);
- private:
- void setAbSpecificError( OConnection* _pCon, sal_Bool bGivenURI );
+ inline const ErrorDescriptor& getError() const { return m_aError; }
};
}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
index 20a13554c7fa..1a644285f2cb 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MErrorResource.hxx
@@ -31,25 +31,48 @@
#ifndef CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
#define CONNECITIVITY_MOZAB_ERROR_RESOURCE_HXX
-#include <sal/types.h>
+#include <rtl/ustring.hxx>
namespace connectivity
{
namespace mozab
{
- class ErrorResourceAccess
+ class ErrorDescriptor
{
private:
- mutable sal_uInt16 m_nErrorResourceId;
+ sal_uInt16 m_nErrorResourceId;
+ sal_Int32 m_nErrorCondition;
+ ::rtl::OUString m_sParameter;
- protected:
- ErrorResourceAccess() : m_nErrorResourceId(0) { }
-
- inline void setError( sal_uInt16 _nErrorResourceId ) const { const_cast< ErrorResourceAccess* >( this )->m_nErrorResourceId = _nErrorResourceId; }
- inline void resetError( ) const { const_cast< ErrorResourceAccess* >( this )->m_nErrorResourceId = 0; }
public:
- inline sal_uInt16 getErrorResourceId() const
- { return m_nErrorResourceId; }
+ ErrorDescriptor()
+ :m_nErrorResourceId(0)
+ ,m_nErrorCondition(0)
+ ,m_sParameter()
+ {
+ }
+
+ inline void set( const sal_uInt16 _nErrorResourceId, const sal_Int32 _nErrorCondition, const ::rtl::OUString& _rParam )
+ {
+ m_nErrorResourceId = _nErrorResourceId;
+ m_nErrorCondition = _nErrorCondition;
+ m_sParameter = _rParam;
+ }
+ inline void setResId( const sal_uInt16 _nErrorResourceId )
+ {
+ m_nErrorResourceId = _nErrorResourceId;
+ }
+ inline void reset()
+ {
+ m_nErrorResourceId = 0;
+ m_nErrorCondition = 0;
+ }
+
+ inline sal_uInt16 getResId() const { return m_nErrorResourceId; }
+ inline sal_Int32 getErrorCondition() const { return m_nErrorCondition; }
+ inline const ::rtl::OUString& getParameter() const { return m_sParameter; }
+
+ inline bool is() const { return ( m_nErrorResourceId != 0 ) || ( m_nErrorCondition != 0 ); }
};
}
}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
new file mode 100644
index 000000000000..351b5a5992f7
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: code,v $
+*
+* $Revision: 1.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+
+#include <rtl/strbuf.hxx>
+ // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
+ // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
+ // hiding objects "in an outer scope".
+
+#include "MLdapAttributeMap.hxx"
+#include "MTypeConverter.hxx"
+#include "MQueryHelper.hxx"
+
+#include <tools/diagnose_ex.h>
+
+#include <hash_map>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+ //====================================================================
+ //= helper
+ //====================================================================
+ namespace
+ {
+ typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
+ typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
+ struct CardPropertyData
+ {
+ const sal_Char* pLDAPAttributeList;
+ CardPropertyGetter PropGetter;
+ CardPropertySetter PropSetter;
+
+ CardPropertyData()
+ :pLDAPAttributeList( NULL )
+ ,PropGetter( NULL )
+ ,PropSetter( NULL )
+ {
+ }
+ CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
+ :pLDAPAttributeList( _pLDAPAttributeList )
+ ,PropGetter( _PropGetter )
+ ,PropSetter( _PropSetter )
+ {
+ }
+ };
+
+ typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
+
+ #define DEF_CARD_ACCESS( PropertyName ) \
+ &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
+
+ static const MapPropertiesToAttributes& lcl_getPropertyMap()
+ {
+ static MapPropertiesToAttributes aMap;
+ if ( aMap.empty() )
+ {
+ struct MapEntry
+ {
+ const sal_Char* pAsciiPropertyName;
+ const sal_Char* pAsciiAttrributeList;
+ CardPropertyGetter PropGetter;
+ CardPropertySetter PropSetter;
+ };
+ const MapEntry aEntries[] = {
+ { "FirstName", "givenname", DEF_CARD_ACCESS( FirstName ) },
+ { "LastName", "sn,surnname", DEF_CARD_ACCESS( LastName ) },
+ { "DisplayName", "cn,commonname,displayname", DEF_CARD_ACCESS( DisplayName ) },
+ { "NickName", "xmozillanickname", DEF_CARD_ACCESS( NickName ) },
+ { "PrimaryEmail", "mail", DEF_CARD_ACCESS( PrimaryEmail ) },
+ { "SecondEmail", "xmozillasecondemail", DEF_CARD_ACCESS( SecondEmail ) },
+ { "WorkPhone", "telephonenumber", DEF_CARD_ACCESS( WorkPhone ) },
+ { "HomePhone", "homephone", DEF_CARD_ACCESS( HomePhone ) },
+ { "FaxNumber", "fax,facsimiletelephonenumber", DEF_CARD_ACCESS( FaxNumber ) },
+ { "PagerNumber", "pager,pagerphone", DEF_CARD_ACCESS( PagerNumber ) },
+ { "CellularNumber", "mobile,cellphone,carphone", DEF_CARD_ACCESS( CellularNumber ) },
+ { "HomeAddress", "homepostaladdress,mozillaHomeStreet", DEF_CARD_ACCESS( HomeAddress ) },
+ { "HomeAddress2", "mozillaHomeStreet2", DEF_CARD_ACCESS( HomeAddress2 ) },
+ { "HomeCity", "homelocality,mozillaHomeLocalityName", DEF_CARD_ACCESS( HomeCity ) },
+ { "HomeState", "homeregion,mozillaHomeState", DEF_CARD_ACCESS( HomeState ) },
+ { "HomeZipCode", "homepostalcode,mozillaHomePostalCode", DEF_CARD_ACCESS( HomeZipCode ) },
+ { "HomeCountry", "homecountryname,mozillaHomeCountryName", DEF_CARD_ACCESS( HomeCountry ) },
+ { "WorkAddress", "postofficebox,streetaddress,streetaddress1", DEF_CARD_ACCESS( WorkAddress ) },
+ { "WorkAddress2", "streetaddress2", DEF_CARD_ACCESS( WorkAddress2 ) },
+ { "WorkCity", "l,locality", DEF_CARD_ACCESS( WorkCity ) },
+ { "WorkState", "st,region", DEF_CARD_ACCESS( WorkState ) },
+ { "WorkZipCode", "postalcode,zip", DEF_CARD_ACCESS( WorkZipCode ) },
+ { "WorkCountry", "countryname", DEF_CARD_ACCESS( WorkCountry ) },
+ { "JobTitle", "title", DEF_CARD_ACCESS( JobTitle ) },
+ { "Department", "ou,orgunit,department,departmentnumber", DEF_CARD_ACCESS( Department ) },
+ { "Company", "o,company", DEF_CARD_ACCESS( Company ) },
+ { "WebPage1", "workurl", DEF_CARD_ACCESS( WebPage1 ) },
+ { "WebPage2", "homeurl", DEF_CARD_ACCESS( WebPage2 ) },
+ { "BirthYear", "birthyear", DEF_CARD_ACCESS( BirthYear ) },
+ { "BirthMonth", "birthmonth", DEF_CARD_ACCESS( BirthMonth ) },
+ { "BirthYear", "birthday", DEF_CARD_ACCESS( BirthDay ) },
+ { "Custom1", "custom1", DEF_CARD_ACCESS( Custom1 ) },
+ { "Custom2", "custom2", DEF_CARD_ACCESS( Custom2 ) },
+ { "Custom3", "custom3", DEF_CARD_ACCESS( Custom3 ) },
+ { "Custom4", "custom4", DEF_CARD_ACCESS( Custom4 ) },
+ { "Notes", "notes,description", DEF_CARD_ACCESS( Notes ) },
+ { "PreferMailFormat", "xmozillausehtmlmail", NULL, NULL },
+ { NULL, NULL, NULL, NULL }
+ };
+ const MapEntry* loop = aEntries;
+ while ( loop->pAsciiPropertyName )
+ {
+ aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
+ CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
+ ++loop;
+ }
+ }
+ return aMap;
+ }
+ }
+
+ //====================================================================
+ //= AttributeMap_Data
+ //====================================================================
+ struct AttributeMap_Data
+ {
+ };
+
+ //====================================================================
+ //= MLdapAttributeMap
+ //====================================================================
+ // -------------------------------------------------------------------
+ MLdapAttributeMap::MLdapAttributeMap()
+ :m_pData( new AttributeMap_Data )
+ {
+ }
+
+ // -------------------------------------------------------------------
+ MLdapAttributeMap::~MLdapAttributeMap()
+ {
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
+ }
+
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
+ (void)aProperty;
+ (void)aCount;
+ (void)aAttrs;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
+ {
+ ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+ if ( pos == rPropertyMap.end() )
+ {
+ _retval.SetIsVoid( PR_TRUE );
+ }
+ else
+ {
+ sal_Int32 tokenPos(0);
+ ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
+ MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
+ }
+
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
+ (void)aProperty;
+ (void)aAttributeList;
+ (void)allowInconsistencies;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
+ (void)aAttribute;
+ (void)_retval;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
+ {
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+
+ ::rtl::OStringBuffer aAllAttributes;
+ for ( MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
+ loop != rPropertyMap.end();
+ ++loop
+ )
+ {
+ aAllAttributes.append( loop->second.pLDAPAttributeList );
+ if ( loop != rPropertyMap.end() )
+ aAllAttributes.append( ',' );
+ }
+
+ MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
+ {
+ // we do not allow modifying the map, so we're always in a valid state
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
+ {
+ OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
+ (void)aPrefBranchName;
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ // -------------------------------------------------------------------
+ NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
+ {
+ NS_ENSURE_ARG_POINTER( aMessage );
+ NS_ENSURE_ARG_POINTER( aCard );
+
+ // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
+ aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ // split the list of attributes for the current property
+ ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
+ ::rtl::OString sAttribute;
+
+ sal_Int32 tokenPos = 0;
+ while ( tokenPos != -1 )
+ {
+ sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
+
+ // retrieve the values for the current attribute
+ PRUint32 valueCount = 0;
+ PRUnichar** values = NULL;
+ nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
+ if ( NS_FAILED( rv ) )
+ // try the next attribute
+ continue;
+
+ if ( valueCount )
+ {
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ OSL_ENSURE( propSetter,
+ "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
+ "unexpected: could retrieve an attribute value, but have no setter for it!" );
+ if ( propSetter )
+ {
+ (aCard->*propSetter)( values[0] );
+ }
+
+ // we're done with this property - no need to handle the remaining attributes which
+ // map to it
+ break;
+ }
+ }
+ }
+ return NS_OK;
+ }
+
+ // -------------------------------------------------------------------
+ namespace
+ {
+ struct PreferMailFormatType
+ {
+ const sal_Char* description;
+ PRUint32 formatType;
+
+ PreferMailFormatType()
+ :description( NULL )
+ ,formatType( nsIAbPreferMailFormat::unknown )
+ {
+ }
+
+ PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
+ :description( _description )
+ ,formatType( _formatType )
+ {
+ }
+ };
+
+ static const PreferMailFormatType* lcl_getMailFormatTypes()
+ {
+ static const PreferMailFormatType aMailFormatTypes[] =
+ {
+ PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
+ PreferMailFormatType( "text/html", nsIAbPreferMailFormat::html ),
+ PreferMailFormatType( "unknown", nsIAbPreferMailFormat::unknown ),
+ PreferMailFormatType()
+ };
+ return aMailFormatTypes;
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
+ {
+ _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+ ::rtl::OUString resultValue;
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ resultValue = _result.getValue( prop->first );
+
+ CardPropertySetter propSetter = prop->second.PropSetter;
+ if ( propSetter )
+ {
+ // PRUnichar != sal_Unicode in mingw
+ (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
+ unsigned int format = nsIAbPreferMailFormat::unknown;
+ const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+ while ( pMailFormatType->description )
+ {
+ if ( resultValue.equalsAscii( pMailFormatType->description ) )
+ {
+ format = pMailFormatType->formatType;
+ break;
+ }
+ ++pMailFormatType;
+ }
+ _card.SetPreferMailFormat(format);
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
+ }
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
+ {
+ nsXPIDLString value;
+ ::rtl::OUString resultValue;
+
+ const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+ for ( MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+ prop != rPropertyMap.end();
+ ++prop
+ )
+ {
+ CardPropertyGetter propGetter = prop->second.PropGetter;
+ if ( propGetter )
+ {
+ (_card.*propGetter)( getter_Copies( value ) );
+
+ nsAutoString temp( value );
+ MTypeConverter::nsStringToOUString( temp, resultValue );
+ }
+ else
+ {
+ if ( prop->first.equals( "PreferMailFormat" ) )
+ {
+ unsigned int format = nsIAbPreferMailFormat::unknown;
+ _card.GetPreferMailFormat( &format );
+ const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+ while ( pMailFormatType->description )
+ {
+ if ( format == pMailFormatType->formatType )
+ {
+ resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
+ break;
+ }
+ ++pMailFormatType;
+ }
+ }
+ else
+ OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
+ }
+
+ _result.insert( prop->first, resultValue );
+ }
+ }
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
new file mode 100644
index 000000000000..7cf5aa86a252
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: code,v $
+*
+* $Revision: 1.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+
+#include <MNSInclude.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+ struct AttributeMap_Data;
+ class MQueryHelperResultEntry;
+
+ //====================================================================
+ //= class MLdapAttributeMap
+ //====================================================================
+ /** implements the nsIAbLDAPAttributeMap interface
+
+ Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
+ implementation was changed to take the attribute mapping (from LDAP attributes
+ to address book properties) not directly from the preferences. Instead, this mapping
+ is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
+ interface).
+
+ */
+ class MLdapAttributeMap : public nsIAbLDAPAttributeMap
+ {
+ public:
+ MLdapAttributeMap();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIABLDAPATTRIBUTEMAP
+
+ static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
+ static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
+
+ protected:
+ virtual ~MLdapAttributeMap();
+
+ private:
+ ::std::auto_ptr< AttributeMap_Data > m_pData;
+ };
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
+
+#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
index 881878a665f5..a40de061281b 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
@@ -34,6 +34,9 @@
// Only include Mozilla include files once and using this file...
//
+// moved this here and in first position due to "long l;" unxsoli4 warning
+#include <rtl/ustrbuf.hxx>
+
#include "pre_include_mozilla.h"
#if defined __GNUC__
#pragma GCC system_header
@@ -44,6 +47,7 @@
#include <nsCOMPtr.h>
#include <nsISupportsArray.h>
#include <nsString.h>
+
#if defined __SUNPRO_CC
#pragma disable_warn
// somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
@@ -70,6 +74,8 @@
#include <nsIAbDirectoryQueryProxy.h>
#include <nsIAbDirFactory.h>
#include <nsIRunnable.h>
+#include <nsIAbLDAPAttributeMap.h>
+#include <nsILDAPMessage.h>
#include <prerr.h>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
index e0a338835b94..d26c34acbced 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx
@@ -379,7 +379,8 @@ MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPass
messageListener->AddRef();
nsCAutoString nsBind;
- nsBind.AssignWithConversion(sBindDN);
+ // PRUnichar != sal_Unicode in mingw
+ nsBind.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(sBindDN));
// Now lets initialize the LDAP connection properly.
rv = ldapConnection->Init(host.get(), port, useSSL, nsBind,
@@ -395,7 +396,8 @@ MNSMozabProxy::InitLDAP(sal_Char* sUri, sal_Unicode* sBindDN, sal_Unicode* pPass
if ( pPasswd && *pPasswd )
{
nsCAutoString nsPassword;
- nsPassword.AssignWithConversion(pPasswd);
+ // PRUnichar != sal_Unicode in mingw
+ nsPassword.AssignWithConversion(reinterpret_cast_mingw_only<const PRUnichar *>(pPasswd));
rv = ldapOperation->SimpleBind(nsPassword);
}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
index 295231635efd..9ff5aa04fc07 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
@@ -30,14 +30,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
+
#include <MQueryHelper.hxx>
#include <MNameMapper.hxx>
#include <MConnection.hxx>
#include <connectivity/dbexception.hxx>
#include "MQuery.hxx"
-#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_
+#include "MLdapAttributeMap.hxx"
#include "MTypeConverter.hxx"
-#endif
#include "MNSMozabProxy.hxx"
#include <com/sun/star/uno/Reference.hxx>
#include <unotools/processfactory.hxx>
@@ -54,6 +54,7 @@ static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS
static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
+static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID);
using namespace connectivity::mozab;
using namespace connectivity;
@@ -127,7 +128,7 @@ MQuery::~MQuery()
void MQuery::construct()
{
// Set default values. (For now just as a reminder).
- m_aErrorOccurred = sal_False;
+ m_aError.reset();
m_bQuerySubDirs = sal_True; // LDAP Queryies require this to be set!
m_nMaxNrOfReturns = -1; // Unlimited number of returns.
@@ -139,31 +140,6 @@ void MQuery::construct()
NS_IF_ADDREF( m_aQueryHelper);
}
// -------------------------------------------------------------------------
-void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
-{
- OSL_TRACE("IN MQuery::setAttributes()\n");
- ::osl::MutexGuard aGuard( m_aMutex );
-
- m_aAttributes.clear();
- m_aAttributes.reserve(attrs.size());
- ::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
- ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
-
- for ( aIterAttr = attrs.begin(); aIterAttr != attrs.end();++aIterAttr )
- m_aAttributes.push_back( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( *aIterAttr ) );
-
- OSL_TRACE("\tOUT MQuery::setAttributes()\n");
-}
-// -------------------------------------------------------------------------
-const ::std::vector< ::rtl::OUString> &MQuery::getAttributes() const
-{
- OSL_TRACE("IN MQuery::getAttributes()\n");
-
- OSL_TRACE("\tOUT MQuery::getAttributes()\n");
-
- return(m_aAttributes);
-}
-// -------------------------------------------------------------------------
void MQuery::setAddressbook(::rtl::OUString &ab)
{
OSL_TRACE("IN MQuery::setAddressbook()\n");
@@ -253,12 +229,9 @@ static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr,
// Set the 'name' property of the boolString.
// Check if it's an alias first...
- rtl::OUString attrName;
- ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
- attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToAlias( evStr->getName() );
- ::std::string aMiName = MTypeConverter::ouStringToStlString(attrName);
- boolString->SetName(strdup(aMiName.c_str()));
- OSL_TRACE("Name = %s ;", aMiName.c_str() );
+ rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() );
+ boolString->SetName( strdup( attrName.getStr() ) );
+ OSL_TRACE("Name = %s ;", attrName.getStr() );
// Set the 'matchType' property of the boolString. Check for equal length.
sal_Bool requiresValue = sal_True;
switch(evStr->getCond()) {
@@ -459,7 +432,7 @@ sal_Int32 MQuery::commitRow(const sal_Int32 rowIndex)
args.arg2 = (void*)&rowIndex;
args.arg3 = (void*)m_aQueryDirectory->directory;
nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return rv;
}
@@ -476,7 +449,7 @@ sal_Int32 MQuery::deleteRow(const sal_Int32 rowIndex)
args.arg2 = (void*)&rowIndex;
args.arg3 = (void*)m_aQueryDirectory->directory;
nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return rv;
}
@@ -609,8 +582,8 @@ sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
PRInt32 count=1;
nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
-
NS_ENSURE_SUCCESS( rv, rv );
+
rv = arguments->SetExpression(queryExpression);
NS_ENSURE_SUCCESS( rv, rv );
@@ -620,10 +593,14 @@ sal_Int32 MQuery::executeQueryProxied(OConnection* _pCon)
rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
NS_ENSURE_SUCCESS( rv, rv );
+ nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap );
+ rv = arguments->SetTypeSpecificArg( attributeMap );
+ NS_ENSURE_SUCCESS( rv, rv );
+
// Execute the query.
OSL_TRACE( "****** calling DoQuery\n");
- m_aErrorOccurred = sal_False;
+ m_aError.reset();
m_aQueryHelper->reset();
@@ -679,7 +656,7 @@ MQuery::getRealRowCount()
sal_Bool
MQuery::queryComplete( void )
{
- return( m_aErrorOccurred || m_aQueryHelper->queryComplete() );
+ return( hadError() || m_aQueryHelper->queryComplete() );
}
sal_Bool
@@ -687,8 +664,7 @@ MQuery::waitForQueryComplete( void )
{
if( m_aQueryHelper->waitForQueryComplete( ) )
return sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
- m_aErrorOccurred = sal_True;
+ m_aError = m_aQueryHelper->getError();
return( sal_False );
}
@@ -699,8 +675,7 @@ MQuery::checkRowAvailable( sal_Int32 nDBRow )
{
while( !queryComplete() && m_aQueryHelper->getRealCount() <= (sal_uInt32)nDBRow )
if ( !m_aQueryHelper->waitForRow( nDBRow ) ) {
- m_aErrorOccurred = sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return( sal_False );
}
@@ -715,14 +690,13 @@ MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
if (xResEntry == NULL )
{
- m_aErrorOccurred = sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
+ const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
return sal_False;
}
switch ( nType )
{
case DataType::VARCHAR:
- xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ), rValue.getString() );
+ xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() );
break;
default:
OSL_ENSURE( sal_False, "invalid data type!" );
@@ -741,15 +715,14 @@ MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
if (xResEntry == NULL )
{
- m_aErrorOccurred = sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
+ const_cast< MQuery* >( this )->m_aError = m_aQueryHelper->getError();
rValue.setNull();
return sal_False;
}
switch ( nType )
{
case DataType::VARCHAR:
- rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ) );
+ rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
break;
default:
@@ -768,8 +741,7 @@ MQuery::getRowStates(sal_Int32 nDBRow)
OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
if (xResEntry == NULL )
{
- m_aErrorOccurred = sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return RowStates_Error;
}
return xResEntry->getRowStates();
@@ -782,8 +754,7 @@ MQuery::setRowStates(sal_Int32 nDBRow,sal_Int32 aState)
OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
if (xResEntry == NULL )
{
- m_aErrorOccurred = sal_True;
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return sal_False;
}
return xResEntry->setRowStates(aState);
@@ -799,7 +770,7 @@ MQuery::resyncRow(sal_Int32 nDBRow)
args.arg1 = (void*)m_aQueryHelper;
args.arg2 = (void*)&nDBRow;
nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
return NS_SUCCEEDED( rv ) ? sal_True : sal_False;
}
@@ -815,7 +786,7 @@ MQuery::createNewCard()
args.arg2 = (void*)&nNumber;
nsresult rv = xMProxy.StartProxy(&args,m_Product,m_Profile);
- setError( m_aQueryHelper->getErrorResourceId() );
+ m_aError = m_aQueryHelper->getError();
NS_ENSURE_SUCCESS(rv,0);
return nNumber;
}
@@ -834,8 +805,7 @@ MQuery::FreeNameMapper( MNameMapper* _ptr )
delete _ptr;
}
// -------------------------------------------------------------------------
-sal_Bool MQuery::
-isWritable(OConnection* _pCon)
+sal_Bool MQuery::isWritable(OConnection* _pCon)
{
if ( !m_aQueryDirectory )
return sal_False;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
index 75dc59732403..8bf376cde61f 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
@@ -156,7 +156,7 @@ namespace connectivity
};
- class MQuery : public ErrorResourceAccess
+ class MQuery
{
/*
* A query resultset with a maximum limit of
@@ -205,15 +205,16 @@ namespace connectivity
private:
MQueryDirectory *m_aQueryDirectory;
MQueryHelper *m_aQueryHelper;
- ::std::vector< ::rtl::OUString> m_aAttributes;
::rtl::OUString m_aAddressbook;
sal_Int32 m_nMaxNrOfReturns;
sal_Bool m_bQuerySubDirs;
MQueryExpression m_aExpr;
const OColumnAlias& m_rColumnAlias;
- mutable sal_Bool m_aErrorOccurred;
- ::com::sun::star::mozilla::MozillaProductType m_Product;
- ::rtl::OUString m_Profile;
+ ::com::sun::star::mozilla::MozillaProductType
+ m_Product;
+ ::rtl::OUString m_Profile;
+ ErrorDescriptor m_aError;
+
void construct();
protected:
::osl::Mutex m_aMutex;
@@ -238,9 +239,6 @@ namespace connectivity
sal_uInt32 InsertLoginInfo(OConnection* _pCon);
- void setAttributes( ::std::vector< ::rtl::OUString>&);
- const ::std::vector< ::rtl::OUString> &getAttributes(void) const;
-
void setAddressbook( ::rtl::OUString&);
::rtl::OUString getAddressbook(void) const;
@@ -270,8 +268,8 @@ namespace connectivity
sal_Int32 getRowStates(sal_Int32 nDBRow);
sal_Bool setRowStates(sal_Int32 nDBRow,sal_Int32 aState);
- sal_Bool errorOccurred() const
- { return m_aErrorOccurred; };
+ bool hadError() const { return m_aError.is(); }
+ inline const ErrorDescriptor& getError() const { return m_aError; }
public:
// MQuery();
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
index 6e941175b59a..3a1fe97d8311 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
@@ -30,62 +30,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
-#include <MQueryHelper.hxx>
+#include "MQueryHelper.hxx"
#include "MTypeConverter.hxx"
+#include "MConnection.hxx"
+#include "MNSDeclares.hxx"
+#include "MLdapAttributeMap.hxx"
+
#include <connectivity/dbexception.hxx>
-#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
-#include <MConnection.hxx>
-#endif
#include "resource/mozab_res.hrc"
-#include "MNSDeclares.hxx"
using namespace connectivity::mozab;
-enum
-{
- index_FirstName=0,
- index_LastName,
- index_DisplayName,
- index_NickName,
- index_PrimaryEmail,
- index_SecondEmail,
- index_PreferMailFormat,
- index_WorkPhone,
- index_HomePhone,
- index_FaxNumber,
- index_PagerNumber,
- index_CellularNumber,
- index_HomeAddress,
- index_HomeAddress2,
- index_HomeCity,
- index_HomeState,
- index_HomeZipCode,
- index_HomeCountry,
- index_WorkAddress,
- index_WorkAddress2,
- index_WorkCity,
- index_WorkState,
- index_WorkZipCode,
- index_WorkCountry,
- index_JobTitle,
- index_Department,
- index_Company,
- index_WebPage1,
- index_WebPage2,
- index_BirthYear,
- index_BirthMonth,
- index_BirthDay,
- index_Custom1,
- index_Custom2,
- index_Custom3,
- index_Custom4,
- index_Notes
-};
-
-
NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
//
@@ -101,8 +59,6 @@ MQueryHelperResultEntry::MQueryHelperResultEntry()
MQueryHelperResultEntry::~MQueryHelperResultEntry()
{
-
-
OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
@@ -117,39 +73,31 @@ MQueryHelperResultEntry::getCard()
{
return m_Card;
}
-void
-MQueryHelperResultEntry::insert( const rtl::OUString &key, rtl::OUString &value )
+void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value )
{
- m_Fields.insert( fieldMap::value_type( key, value ) );
+ m_Fields[ key ] = value;
}
-rtl::OUString
-MQueryHelperResultEntry::getValue( const rtl::OUString &key ) const
+rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const
{
- fieldMap::const_iterator iter;
-
- iter = m_Fields.find( key );
-
- if ( iter == m_Fields.end() ) {
+ FieldMap::const_iterator iter = m_Fields.find( key );
+ if ( iter == m_Fields.end() )
+ {
return rtl::OUString();
- } else {
- return (*iter).second;
+ }
+ else
+ {
+ return iter->second;
}
}
-rtl::OUString
-MQueryHelperResultEntry::setValue( const rtl::OUString &key, const rtl::OUString & rValue)
+void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue)
{
- m_Fields.erase(key);
- m_Fields.insert( fieldMap::value_type( key, rValue ) );
- return rValue;
+ m_Fields[ key ] = rValue;
}
//
// class MQueryHelper
//
-// MIME-types.
-static char PreferMailFormatTypes[2][11] = {"text/plain",
- "text/html"};
MQueryHelper::MQueryHelper()
:m_nIndex( 0 )
,m_bHasMore( sal_True )
@@ -238,16 +186,16 @@ MQueryHelper::waitForResultOrComplete( )
}
if (times >= 20 && rv == ::osl::Condition::result_timeout ) {
OSL_TRACE("waitForResultOrComplete() : Timeout!");
- setError( STR_TIMEOUT_WAITING );
+ m_aError.setResId( STR_TIMEOUT_WAITING );
return sal_False;
}
if ( isError() ) {
OSL_TRACE("waitForResultOrComplete() : Error returned!");
- setError( STR_ERR_EXECUTING_QUERY );
+ m_aError.setResId( STR_ERR_EXECUTING_QUERY );
return sal_False;
}
- resetError();
+ m_aError.reset();
OSL_TRACE(" Out : waitForResultOrComplete()");
return sal_True;
}
@@ -473,7 +421,7 @@ NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
NS_ENSURE_SUCCESS(rv, rv);
- getCardValues(card);
+ getCardValues(card);
}
nsMemory::Free(name);
@@ -484,56 +432,13 @@ NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
return(NS_OK);
}
+// -----------------------------------------------------------------------------
void MQueryHelper::notifyQueryError()
{
m_bQueryComplete = sal_True ;
notifyResultOrComplete() ;
}
-static const ::rtl::OUString& getAttribute(PRUint32 index)
-{
- static const ::rtl::OUString sAttributeNames[] =
- {
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
- };
- return sAttributeNames[index];
-}
const char * getAddrURI(const nsIAbDirectory* directory)
{
nsresult retCode;
@@ -583,7 +488,7 @@ nsIAbCard * getUpdatedCard( nsIAbCard* card)
#define ENSURE_MOZAB_PROFILE_NOT_LOOKED(directory) \
if (getDirectoryType(directory) == SDBCAddress::Mozilla && isProfileLocked(NULL)) \
{ \
- setError( STR_MOZILLA_IS_RUNNIG_NO_CHANGES ); \
+ m_aError.setResId( STR_MOZILLA_IS_RUNNIG_NO_CHANGES ); \
return sal_False; \
}
@@ -620,7 +525,7 @@ sal_Int32 MQueryHelper::commitCard(const sal_Int32 rowIndex,nsIAbDirectory * dir
}
//We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- setError( STR_FOREIGN_PROCESS_CHANGED_AB );
+ m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
return !(NS_FAILED(rv));
}
@@ -668,7 +573,7 @@ sal_Int32 MQueryHelper::deleteCard(const sal_Int32 rowIndex,nsIAbDirectory * dir
resEntry->setRowStates(RowStates_Deleted);
//We return NS_ERROR_FILE_ACCESS_DENIED in the case the mozillaAB has been changed out side of our process
if (rv == NS_ERROR_FILE_ACCESS_DENIED )
- setError( STR_FOREIGN_PROCESS_CHANGED_AB );
+ m_aError.setResId( STR_FOREIGN_PROCESS_CHANGED_AB );
return !(NS_FAILED(rv));
}
@@ -677,137 +582,17 @@ sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex)
MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
if (!resEntry)
{
- setError( STR_CANT_FIND_ROW );
+ m_aError.setResId( STR_CANT_FIND_ROW );
return sal_False;
}
nsIAbCard *card=resEntry->getCard();
if (!card)
{
- setError( STR_CANT_FIND_CARD_FOR_ROW );
+ m_aError.setResId( STR_CANT_FIND_CARD_FOR_ROW );
return sal_False;
}
- ::rtl::OUString sValue;
-
- getCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
- card->SetFirstName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
- card->SetLastName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
- card->SetDisplayName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
- card->SetNickName(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
- card->SetPrimaryEmail(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
- card->SetSecondEmail(sValue.getStr());
-
- unsigned int format;
- ::rtl::OUString prefMailValue;
- getCardAttributeAndValue(getAttribute(index_WorkPhone),prefMailValue,resEntry);
- for(format=2;format >0;format--)
- {
- if (! prefMailValue.compareTo(
- ::rtl::OUString::createFromAscii(PreferMailFormatTypes[format-1]) ) )
- break;
- }
- card->SetPreferMailFormat(format);
-
- getCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
- card->SetWorkPhone(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
- card->SetHomePhone(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
- card->SetFaxNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
- card->SetPagerNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
- card->SetCellularNumber(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
- card->SetHomeAddress(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
- card->SetHomeAddress2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
- card->SetHomeCity(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
- card->SetHomeState(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
- card->SetHomeZipCode(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
- card->SetHomeCountry(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
- card->SetWorkAddress(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
- card->SetWorkAddress2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
- card->SetWorkCity(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
- card->SetWorkState(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
- card->SetWorkZipCode(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
- card->SetWorkCountry(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
- card->SetJobTitle(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
- card->SetDepartment(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
- card->SetCompany(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
- card->SetWebPage1(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
- card->SetWebPage2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
- card->SetBirthYear(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
- card->SetBirthMonth(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
- card->SetBirthDay(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
- card->SetCustom1(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
- card->SetCustom2(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
- card->SetCustom3(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
- card->SetCustom4(sValue.getStr());
-
- getCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
- card->SetNotes(sValue.getStr());
-
+ MLdapAttributeMap::fillCardFromResult( *card, *resEntry );
return sal_True;
}
@@ -821,142 +606,7 @@ void MQueryHelper::getCardValues(nsIAbCard *card,sal_Int32 rowIndex)
else
resEntry = new MQueryHelperResultEntry();
- nsXPIDLString sValue;
-
- card->GetFirstName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
-
- card->GetLastName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
-
- card->GetDisplayName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
-
- card->GetNickName(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
-
- card->GetPrimaryEmail(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
-
- card->GetSecondEmail(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
-
- unsigned int format = 0;
- card->GetPreferMailFormat(&format);
- ::rtl::OUString prefMailValue;
- switch(format)
- {
- case nsIAbPreferMailFormat::html:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[1]);
- break;
- case nsIAbPreferMailFormat::plaintext:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
- break;
- case nsIAbPreferMailFormat::unknown:
- default:
- prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
- break;
-
- }
- resEntry->insert( getAttribute(index_PreferMailFormat), prefMailValue );
-
- card->GetWorkPhone(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
-
- card->GetHomePhone(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
-
- card->GetFaxNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
-
- card->GetPagerNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
-
- card->GetCellularNumber(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
-
- card->GetHomeAddress(getter_Copies(sValue));
- PRInt32 offset;
- nsXPIDLString space;
- space.Assign(NS_LITERAL_STRING(" "));
- while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
- while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
- addCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
-
- card->GetHomeAddress2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
-
- card->GetHomeCity(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
-
- card->GetHomeState(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
-
- card->GetHomeZipCode(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
-
- card->GetHomeCountry(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
-
- card->GetWorkAddress(getter_Copies(sValue));
- while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
- while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
- addCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
-
- card->GetWorkAddress2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
-
- card->GetWorkCity(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
-
- card->GetWorkState(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
-
- card->GetWorkZipCode(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
-
- card->GetWorkCountry(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
-
- card->GetJobTitle(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
-
- card->GetDepartment(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
-
- card->GetCompany(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
-
- card->GetWebPage1(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
-
- card->GetWebPage2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
-
- card->GetBirthYear(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
-
- card->GetBirthMonth(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
-
- card->GetBirthDay(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
-
- card->GetCustom1(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
-
- card->GetCustom2(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
-
- card->GetCustom3(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
-
- card->GetCustom4(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
-
- card->GetNotes(getter_Copies(sValue));
- addCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
-
+ MLdapAttributeMap::fillResultFromCard( *resEntry, *card );
resEntry->setCard(card);
if (!rowIndex)
append( resEntry );
@@ -967,7 +617,7 @@ sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex)
MQueryHelperResultEntry *resEntry = getByIndex(rowIndex);
if (!resEntry)
{
- setError( STR_CANT_FIND_ROW );
+ m_aError.setResId( STR_CANT_FIND_ROW );
return sal_False;
}
nsIAbCard *card=resEntry->getCard();
@@ -975,21 +625,8 @@ sal_Bool MQueryHelper::resyncRow(sal_Int32 rowIndex)
getCardValues(card,rowIndex);
return sal_True;
}
-void MQueryHelper::addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString Value, MQueryHelperResultEntry *resEntry)
-{
- nsAutoString temp(Value) ;
- ::rtl::OUString attrValue;
- MTypeConverter::nsStringToOUString( temp, attrValue );
- resEntry->insert( sName, attrValue );
-}
-
-void MQueryHelper::getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry)
-{
- ouValue = resEntry->getValue( sName);
-}
-
// -------------------------------------------------------------------------
-sal_Int32 MQueryHelper::createNewCard()
+sal_Int32 MQueryHelper::createNewCard()
{
::osl::MutexGuard aGuard( m_aMutex );
nsresult rv;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
index a077b26f0bab..c08a110a04c0 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
@@ -40,6 +40,8 @@
#include <comphelper/stl_types.hxx>
#include <osl/thread.hxx>
+#include <hash_map>
+
namespace connectivity
{
namespace mozab
@@ -47,20 +49,20 @@ namespace connectivity
class MQueryHelperResultEntry
{
private:
- mutable ::osl::Mutex m_aMutex;
+ typedef ::std::hash_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap;
- DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,fieldMap);
+ mutable ::osl::Mutex m_aMutex;
+ FieldMap m_Fields;
+ nsCOMPtr<nsIAbCard> m_Card;
+ sal_Int32 m_RowStates;
- fieldMap m_Fields;
- nsCOMPtr<nsIAbCard> m_Card;
- sal_Int32 m_RowStates;
public:
MQueryHelperResultEntry();
~MQueryHelperResultEntry();
- void insert( const rtl::OUString &key, rtl::OUString &value );
- rtl::OUString getValue( const rtl::OUString &key ) const;
- rtl::OUString setValue( const rtl::OUString &key, const rtl::OUString & rValue);
+ void insert( const rtl::OString &key, rtl::OUString &value );
+ rtl::OUString getValue( const rtl::OString &key ) const;
+ void setValue( const rtl::OString &key, const rtl::OUString & rValue);
void setCard(nsIAbCard *card);
nsIAbCard *getCard();
@@ -68,7 +70,7 @@ namespace connectivity
sal_Int32 getRowStates() { return m_RowStates;};
};
- class MQueryHelper : public nsIAbDirectoryQueryResultListener, public ErrorResourceAccess
+ class MQueryHelper : public nsIAbDirectoryQueryResultListener
{
private:
typedef std::vector< MQueryHelperResultEntry* > resultsArray;
@@ -81,6 +83,7 @@ namespace connectivity
sal_Bool m_bAtEnd;
sal_Bool m_bErrorCondition;
sal_Bool m_bQueryComplete;
+ ErrorDescriptor m_aError;
void append(MQueryHelperResultEntry* resEnt );
@@ -89,8 +92,6 @@ namespace connectivity
void clearResultOrComplete();
void notifyResultOrComplete();
sal_Bool waitForResultOrComplete( );
- void addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString sValue,MQueryHelperResultEntry *resEntry);
- void getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry) ;
void getCardValues(nsIAbCard *card,sal_Int32 rowIndex=0);
#if OSL_DEBUG_LEVEL > 0
oslThreadIdentifier m_oThreadID;
@@ -113,6 +114,8 @@ namespace connectivity
MQueryHelperResultEntry* getByIndex( sal_uInt32 nRow );
+ const ErrorDescriptor& getError() const { return m_aError; }
+
sal_Bool isError() const;
sal_Bool hasMore() const;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
index 129cf2d770f5..2a6f79f5acd7 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
@@ -51,6 +51,32 @@ void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &ns
nss = mozString; // temp.
}
// -------------------------------------------------------------------------
+::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source )
+{
+ const char* buffer = _source.BeginReading();
+ const char* bufferEnd = _source.EndReading();
+ return ::rtl::OUString( buffer, static_cast<sal_Int32>(bufferEnd - buffer), RTL_TEXTENCODING_ASCII_US );
+}
+// -------------------------------------------------------------------------
+::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source )
+{
+ const char* buffer = _source.BeginReading();
+ const char* bufferEnd = _source.EndReading();
+ return ::rtl::OString( buffer, static_cast<sal_Int32>(bufferEnd - buffer) );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest )
+{
+ ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
+ asciiToNsACString( sAsciiVersion.getStr(), _dest );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest )
+{
+ _dest.Truncate();
+ _dest.AppendASCII( _asciiString );
+}
+// -------------------------------------------------------------------------
void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
{
// Get clone of buffer.
@@ -58,7 +84,8 @@ void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ou
sal_Int32 nssLen = nss.Length();
// TODO check if this is ok.
- ::rtl::OUString _ous(uc, nssLen);
+ // PRUnichar != sal_Unicode in mingw
+ ::rtl::OUString _ous(reinterpret_cast_mingw_only<sal_Unicode *>(uc), nssLen);
ous = _ous;
nsMemory::Free(uc);
@@ -67,7 +94,8 @@ void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ou
void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous)
{
// TODO, specify length.
- ::rtl::OUString _ous(pru);
+ // PRUnichar != sal_Unicode in mingw
+ ::rtl::OUString _ous(reinterpret_cast_mingw_only<const sal_Unicode *>(pru));
ous = _ous;
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
index 792934ee1229..dab5af9645df 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
@@ -54,6 +54,11 @@ namespace connectivity
static ::std::string ouStringToStlString(const ::rtl::OUString&);
static ::std::string nsStringToStlString(const nsString&);
+ static ::rtl::OUString nsACStringToOUString( const nsACString& _source );
+ static ::rtl::OString nsACStringToOString( const nsACString& _source );
+ static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest );
+ static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest );
+
private:
MTypeConverter() {};
};
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
index 764081619770..e31d4c7e412b 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
@@ -52,7 +52,7 @@ ENVCFLAGS+=/FR$(SLO)$/
.INCLUDE : settings.mk
-.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO"
+.IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || "$(OS)" == "OS2"
dummy:
@echo " Not building the mozillasrc stuff in OpenOffice.org build"
@echo " dependency to Mozilla developer snapshots not feasable at the moment"
@@ -71,10 +71,13 @@ SLOFILES = \
$(SLO)$/MQuery.obj \
$(SLO)$/MTypeConverter.obj \
$(SLO)$/MNameMapper.obj \
- $(SLO)$/MNSMozabProxy.obj \
- $(SLO)$/MNSTerminateListener.obj
+ $(SLO)$/MNSMozabProxy.obj \
+ $(SLO)$/MNSTerminateListener.obj \
+ $(SLO)$/MLdapAttributeMap.obj \
+CDEFS += -DMOZILLA_INTERNAL_API
+
.IF "$(GUI)"=="UNX"
.IF "$(COMNAME)"=="sunpro5"
CFLAGS += -features=tmplife
@@ -154,7 +157,7 @@ CFLAGS += -fPIC
CFLAGSCXX += \
-fno-rtti -Wconversion -Wpointer-arith \
-Wcast-align -Woverloaded-virtual -Wsynth \
- -Wno-long-long
+ -Wno-long-long -Wno-deprecated
CDEFS += -DTRACING
.ENDIF
.ENDIF
diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h
index 3de12f1122bc..25af3fb86d7d 100644
--- a/connectivity/source/drivers/mozab/post_include_mozilla.h
+++ b/connectivity/source/drivers/mozab/post_include_mozilla.h
@@ -47,3 +47,15 @@
#define _DEBUG _DEBUG_WAS_DEFINED
#endif
+#ifndef _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
+#define _CONNECTIVITY_MOZILLA_REINTERPRET_CAST_MINGW_ONLY_
+
+#ifdef __cplusplus
+#ifdef __MINGW32__
+template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return reinterpret_cast<T1>(p); }
+#else
+template<class T1, class T2> T1 inline reinterpret_cast_mingw_only(T2 p) { return p; }
+#endif
+#endif
+
+#endif
diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h
index 50f3848e4059..b175f654d345 100644
--- a/connectivity/source/drivers/mozab/pre_include_mozilla.h
+++ b/connectivity/source/drivers/mozab/pre_include_mozilla.h
@@ -38,18 +38,28 @@
// Turn off DEBUG Assertions
#ifdef _DEBUG
#define _DEBUG_WAS_DEFINED _DEBUG
- #undef _DEBUG
+ #ifndef MOZILLA_ENABLE_DEBUG
+ #undef _DEBUG
+ #endif
#else
#undef _DEBUG_WAS_DEFINED
+ #ifdef MOZILLA_ENABLE_DEBUG
+ #define _DEBUG 1
+ #endif
#endif
// and turn off the additional virtual methods which are part of some interfaces when compiled
// with debug
#ifdef DEBUG
#define DEBUG_WAS_DEFINED DEBUG
- #undef DEBUG
+ #ifndef MOZILLA_ENABLE_DEBUG
+ #undef DEBUG
+ #endif
#else
#undef DEBUG_WAS_DEFINED
+ #ifdef MOZILLA_ENABLE_DEBUG
+ #define DEBUG 1
+ #endif
#endif
#if defined __GNUC__
diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx
index dcee418b88e5..ea5afad3719e 100644
--- a/connectivity/source/drivers/mysql/YDriver.cxx
+++ b/connectivity/source/drivers/mysql/YDriver.cxx
@@ -193,7 +193,7 @@ namespace connectivity
else
{
aProps.push_back( PropertyValue(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NewURL"))
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PublicConnectionURL"))
,0
,makeAny(_sUrl)
,PropertyState_DIRECT_VALUE) );
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/mysql/makefile.mk b/connectivity/source/drivers/mysql/makefile.mk
index 9a24864a9bba..0d46f0c35dbb 100644
--- a/connectivity/source/drivers/mysql/makefile.mk
+++ b/connectivity/source/drivers/mysql/makefile.mk
@@ -42,7 +42,7 @@ VISIBILITY_HIDDEN=TRUE
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
@@ -83,6 +83,6 @@ DEF1EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu
new file mode 100755
index 000000000000..a3babe090bf4
--- /dev/null
+++ b/connectivity/source/drivers/mysql/mysql.xcu
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:mysql:jdbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>org.openoffice.comp.drivers.MySQL.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (JDBC)</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="JavaDriverClass" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>com.mysql.jdbc.Driver</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseJava" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:mysql:odbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>org.openoffice.comp.drivers.MySQL.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (ODBC)</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ <node oor:name="sdbc:mysql:mysqlc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>org.openoffice.comp.drivers.MySQL.Driver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">MySQL (Native)</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="LocalSocket" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="NamedPipe" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk
index f84f2a725d67..8f37b6185d5e 100644
--- a/connectivity/source/drivers/odbc/makefile.mk
+++ b/connectivity/source/drivers/odbc/makefile.mk
@@ -45,7 +45,7 @@ LDUMP=ldump2.exe
ENVCFLAGS+=/FR$(SLO)$/
.ENDIF
-.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/makefile.pmk
.INCLUDE : $(PRJ)$/version.mk
.IF "$(SYSTEM_ODBC_HEADERS)" == "YES"
@@ -79,4 +79,4 @@ SHL1VERSIONMAP=odbc.map
# --- Targets ----------------------------------
-.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/target.pmk
diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu
new file mode 100755
index 000000000000..cf306f10d57f
--- /dev/null
+++ b/connectivity/source/drivers/odbc/odbc.xcu
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataAccess.xcu,v $
+ * $Revision: 1.27 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="Drivers" oor:package="org.openoffice.Office.DataAccess" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <node oor:name="Installed">
+ <node oor:name="sdbc:odbc:*" oor:op="replace">
+ <prop oor:name="Driver">
+ <value>com.sun.star.comp.sdbc.ODBCDriver</value>
+ </prop>
+ <prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
+ <value xml:lang="en-US">ODBC</value>
+ </prop>
+ <node oor:name="Properties">
+ <node oor:name="CharSet" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="SystemDriverSettings" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalog" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AutoIncrementCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="AutoRetrievingStatement" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value></value>
+ </prop>
+ </node>
+ <node oor:name="IsAutoRetrievingEnabled" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>false</value>
+ </prop>
+ </node>
+ <node oor:name="AddIndexAppendix" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="Features">
+ <node oor:name="GeneratedValues" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSQL92NamingConstraints" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="AppendTableAliasInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseKeywordAsBeforeAlias" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseBracketedOuterJoinSyntax" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="IgnoreDriverPrivileges" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="ParameterNameSubstitution" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="DisplayVersionColumns" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseCatalogInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseSchemaInSelect" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseIndexDirectionKeyword" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="UseDOSLineEnds" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="BooleanComparisonMode" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="FormsCheckRequiredFields" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="EscapeDateTime" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ </node>
+ <node oor:name="MetaData">
+ <node oor:name="SupportsTableCreation" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="SupportsBrowsing" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:boolean">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Authentication" oor:op="replace">
+ <prop oor:name="Value" oor:type="xs:string">
+ <value>UserPassword</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
index 40a14531553c..8a27940f44b0 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,11 +105,10 @@ 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];
- SWORD cbConnStrOut;
+ SQLSMALLINT cbConnStrOut;
memset(szConnStrOut,'\0',4096);
memset(szConnStrIn,'\0',2048);
::rtl::OString aConStr(::rtl::OUStringToOString(aConnectStr,getTextEncoding()));
@@ -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..8d72c3271b82 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;
}
}
@@ -446,11 +444,11 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
checkParameterIndex(parameterIndex);
sal_Int8* lenBuf = getLengthBuf (parameterIndex);
- *(SDWORD*)lenBuf = SQL_NULL_DATA;
+ *(SQLLEN*)lenBuf = SQL_NULL_DATA;
- SQLINTEGER prec = 0;
- SQLUINTEGER nColumnSize = 0;
+ SQLLEN prec = 0;
+ SQLULEN nColumnSize = 0;
if (sqlType == SQL_CHAR || sqlType == SQL_VARCHAR || sqlType == SQL_LONGVARCHAR)
{
prec = 1;
@@ -476,7 +474,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
nDecimalDigits,
NULL,
prec,
- (SDWORD*)lenBuf
+ (SQLLEN*)lenBuf
);
OTools::ThrowException(m_pConnection,nReturn,m_aStatementHandle,SQL_HANDLE_STMT,*this);
}
@@ -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;
@@ -861,7 +865,7 @@ void OPreparedStatement::setStream (
// Bind the parameter with SQL_LEN_DATA_AT_EXEC
SQLSMALLINT Ctype = SQL_C_CHAR;
- SDWORD atExec = SQL_LEN_DATA_AT_EXEC (length);
+ SQLLEN atExec = SQL_LEN_DATA_AT_EXEC (length);
memcpy (dataBuf, &ParameterIndex, sizeof(ParameterIndex));
memcpy (lenBuf, &atExec, sizeof (atExec));
@@ -872,14 +876,14 @@ void OPreparedStatement::setStream (
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
N3SQLBindParameter(m_aStatementHandle,
(SQLUSMALLINT)ParameterIndex,
- (SQLSMALLINT)SQL_PARAM_INPUT,
+ (SQLUSMALLINT)SQL_PARAM_INPUT,
Ctype,
(SQLSMALLINT)SQLtype,
- (SQLUINTEGER)length,
+ (SQLULEN)length,
0,
dataBuf,
sizeof(ParameterIndex),
- (SDWORD*)lenBuf);
+ (SQLLEN*)lenBuf);
// Save the input stream
boundParams[ParameterIndex - 1].setInputStream (x, length);
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index 4ff581eed299..8c885f0924ad 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)
@@ -843,8 +843,8 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- SQLSMALLINT nMaxLen = 20;
- SQLINTEGER nRealLen = 0;
+ SQLLEN nMaxLen = 20;
+ SQLLEN nRealLen = 0;
Sequence<sal_Int8> aBookmark(nMaxLen);
SQLRETURN nRet = N3SQLBindCol(m_aStatementHandle,
@@ -925,7 +925,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
sal_Bool bPositionByBookmark = ( NULL != getOdbcFunction( ODBC3SQLBulkOperations ) );
if ( bPositionByBookmark )
{
- SQLINTEGER nRealLen = 0;
+ SQLLEN nRealLen = 0;
nRet = N3SQLBindCol(m_aStatementHandle,
0,
SQL_C_VARBOOKMARK,
@@ -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..3397c5c515a9 100644
--- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
@@ -86,13 +86,13 @@ OResultSetMetaData::~OResultSetMetaData()
return sValue;
}
// -------------------------------------------------------------------------
-SWORD OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
+SQLLEN OResultSetMetaData::getNumColAttrib(OConnection* _pConnection
,SQLHANDLE _aStatementHandle
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
,sal_Int32 _column
,sal_Int32 _ident) throw(SQLException, RuntimeException)
{
- SWORD nValue=0;
+ SQLLEN nValue=0;
OTools::ThrowException(_pConnection,(*(T3SQLColAttribute)_pConnection->getOdbcFunction(ODBC3SQLColAttribute))(_aStatementHandle,
(SQLUSMALLINT)_column,
(SQLUSMALLINT)_ident,
@@ -117,49 +117,55 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE);
}
// -------------------------------------------------------------------------
-SWORD OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
+SQLSMALLINT OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
,SQLHANDLE _aStatementHandle
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface
,sal_Int32 column)
throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
- SWORD nType = 0;
+ SQLSMALLINT nType = 0;
try
{
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
+ nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
if(nType == SQL_UNKNOWN_TYPE)
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
+ nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
}
catch(SQLException& ) // in this case we have an odbc 2.0 driver
{
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE );
+ nType = (SQLSMALLINT)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/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx
index 16756052d571..79fbef9db50e 100644
--- a/connectivity/source/drivers/odbcbase/OStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OStatement.cxx
@@ -94,7 +94,17 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection )
osl_incrementInterlockedCount( &m_refCount );
m_pConnection->acquire();
m_aStatementHandle = m_pConnection->createStatementHandle();
- setMaxFieldSize(0);
+
+ //setMaxFieldSize(0);
+ // Don't do this. By ODBC spec, "0" is the default for the SQL_ATTR_MAX_LENGTH attribute. We once introduced
+ // this line since an PostgreSQL ODBC driver had a default other than 0. However, current drivers (at least 8.3
+ // and later) have a proper default of 0, so there should be no need anymore.
+ // On the other hand, the NotesSQL driver (IBM's ODBC driver for the Lotus Notes series) wrongly interprets
+ // "0" as "0", whereas the ODBC spec says it should in fact mean "unlimited".
+ // So, removing this line seems to be the best option for now.
+ // If we ever again encounter a ODBC driver which needs this option, then we should introduce a data source
+ // setting for it, instead of unconditionally doing it.
+
osl_decrementInterlockedCount( &m_refCount );
}
// -----------------------------------------------------------------------------
@@ -250,13 +260,13 @@ void OStatement_Base::clearMyResultSet () throw (SQLException)
m_xResultSet = Reference< XResultSet >();
}
//--------------------------------------------------------------------
-sal_Int32 OStatement_Base::getRowCount () throw( SQLException)
+SQLLEN OStatement_Base::getRowCount () throw( SQLException)
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- sal_Int32 numRows = 0;
+ SQLLEN numRows = 0;
try {
THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
@@ -523,7 +533,9 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException,
SQLRETURN nError = N3SQLMoreResults(m_aStatementHandle);
if(nError == SQL_SUCCESS)
{
- N3SQLRowCount(m_aStatementHandle,&pArray[j]);
+ SQLLEN nRowCount=0;
+ N3SQLRowCount(m_aStatementHandle,&nRowCount);
+ pArray[j] = nRowCount;
}
}
return aRet;
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
index ce03fa325019..39c848f34eaf 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -37,6 +37,8 @@
#include "odbc/OConnection.hxx"
#include "diagnose_ex.h"
#include <rtl/logfile.hxx>
+#include <rtl/ustrbuf.hxx>
+
#include <string.h>
#include <string>
@@ -54,16 +56,16 @@ void OTools::getValue( OConnection* _pConnection,
sal_Bool &_bWasNull,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
void* _pValue,
- SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+ SQLLEN _nSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getValue" );
- SQLINTEGER pcbValue = SQL_NULL_DATA;
+ SQLLEN pcbValue = SQL_NULL_DATA;
OTools::ThrowException(_pConnection,
(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
(SQLUSMALLINT)columnIndex,
_nType,
_pValue,
- (SQLINTEGER)_rSize,
+ _nSize,
&pcbValue),
_aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False);
_bWasNull = pcbValue == SQL_NULL_DATA;
@@ -84,12 +86,12 @@ void OTools::bindParameter( OConnection* _pConnection,
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::bindParameter" );
SQLRETURN nRetcode;
- SWORD fSqlType;
- SWORD fCType;
- SDWORD nMaxLen = 0;
+ SQLSMALLINT fSqlType;
+ SQLSMALLINT fCType;
+ SQLLEN nMaxLen = 0;
// void*& pData = pDataBuffer;
- SQLINTEGER* pLen = (SQLINTEGER*)pLenBuffer;
- SQLUINTEGER nColumnSize=0;
+ SQLLEN* pLen = (SQLLEN*)pLenBuffer;
+ SQLULEN nColumnSize=0;
SQLSMALLINT nDecimalDigits=0;
OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nODBCtype,fCType,fSqlType);
@@ -121,10 +123,10 @@ void OTools::bindParameter( OConnection* _pConnection,
void OTools::bindData( SQLSMALLINT _nOdbcType,
sal_Bool _bUseWChar,
sal_Int8 *&_pData,
- SQLINTEGER*& pLen,
+ SQLLEN*& pLen,
const void* _pValue,
rtl_TextEncoding _nTextEncoding,
- SQLUINTEGER& _nColumnSize)
+ SQLULEN& _nColumnSize)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::bindData" );
_nColumnSize = 0;
@@ -220,7 +222,7 @@ void OTools::bindData( SQLSMALLINT _nOdbcType,
{
sal_Int32 nLen = 0;
nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
- *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
}
break;
case SQL_LONGVARCHAR:
@@ -233,21 +235,21 @@ void OTools::bindData( SQLSMALLINT _nOdbcType,
::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
nLen = aString.getLength();
}
- *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
} break;
case SQL_DATE:
*(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue;
- *pLen = (SDWORD)sizeof(DATE_STRUCT);
+ *pLen = (SQLLEN)sizeof(DATE_STRUCT);
_nColumnSize = 10;
break;
case SQL_TIME:
*(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue;
- *pLen = (SDWORD)sizeof(TIME_STRUCT);
+ *pLen = (SQLLEN)sizeof(TIME_STRUCT);
_nColumnSize = 8;
break;
case SQL_TIMESTAMP:
*(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue;
- *pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT);
+ *pLen = (SQLLEN)sizeof(TIMESTAMP_STRUCT);
_nColumnSize = 19;
break;
}
@@ -260,7 +262,7 @@ void OTools::bindValue( OConnection* _pConnection,
SQLSMALLINT _nMaxLen,
const void* _pValue,
void* _pData,
- SQLINTEGER *pLen,
+ SQLLEN *pLen,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
rtl_TextEncoding _nTextEncoding,
sal_Bool _bUseOldTimeDate) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
@@ -269,7 +271,7 @@ void OTools::bindValue( OConnection* _pConnection,
SQLRETURN nRetcode;
SQLSMALLINT fSqlType;
SQLSMALLINT fCType;
- SQLSMALLINT nMaxLen = _nMaxLen;
+ SQLLEN nMaxLen = _nMaxLen;
OTools::getBindTypes( sal_False,
_bUseOldTimeDate,
@@ -373,7 +375,7 @@ void OTools::bindValue( OConnection* _pConnection,
_pData = (void*)(columnIndex);
sal_Int32 nLen = 0;
nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
- *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
}
break;
case SQL_LONGVARCHAR:
@@ -381,7 +383,7 @@ void OTools::bindValue( OConnection* _pConnection,
_pData = (void*)(columnIndex);
sal_Int32 nLen = 0;
nLen = ((::rtl::OUString*)_pValue)->getLength();
- *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen);
} break;
case SQL_DATE:
*pLen = sizeof(DATE_STRUCT);
@@ -444,10 +446,10 @@ void OTools::ThrowException(OConnection* _pConnection,
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::ThrowException" );
SDB_ODBC_CHAR szSqlState[5];
- SDWORD pfNativeError;
+ SQLINTEGER pfNativeError;
SDB_ODBC_CHAR szErrorMessage[SQL_MAX_MESSAGE_LENGTH];
szErrorMessage[0] = '\0';
- SWORD pcbErrorMsg = 0;
+ SQLSMALLINT pcbErrorMsg = 0;
// Informationen zur letzten Operation:
// wenn hstmt != SQL_NULL_HSTMT ist (Benutzung von SetStatus in SdbCursor, SdbTable, ...),
@@ -476,7 +478,7 @@ void OTools::ThrowException(OConnection* _pConnection,
Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
SQLHANDLE _aStatementHandle,
sal_Int32 columnIndex,
- SWORD _fSqlType,
+ SQLSMALLINT _fSqlType,
sal_Bool &_bWasNull,
const Reference< XInterface >& _xInterface) throw(SQLException, RuntimeException)
{
@@ -484,14 +486,14 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
char aCharArray[2048];
// Erstmal versuchen, die Daten mit dem kleinen Puffer
// abzuholen:
- SQLINTEGER nMaxLen = sizeof aCharArray - 1;
+ SQLLEN nMaxLen = sizeof aCharArray - 1;
// GETDATA(SQL_C_CHAR,aCharArray,nMaxLen);
- SQLINTEGER pcbValue = 0;
+ SQLLEN pcbValue = 0;
OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
(SQLUSMALLINT)columnIndex,
_fSqlType,
(SQLPOINTER)aCharArray,
- (SQLINTEGER)nMaxLen,
+ nMaxLen,
&pcbValue),
_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
@@ -538,13 +540,13 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
::rtl::OUString OTools::getStringValue(OConnection* _pConnection,
SQLHANDLE _aStatementHandle,
sal_Int32 columnIndex,
- SWORD _fSqlType,
+ SQLSMALLINT _fSqlType,
sal_Bool &_bWasNull,
const Reference< XInterface >& _xInterface,
rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getStringValue" );
- ::rtl::OUString aData;
+ ::rtl::OUStringBuffer aData;
switch(_fSqlType)
{
case SQL_WVARCHAR:
@@ -553,15 +555,15 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
{
sal_Unicode waCharArray[2048];
// read the unicode data
- sal_Int32 nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1;
+ SQLLEN nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1;
// GETDATA(SQL_C_WCHAR, waCharArray, nMaxLen + sizeof(sal_Unicode));
- SQLINTEGER pcbValue=0;
+ SQLLEN pcbValue=0;
OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
(SQLUSMALLINT)columnIndex,
SQL_C_WCHAR,
&waCharArray,
- (SQLINTEGER)nMaxLen*sizeof(sal_Unicode),
+ (SQLLEN)nMaxLen*sizeof(sal_Unicode),
&pcbValue),
_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
_bWasNull = pcbValue == SQL_NULL_DATA;
@@ -569,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);
+ SQLLEN nRealSize = 0;
+ if ( pcbValue > -1 )
+ nRealSize = pcbValue / sizeof(sal_Unicode);
+ SQLLEN 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
@@ -593,13 +598,16 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
(SQLUSMALLINT)columnIndex,
SQL_C_WCHAR,
&waCharArray,
- (SQLINTEGER)nLen+1,
+ (SQLLEN)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 += ::rtl::OUString(waCharArray);
+ aData.append(::rtl::OUString(waCharArray));
}
}
break;
@@ -608,25 +616,25 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
char aCharArray[2048];
// Erstmal versuchen, die Daten mit dem kleinen Puffer
// abzuholen:
- SDWORD nMaxLen = sizeof aCharArray - 1;
+ SQLLEN nMaxLen = sizeof aCharArray - 1;
// GETDATA(SQL_C_CHAR,aCharArray,nMaxLen);
- SQLINTEGER pcbValue = 0;
+ SQLLEN pcbValue = 0;
OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle,
(SQLUSMALLINT)columnIndex,
SQL_C_CHAR,
&aCharArray,
- (SQLINTEGER)nMaxLen,
+ nMaxLen,
&pcbValue),
_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
_bWasNull = pcbValue == SQL_NULL_DATA;
if(_bWasNull)
return ::rtl::OUString();
- SQLINTEGER nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
+ SQLLEN nLen = pcbValue != SQL_NO_TOTAL ? std::min(pcbValue, nMaxLen) : (nMaxLen-1);
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
@@ -648,7 +656,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
--nLen;
aCharArray[nLen] = 0;
- aData += ::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding);
+ aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding));
}
// delete all blanks
@@ -656,7 +664,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection,
}
}
- return aData;
+ return aData.makeStringAndClear();
}
// -------------------------------------------------------------------------
void OTools::GetInfo(OConnection* _pConnection,