summaryrefslogtreecommitdiffstats
path: root/connectivity/source
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-07-15 11:06:05 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-07-15 11:06:05 +0000
commit0a14728df214246347e51cdc72a4314180845208 (patch)
treeb01dd5f25403c2c587fb5d612a18279358f96412 /connectivity/source
parent#i10000# double merge fixed (diff)
downloadcore-0a14728df214246347e51cdc72a4314180845208.tar.gz
core-0a14728df214246347e51cdc72a4314180845208.zip
CWS-TOOLING: integrate CWS moz2seamonkey01
2009-06-18 20:56:43 +0200 fs r273133 : #i10000# corrected resolved of merge conflict 2009-06-18 20:55:34 +0200 fs r273132 : #i10000# corrected resolved of merge conflict 2009-06-18 10:49:26 +0200 fs r273105 : CWS-TOOLING: rebase CWS moz2seamonkey01 to trunk@272827 (milestone: DEV300:m50) 2009-06-17 20:48:35 +0200 fs r273094 : #i84961# removed 'pointless and buggy' echo statement 2009-05-22 11:27:08 +0200 fs r272176 : #i101763# provided by tono@openoffice.org make compile with mingw 2009-05-22 11:22:25 +0200 fs r272175 : #i101763# provided by tono@openoffice.org allow compilation in with mingw 2009-04-15 12:09:28 +0200 fs r270830 : unconditionally disable moz executables 2009-03-27 12:29:38 +0100 fs r270149 : ignore some configure-related files 2009-03-27 11:47:35 +0100 fs r270145 : SolarisSparc needs libfreebl_32fpu_3.so 2009-03-27 11:38:09 +0100 fs r270141 : regxpcom call not needed nowadays / also pack libfreebl3 (needed for signature/encryption) 2009-03-26 21:40:17 +0100 fs r270108 : superseded by 1.1.14 version 2009-03-24 13:07:21 +0100 fs r269938 : xptitemp.dat seemingly not needed anymore 2009-03-23 12:56:29 +0100 fs r269869 : files with : in their name break the build 2009-03-23 12:22:01 +0100 fs r269866 : files with : in their name break the build 2009-03-21 23:12:06 +0100 fs r269843 : manual resync: merge the changes which happened on TRUNK in mozilla-source-1.7.5.patch herein 2009-03-21 21:58:17 +0100 fs r269841 : CWS-TOOLING: rebase CWS moz2seamonkey01 to trunk@269781 (milestone: DEV300:m44) 2009-03-18 12:04:25 +0100 fs r269649 : in SunHH environment, use pre-requisites from /so/env 2009-03-16 12:33:18 +0100 pastea_p r269522 : correct makefile.mk sorry again 2009-03-15 17:32:43 +0100 pastea_p r269506 : last files about migration to 1.1.14 2009-03-15 17:19:39 +0100 pastea_p r269505 : Migrates some files to 1.1.14 2009-03-04 07:45:40 +0100 fs r268782 : also add pref.xpt 2009-02-27 09:57:37 +0100 fs r268555 : #i66338# for the moment, disable Mozilla-based code for unxlngx6 2009-02-23 10:56:28 +0100 fs r268346 : syntax 2009-02-19 14:14:56 +0100 fs r268283 : make PrintPDE compile in Sun's internal build environment by removing some unneeded stuff 2009-02-18 15:40:40 +0100 fs r268236 : #i66338# re-enable MozAB on Mac 2009-02-18 15:39:55 +0100 fs r268235 : #i66338# 2009-02-18 15:30:38 +0100 fs r268232 : #i66338# tar => $(TAR) (provided by hjs) 2009-02-18 15:28:45 +0100 fs r268231 : more build envs supported (thanks to hjs for all this work!) 2009-02-18 15:27:02 +0100 fs r268230 : #i66338# 2009-02-18 15:23:04 +0100 fs r268229 : #i66338# let it build on Solaris, in Sun Hamburg's build environment 2009-02-18 12:00:12 +0100 fs r268210 : #i10000# 2009-02-18 08:17:29 +0100 fs r268198 : #i66338# building Mozilla is not supported anymore, SeaMonkey is the way to go now 2009-02-18 08:16:50 +0100 fs r268197 : #i66338# building Mozilla is not supported anymore, SeaMonkey is the way to go now 2009-02-14 14:05:24 +0100 fs r267757 : redo the Windows related changes lost with recent resync 2009-02-14 00:06:33 +0100 ericb r267755 : #i94628# remove the config_office dir now 2009-02-14 00:04:59 +0100 ericb r267754 : #i94628# remove all files in config_office now 2009-02-14 00:01:26 +0100 ericb r267753 : #i94628# remove guw in config_office 2009-02-13 23:53:00 +0100 ericb r267752 : #i94628# remove files in config_office 2009-02-13 16:02:58 +0100 fs r267725 : #i10000# 2009-02-12 18:14:31 +0100 ericb r267685 : #i94628# new generated configure 2009-02-12 18:13:52 +0100 ericb r267684 : #i94628# fix a path issue for finding seamonkey01 2009-02-12 14:39:17 +0100 ericb r267662 : #i94628# removing seamonkey.1.1.12 patch 2009-02-12 14:21:04 +0100 ericb r267658 : #i94628# the new configure, after autoconf 2009-02-12 14:13:21 +0100 ericb r267656 : #i94628# other missing changes for Windows 2009-02-12 14:04:26 +0100 ericb r267655 : #i94628# recommit configure.in changes after config_office removing 2009-02-12 13:46:12 +0100 ericb r267653 : CWS-TOOLING: rebase CWS moz2seamonkey01 to trunk@267171 (milestone: DEV300:m41) 2009-02-12 12:00:48 +0100 ericb r267643 : CWS-TOOLING: rebase CWS moz2seamonkey01 to trunk@267171 (milestone: DEV300:m41) 2009-02-11 13:28:50 +0100 pl r267595 : #i94628# add MACDEVSDK variable for unxmacxi 2009-02-06 09:44:15 +0100 ericb r267446 : #i98957# provide the zipped archives too 2009-02-06 09:43:32 +0100 ericb r267445 : #i98957# make seamonkey buildable on OpenSolaris, adding the right options for configure 2009-02-06 09:42:45 +0100 ericb r267444 : #i98957# make seamonkey buildable on OpenSolaris 2009-02-02 09:41:57 +0100 fs r267252 : #i66338# 2009-02-02 09:41:43 +0100 fs r267251 : #i66338# 2009-01-30 15:12:03 +0100 fs r267200 : code consolidation - MQueryHelper now uses MLdapAttributeMap's fillCardFromResult and fillResultFromCard, which makes the code as such shorter, and eliminates information duplication 2009-01-30 11:53:31 +0100 fs r267189 : reworked the statement parsing / statement execution / result set creation: now we don't anymore create three result sets (two of them leaking) for a single prepared statement ... 2009-01-29 20:37:01 +0100 fs r267170 : #i10000# 2009-01-29 20:32:50 +0100 fs r267169 : more explicit return type of parseSql 2009-01-29 17:32:56 +0100 fs r267163 : slightly refactored the statement class hierarchy (basically remove OStatement_BASE2, and renamed the other base classes) 2009-01-29 17:14:58 +0100 fs r267161 : #i66338# first implementation to re-enable LDAP access. Still work in progress (but hey, you can see the data already :) 2009-01-12 11:25:56 +0100 fs r266138 : allow using a debug-enabled version of Mozilla/SeaMonkey when MOZILLA_ENABLE_DEBUG is set 2009-01-10 22:01:40 +0100 fs r266126 : #i95772# nsldap32v50.dll also needs an embedded manifest (the LDP configuration backend links directly against it) 2009-01-09 11:15:32 +0100 fs r266065 : manifests for DLLs need to have ID 2, not 1 2009-01-08 20:02:24 +0100 fs r266035 : #i95772# embed manifest file in shared libs built in directory/c-sdk, too 2009-01-05 20:45:38 +0100 ericb r265886 : #i66338# commiting the correct configure for the tinderboxes 2009-01-05 17:42:34 +0100 ericb r265883 : CWS-TOOLING: rebase CWS moz2seamonkey01 to trunk@265758 (milestone: DEV300:m38) 2008-12-16 15:34:26 +0100 ericb r265550 : #i94628# change for seamonkey1.1.13 : do not forget to do autoconf in config_office before configure 2008-12-16 15:25:37 +0100 pastea_p r265547 : 1.1.12 to 1.1.13 2008-12-16 14:20:18 +0100 pastea_p r265540 : correct the hunk about no core_abspath which one broke linux build 2008-12-16 13:10:06 +0100 pastea_p r265535 : Change name of patch to 1.1.13 2008-12-15 23:32:54 +0100 pastea_p r265518 : 2008-12-12 18:43:36 +0100 pastea_p r265435 : update to 1.1.13 2008-12-12 10:56:38 +0100 fs r265398 : #i95772# embed .manifest files into SHARED_LIBRARYs built in nsprpub, too 2008-12-12 09:56:38 +0100 fs r265391 : #i95772# don't use regxpcomp on Windows, it's not needed 2008-12-11 11:22:43 +0100 fs r265269 : #i95772# Moz/SeaMonkey libs on Windows now link against msvc?80.dll 2008-12-10 13:45:51 +0100 fs r265182 : proper OSL_ENSURE message 2008-11-13 13:18:03 +0100 fs r263635 : #i95772# more patches 2008-11-13 12:14:41 +0100 fs r263630 : #i95772# building SeaMonkey on Windows is supported for MSVS2005 only at the moment, now requiring v8-moztools.zip instead of the previously needed wintools.zip/vc71*.zip 2008-11-13 12:13:33 +0100 fs r263629 : #i95772# building SeaMonkey on Windows is supported for MSVS2005 only at the moment, now requiring v8-moztools.zip instead of the previously needed wintools.zip/vc71*.zip 2008-11-13 12:08:22 +0100 fs r263628 : #i95772# building SeaMonkey on Windows is supported for MSVS2005 only at the moment, now requiring v8-moztools.zip instead of the previously needed wintools.zip/vc71*.zip 2008-11-13 12:04:15 +0100 fs r263627 : #i95772# 2008-11-12 08:23:20 +0100 fs r263575 : i95772# use xpcom_core on Windows, too 2008-11-11 21:02:14 +0100 fs r263574 : i95772# use xpcom_core.lib on Windows, too 2008-11-11 20:58:07 +0100 fs r263573 : i95772# use xpcom_core.lib on Windows, too 2008-11-11 15:05:42 +0100 fs r263564 : alternative fix for part 1 of #i94957# 2008-11-10 22:18:14 +0100 fs r263541 : #i95772# with MSVC2008, compile with -Zc:wchar_t- (shamelessly taken from https://bugzilla.mozilla.org/show_bug.cgi?id=324842) 2008-11-10 22:15:57 +0100 fs r263540 : #i95772# with MSVC2008, compile with -Zc:wchar_t- (shamelessly taken from https://bugzilla.mozilla.org/show_bug.cgi?id=324842) 2008-11-10 09:28:26 +0100 fs r263509 : #i95772# when building on WNT, embed the .manifest file into the .dll/.exe 2008-11-10 09:19:06 +0100 fs r263508 : collect single patches which comprise the complete patch 2008-11-06 09:10:21 +0100 fs r263360 : #i95772# core_abspath does not work on Windows, too (at least in security/nss/cmd/shlibsign). Replace with 'cygpath -d -a' 2008-11-02 22:51:27 +0100 fs r263277 : #i95772# sanitize INCLUDEDIR and GENHEADERS to use cygwin path notation - cygwin's make 1.81 doesn't cope with Windows path notation 2008-11-02 22:50:15 +0100 fs r263276 : #i95772# no --enable-system-cairo on Windows 2008-10-18 20:12:36 +0200 pastea_p r262297 : 2008-10-16 17:15:35 +0200 ericb r262267 : #i94957# fix the breakage in connectivity, for the seamonkey migration 2008-10-16 17:14:49 +0200 ericb r262266 : #i94957# fix the breakage in connectivity, for the seamonkey migration 2008-10-16 16:58:21 +0200 ericb r262263 : #i94957# fix the breakage in connectivity, for the seamonkey migration 2008-10-15 20:16:28 +0200 ericb r262242 : #i94628# use mac as default toolkit on mac 2008-10-14 18:54:13 +0200 ericb r262216 : #i90774# modify the configure.in for moz2seamonkey migration 2008-10-14 18:48:57 +0200 ericb r262215 : #i90774# commit moz2seamonkey changes for svn migration 2008-10-14 18:47:05 +0200 ericb r262214 : #i90774# commit moz2seamonkey changes for svn migration
Diffstat (limited to 'connectivity/source')
-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.cxx3
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx1
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx137
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx28
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx7
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx4
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx7
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx224
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx80
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx1
-rw-r--r--connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx6
-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.mk4
-rw-r--r--connectivity/source/drivers/mozab/makefile.mk9
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx2
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx3
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSMozabProxy.cxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx52
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx4
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx407
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx20
-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.mk9
-rw-r--r--connectivity/source/drivers/mozab/post_include_mozilla.h12
-rw-r--r--connectivity/source/drivers/mozab/pre_include_mozilla.h14
31 files changed, 473 insertions, 877 deletions
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 6fc45d4ed07f..80da4df794fc 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -378,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;
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
index 741bd9ef20e1..d29a36f60a14 100644
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -51,7 +51,6 @@ namespace connectivity
namespace mozab
{
- class OStatement_Base;
class MozabDriver;
class ODatabaseMetaData;
class MNameMapper;
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
index 55350e350474..3ba479abc764 100644
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
@@ -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);
}
}
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
index 79c58bc6a90c..8cec9c18f635 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,21 +79,17 @@ 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();
-
- clearMyResultSet();
-
- OStatement_BASE2::disposing();
+ OCommonStatement::disposing();
m_xMetaData = NULL;
if(m_aParameterRow.isValid())
@@ -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 a58e442fcc30..18106375f252 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)
@@ -512,7 +512,7 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
{
ResultSetEntryGuard aGuard( *this );
OSL_TRACE("In/Out: OResultSet::close" );
- // dispose();
+ dispose();
}
// -------------------------------------------------------------------------
@@ -1125,9 +1125,6 @@ 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 );
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..855f3580b797 100644
--- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
@@ -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 50d0b63941f9..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)
{
@@ -233,13 +190,11 @@ void OStatement_Base::createTable( )
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
@@ -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()->throwSQLException( 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()->throwSQLException( 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/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..8c03770afd80 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;
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..a22b3699760a 100644
--- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk
+++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk
@@ -88,6 +88,8 @@ SLOFILES += \
$(SLO)$/MNSProfileDirServiceProvider.obj
.ENDIF
+CDEFS += -DMOZILLA_INTERNAL_API
+
.IF "$(GUI)"=="UNX"
.IF "$(COMNAME)"=="sunpro5"
CFLAGS += -features=tmplife
@@ -167,7 +169,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 e546f5a3682d..d8171716808c 100644
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -66,13 +66,13 @@ 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.
@@ -153,7 +153,8 @@ MOZSLOFILES=\
$(SLO)$/MNSINIParser.obj \
$(SLO)$/MNSRunnable.obj \
$(SLO)$/MNSProfile.obj \
- $(SLO)$/MNSProfileDirServiceProvider.obj
+ $(SLO)$/MNSProfileDirServiceProvider.obj \
+ $(SLO)$/MLdapAttributeMap.obj
SLO2FILES=\
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
index f681d6953e04..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>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
index c576d8e9290c..a40de061281b 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
@@ -47,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
@@ -73,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 b298e56262cc..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;
@@ -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()) {
@@ -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,6 +593,10 @@ 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");
@@ -719,7 +696,7 @@ MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
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!" );
@@ -745,7 +722,7 @@ MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString&
switch ( nType )
{
case DataType::VARCHAR:
- rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ) );
+ rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
break;
default:
@@ -828,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 7ff57d8d0d23..8bf376cde61f 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
@@ -205,7 +205,6 @@ 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;
@@ -240,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;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
index 01fed34d8b39..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 )
@@ -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;
@@ -687,127 +592,7 @@ sal_Bool MQueryHelper::setCardValues(const sal_Int32 rowIndex)
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 );
@@ -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 2f3f4db2d7c5..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();
@@ -90,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;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
index 129cf2d770f5..bd4201ee3729 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, 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, 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..e350365d3442 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
@@ -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__