summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Maher <mmaher@openoffice.org>2001-10-11 09:07:55 +0000
committerMartin Maher <mmaher@openoffice.org>2001-10-11 09:07:55 +0000
commit7aea50d9e8c9311bef8f3bb716e7b4e1c719022c (patch)
treeefa23ed94db8826810b71fa2dd40d6b0e9634aae
parent380deadbea8268360579d326fa8795d769aa2d8f (diff)
#92995# - Remove dependency on file SDBC driver
-rw-r--r--connectivity/prj/build.lst2
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.cxx146
-rw-r--r--connectivity/source/drivers/mozab/MCatalog.hxx102
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.cxx307
-rw-r--r--connectivity/source/drivers/mozab/MColumnAlias.hxx153
-rw-r--r--connectivity/source/drivers/mozab/MColumns.cxx175
-rw-r--r--connectivity/source/drivers/mozab/MColumns.hxx107
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx597
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx229
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx1198
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.hxx249
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx183
-rw-r--r--connectivity/source/drivers/mozab/MDriver.hxx126
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx668
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx208
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx2097
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.hxx438
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.cxx228
-rw-r--r--connectivity/source/drivers/mozab/MResultSetMetaData.hxx137
-rw-r--r--connectivity/source/drivers/mozab/MServices.cxx211
-rw-r--r--connectivity/source/drivers/mozab/MStatement.cxx650
-rw-r--r--connectivity/source/drivers/mozab/MStatement.hxx277
-rw-r--r--connectivity/source/drivers/mozab/MTable.cxx298
-rw-r--r--connectivity/source/drivers/mozab/MTable.hxx151
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx344
-rw-r--r--connectivity/source/drivers/mozab/MTables.hxx117
-rw-r--r--connectivity/source/drivers/mozab/exports.dxp3
-rw-r--r--connectivity/source/drivers/mozab/makefile.mk177
-rw-r--r--connectivity/source/drivers/mozab/mozab.map8
-rw-r--r--connectivity/source/drivers/mozab/mozab.xml65
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx453
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx149
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx119
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx154
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx112
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx591
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx202
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx517
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx171
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx172
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx97
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/makefile.mk155
-rw-r--r--connectivity/version.mk22
43 files changed, 12563 insertions, 2 deletions
diff --git a/connectivity/prj/build.lst b/connectivity/prj/build.lst
index 0f9806847927..37c2cf25a4a1 100644
--- a/connectivity/prj/build.lst
+++ b/connectivity/prj/build.lst
@@ -9,6 +9,8 @@ cn connectivity\source\sdbcx nmake - all cn_sdbcx cn_types NULL
cn connectivity\source\drivers\ado nmake - w cn_ado cn_dbtools NULL
cn connectivity\source\drivers\mozaddressbook\mozillasrc nmake - all cn_mozillasrc cn_file NULL
cn connectivity\source\drivers\mozaddressbook nmake - all cn_mozillaadb cn_mozillasrc NULL
+cn connectivity\source\drivers\mozab\mozillasrc nmake - all cn_mozab_mozillasrc cn_file NULL
+cn connectivity\source\drivers\mozab nmake - all cn_mozab cn_mozab_mozillasrc cn_dbtools NULL
cn connectivity\source\drivers\calc nmake - all cn_calc cn_file NULL
cn connectivity\source\drivers\odbc nmake - all cn_odbc cn_dbtools NULL
cn connectivity\source\drivers\jdbc nmake - all cn_jdbc cn_dbtools NULL
diff --git a/connectivity/source/drivers/mozab/MCatalog.cxx b/connectivity/source/drivers/mozab/MCatalog.cxx
new file mode 100644
index 000000000000..fd4e3037b469
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MCatalog.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: MCatalog.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
+#include "MCatalog.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
+#include "MConnection.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
+#include "MTables.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+
+
+// -------------------------------------------------------------------------
+using namespace connectivity::mozab;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+// -------------------------------------------------------------------------
+OCatalog::OCatalog(OConnection* _pCon) : connectivity::sdbcx::OCatalog(_pCon)
+ ,m_pConnection(_pCon)
+ ,m_xMetaData(m_pConnection->getMetaData( ))
+{
+// osl_incrementInterlockedCount( &m_refCount );
+// refreshTables();
+// refreshViews();
+// refreshGroups();
+// refreshUsers();
+// osl_decrementInterlockedCount( &m_refCount );
+}
+// -------------------------------------------------------------------------
+void OCatalog::refreshTables()
+{
+ TStringVector aVector;
+ Sequence< ::rtl::OUString > aTypes(1);
+ aTypes[0] = ::rtl::OUString::createFromAscii("%");
+ Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
+ ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes);
+
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ ::rtl::OUString aName;
+ const ::rtl::OUString& sDot = OCatalog::getDot();
+
+ while(xResult->next())
+ {
+ // aName = xRow->getString(2);
+ // aName += sDot;
+ aName = xRow->getString(3);
+ aVector.push_back(aName);
+ }
+ }
+ if(m_pTables)
+ m_pTables->reFill(aVector);
+ else
+ m_pTables = new OTables(m_xMetaData,*this,m_aMutex,aVector);
+}
+// -------------------------------------------------------------------------
+void OCatalog::refreshViews()
+{
+}
+// -------------------------------------------------------------------------
+void OCatalog::refreshGroups()
+{
+}
+// -------------------------------------------------------------------------
+void OCatalog::refreshUsers()
+{
+}
+// -------------------------------------------------------------------------
+const ::rtl::OUString& OCatalog::getDot()
+{
+ static const ::rtl::OUString sDot = ::rtl::OUString::createFromAscii(".");
+ return sDot;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/mozab/MCatalog.hxx b/connectivity/source/drivers/mozab/MCatalog.hxx
new file mode 100644
index 000000000000..d43a984472f4
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MCatalog.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * $RCSfile: MCatalog.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
+#define _CONNECTIVITY_MOZAB_CATALOG_HXX_
+
+#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_
+#include "connectivity/sdbcx/VCatalog.hxx"
+#endif
+// #ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_
+// #include "odbc/OFunctiondefs.hxx"
+// #endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ // please don't name the class the same name as in an other namespaces
+ // some compilers have problems with this task as I noticed on windows
+ class OConnection;
+ class OCatalog : public connectivity::sdbcx::OCatalog
+ {
+ OConnection* m_pConnection; // used to get the metadata
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
+
+ public:
+ // implementation of the pure virtual methods
+ virtual void refreshTables();
+ virtual void refreshViews() ;
+ virtual void refreshGroups();
+ virtual void refreshUsers() ;
+
+ public:
+ OCatalog(OConnection* _pCon);
+
+ OConnection* getConnection() const { return m_pConnection; }
+ sdbcx::OCollection* getPrivateTables() const { return m_pTables;}
+ sdbcx::OCollection* getPrivateViews() const { return m_pViews; }
+
+ static const ::rtl::OUString& getDot();
+ };
+ }
+}
+#endif // _CONNECTIVITY_MOZAB_CATALOG_HXX_
+
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx
new file mode 100644
index 000000000000..510835cf8137
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * $RCSfile: MColumnAlias.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+#include "MColumnAlias.hxx"
+#endif
+#ifndef _CONNECTIVITY_MAB_DRIVER_HXX_
+#include "MDriver.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+
+using namespace ::connectivity;
+using namespace ::connectivity::mozab;
+using namespace ::com::sun::star::uno;
+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::createFromAscii("FirstName"),
+ ::rtl::OUString::createFromAscii("LastName"),
+ ::rtl::OUString::createFromAscii("DisplayName"),
+ ::rtl::OUString::createFromAscii("NickName"),
+ ::rtl::OUString::createFromAscii("PrimaryEmail"),
+ ::rtl::OUString::createFromAscii("SecondEmail"),
+ ::rtl::OUString::createFromAscii("PreferMailFormat"),
+ ::rtl::OUString::createFromAscii("WorkPhone"),
+ ::rtl::OUString::createFromAscii("HomePhone"),
+ ::rtl::OUString::createFromAscii("FaxNumber"),
+ ::rtl::OUString::createFromAscii("PagerNumber"),
+ ::rtl::OUString::createFromAscii("CellularNumber"),
+ ::rtl::OUString::createFromAscii("HomeAddress"),
+ ::rtl::OUString::createFromAscii("HomeAddress2"),
+ ::rtl::OUString::createFromAscii("HomeCity"),
+ ::rtl::OUString::createFromAscii("HomeState"),
+ ::rtl::OUString::createFromAscii("HomeZipCode"),
+ ::rtl::OUString::createFromAscii("HomeCountry"),
+ ::rtl::OUString::createFromAscii("WorkAddress"),
+ ::rtl::OUString::createFromAscii("WorkAddress2"),
+ ::rtl::OUString::createFromAscii("WorkCity"),
+ ::rtl::OUString::createFromAscii("WorkState"),
+ ::rtl::OUString::createFromAscii("WorkZipCode"),
+ ::rtl::OUString::createFromAscii("WorkCountry"),
+ ::rtl::OUString::createFromAscii("JobTitle"),
+ ::rtl::OUString::createFromAscii("Department"),
+ ::rtl::OUString::createFromAscii("Company"),
+ ::rtl::OUString::createFromAscii("WebPage1"),
+ ::rtl::OUString::createFromAscii("WebPage2"),
+ ::rtl::OUString::createFromAscii("BirthYear"),
+ ::rtl::OUString::createFromAscii("BirthMonth"),
+ ::rtl::OUString::createFromAscii("BirthDay"),
+ ::rtl::OUString::createFromAscii("Custom1"),
+ ::rtl::OUString::createFromAscii("Custom2"),
+ ::rtl::OUString::createFromAscii("Custom3"),
+ ::rtl::OUString::createFromAscii("Custom4"),
+ ::rtl::OUString::createFromAscii("Notes")
+};
+//------------------------------------------------------------------------------
+OColumnAlias::OColumnAlias()
+{
+ // Initialise m_aAlias with the default values from sProgrammaticNames.
+ initialise();
+
+ // Initialise m_aAlias map with the default values from sProgrammaticNames.
+ setAliasMap();
+}
+//------------------------------------------------------------------
+OColumnAlias::~OColumnAlias()
+{
+}
+//------------------------------------------------------------------
+void OColumnAlias::initialise()
+{
+ m_aAlias.reserve( END - FIRSTNAME + 1 );
+ for (sal_Int32 i(FIRSTNAME); i < END; ++i)
+ m_aAlias.push_back(sProgrammaticNames[i]);
+
+ return;
+}
+//------------------------------------------------------------------
+namespace
+{
+
+ Reference< XPropertySet > createDriverConfigNode( Reference< XMultiServiceFactory > _rxORB, const ::rtl::OUString& _rDriverName )
+ {
+ Reference< XPropertySet > xNode;
+ try
+ {
+ //
+ // create the config provider
+ Reference< XMultiServiceFactory > xConfigProvider(
+ _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ),
+ UNO_QUERY
+ );
+ OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" );
+
+ if ( xConfigProvider.is() )
+ {
+ ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" );
+ sCompleteNodePath += _rDriverName;
+
+ //
+ // arguments for creating the config access
+ Sequence< Any > aArguments(2);
+ // the path to the node to open
+ aArguments[0] <<= PropertyValue(
+ ::rtl::OUString::createFromAscii( "nodepath"),
+ 0,
+ makeAny( sCompleteNodePath ),
+ PropertyState_DIRECT_VALUE
+ );
+ // the depth: -1 means unlimited
+ aArguments[1] <<= PropertyValue(
+ ::rtl::OUString::createFromAscii( "depth"),
+ 0,
+ makeAny( (sal_Int32)-1 ),
+ PropertyState_DIRECT_VALUE
+ );
+
+ //
+ // create the access
+ Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments(
+ ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ),
+ aArguments
+ );
+ OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" );
+
+ xNode = xNode.query( xAccess );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" );
+ }
+
+ // outta here
+ return xNode;
+ }
+
+}
+//------------------------------------------------------------------
+void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
+{
+ // open our driver settings config node
+
+ // the config path for our own driver's settings
+ Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB, MozabDriver::getImplementationName_Static() );
+ if ( xDriverNode.is() )
+ {
+ try
+ {
+ //
+ Reference< XNameAccess > xAliasesNode;
+ xDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xAliasesNode;
+ OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
+
+ // this is a set of string nodes
+ Sequence< ::rtl::OUString > aColumnProgrammaticNames;
+ if ( xAliasesNode.is() )
+ aColumnProgrammaticNames = xAliasesNode->getElementNames();
+
+ //
+ // travel through all the set elements
+ const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray();
+ const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.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).
+
+#ifdef _DEBUG
+ sal_Bool bExtractionSuccess =
+#endif
+ xAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias;
+ OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid config data!" );
+
+ // normalize in case the config data is corrupted
+ // (what we really don't need is an empty alias ...)
+ if ( 0 == sAssignedAlias.getLength() )
+ sAssignedAlias = *pProgrammaticNames;
+
+ //
+ // check the value
+ // look up the programmatic indicated by pProgrammaticNames in the known programmatics
+ const ::rtl::OUString* pProgrammatic = sProgrammaticNames + FIRSTNAME;
+ const ::rtl::OUString* pProgrammaticEnd = sProgrammaticNames + END;
+
+ OSL_ENSURE( (sal_Int32)m_aAlias.size() == pProgrammaticEnd - pProgrammatic,
+ "OColumnAlias::setAlias: aliases vector not yet initialized!" );
+
+ // the destination where we want to remember the alias
+ ::std::vector< ::rtl::OUString >::iterator aDestination = m_aAlias.begin();
+
+ for ( ; pProgrammatic < pProgrammaticEnd; ++pProgrammatic, ++aDestination )
+ {
+ if ( pProgrammaticNames->equals( *pProgrammatic ) )
+ {
+ // add alias to the vector
+ *aDestination = sAssignedAlias;
+ break;
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" );
+ }
+ }
+
+ // Initialise m_aAliasMap.
+ setAliasMap();
+
+ return;
+}
+//------------------------------------------------------------------
+const ::std::vector< ::rtl::OUString> & OColumnAlias::getAlias() const
+{
+ return m_aAlias;
+}
+//------------------------------------------------------------------
+const ::std::map< ::rtl::OUString, ::rtl::OUString> & OColumnAlias::getAliasMap() const
+{
+ return m_aAliasMap;
+}
+//------------------------------------------------------------------
+void OColumnAlias::setAliasMap()
+{
+ // Fill the map with the values of m_aAlias
+ // and the sProgrammaticNames array.
+ for (sal_Int32 i(FIRSTNAME); i < END; ++i) {
+ m_aAliasMap[m_aAlias[i]] = sProgrammaticNames[i];
+ }
+
+ return;
+}
+//------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx
new file mode 100644
index 000000000000..fcd247078382
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MColumnAlias.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * $RCSfile: MColumnAlias.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+#define _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+
+#ifndef _UNOTOOLS_CONFIGNODE_HXX_
+#include <unotools/confignode.hxx>
+#endif
+
+#include <osl/mutex.hxx>
+#include <vector>
+#include <map>
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ typedef enum {
+ FIRSTNAME = 0,
+ 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;
+
+ class OColumnAlias
+ {
+ /**
+ * m_Alias holds aliases for the mozilla addressbook
+ * column names. This member gets initialised during
+ * creation of the connection to the driver.
+ * m_aAlias initialises m_aAliasMap which then can be
+ * used to find the corresponding programmatic name
+ * when an alias is used as a query attribute. Mozilla
+ * expects programmatic names from its clients.
+ *
+ * m_aAlias: vector of aliases used to initialise m_aAliasMap.
+ * m_AliasMap: map of {alias, programmaticname} pairs.
+ *
+ */
+ private:
+ ::std::vector< ::rtl::OUString> m_aAlias;
+ ::std::map< ::rtl::OUString, ::rtl::OUString> m_aAliasMap;
+ protected:
+ ::osl::Mutex m_aMutex;
+ public:
+ void initialise(void);
+ const ::std::vector< ::rtl::OUString> & getAlias(void) const;
+ const ::std::map< ::rtl::OUString, ::rtl::OUString> & getAliasMap(void) const;
+ void setAlias(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > &);
+ private:
+ void setAliasMap(void);
+ public:
+ OColumnAlias(void);
+ ~OColumnAlias(void);
+ };
+ }
+}
+#endif // _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx
new file mode 100644
index 000000000000..52d185e72207
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MColumns.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: MColumns.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_
+#include "MColumns.hxx"
+#endif
+#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
+#include "connectivity/sdbcx/VColumn.hxx"
+#endif
+#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
+#include "connectivity/sdbcx/VColumn.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
+#include "MTable.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
+#include "MTables.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
+#include "MCatalog.hxx"
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include "connectivity/dbtools.hxx"
+#endif
+
+using namespace ::comphelper;
+
+
+using namespace connectivity::mozab;
+using namespace connectivity::sdbcx;
+using namespace connectivity;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+// using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+typedef connectivity::sdbcx::OCollection OCollection_TYPE;
+
+Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName)
+{
+ Reference< XResultSet > xResult = m_pTable->getConnection()->getMetaData()->getColumns(Any(),
+ m_pTable->getSchema(),m_pTable->getTableName(),_rName);
+
+ Reference< XNamed > xRet = NULL;
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while(xResult->next())
+ {
+ if(xRow->getString(4) == _rName)
+ {
+ sal_Int32 nType = xRow->getInt(5);
+ ::rtl::OUString sTypeName = xRow->getString(6);
+ sal_Int32 nPrec = xRow->getInt(7);
+
+ OColumn* pRet = new OColumn(_rName,
+ sTypeName,
+ xRow->getString(13),
+ xRow->getInt(11),
+ nPrec,
+ xRow->getInt(9),
+ nType,
+ sal_False,sal_False,sal_False,sal_True);
+ xRet = pRet;
+ break;
+ }
+ }
+ }
+
+ return xRet;
+}
+
+// -------------------------------------------------------------------------
+void OColumns::impl_refresh() throw(RuntimeException)
+{
+ m_pTable->refreshColumns();
+}
+// -------------------------------------------------------------------------
+Reference< XPropertySet > OColumns::createEmptyObject()
+{
+ return new OColumn(sal_True);
+}
+// -------------------------------------------------------------------------
+// XAppend
+void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException)
+{
+}
+
+// -------------------------------------------------------------------------
+// XDrop
+void SAL_CALL OColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/connectivity/source/drivers/mozab/MColumns.hxx b/connectivity/source/drivers/mozab/MColumns.hxx
new file mode 100644
index 000000000000..d633f2023559
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MColumns.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * $RCSfile: MColumns.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_
+#define _CONNECTIVITY_MOZAB_COLUMNS_HXX_
+
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#include "connectivity/sdbcx/VCollection.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#endif
+#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
+#include "MTable.hxx"
+#endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class OColumns : public sdbcx::OCollection
+ {
+ protected:
+ OTable* m_pTable;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
+ public:
+ OColumns( OTable* _pTable,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector
+ ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector)
+ ,m_pTable(_pTable)
+ {}
+
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XDrop
+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+#endif // _CONNECTIVITY_MOZAB_COLUMNS_HXX_
+
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
new file mode 100644
index 000000000000..ad943e3d453f
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -0,0 +1,597 @@
+/*************************************************************************
+ *
+ * $RCSfile: MConnection.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "MConnection.hxx"
+
+#include "MDatabaseMetaData.hxx"
+#ifndef CONNECTIVITY_SDRIVER_HXX
+#include "MDriver.hxx"
+#endif
+#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+#include "MColumnAlias.hxx"
+#endif
+#include "MStatement.hxx"
+#include "MPreparedStatement.hxx"
+
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_TRANSACTIONISOLATION_HPP_
+#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _DBHELPER_DBCHARSET_HXX_
+#include <connectivity/dbcharset.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+
+using namespace connectivity::mozab;
+// using namespace connectivity;
+using namespace dbtools;
+
+//------------------------------------------------------------------------------
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+// --------------------------------------------------------------------------------
+
+namespace connectivity {
+ namespace mozab {
+ // For the moment, we will connect the Mozilla address book to the Mozilla
+ // top-level address book which will display whatever is in the preferences
+ // file of Mozilla.
+ static sal_Char* SDBC_SCHEME_MOZILLA = "mozilla";
+ static sal_Char* MOZ_SCHEME_MOZILLA = "moz-abdirectory://";
+ static sal_Bool USES_FACTORY_MOZILLA = sal_False ;
+ // This one is a base uri which will be completed with the connection data.
+ static sal_Char* SDBC_SCHEME_LDAP = "ldap";
+ static sal_Char* MOZ_SCHEME_LDAP = "moz-abldapdirectory://";
+ static sal_Bool USES_FACTORY_LDAP = sal_False ;
+ // These two uris will be used to obtain directory factories to access all
+ // address books of the given type.
+ static sal_Char* SDBC_SCHEME_OUTLOOK_MAPI = "outlook";
+ static sal_Char* MOZ_SCHEME_OUTLOOK_MAPI = "moz-aboutlookdirectory://op/";
+ static sal_Bool USES_FACTORY_OUTLOOK_MAPI = sal_True ;
+ static sal_Char* SDBC_SCHEME_OUTLOOK_EXPRESS = "outlookexp";
+ static sal_Char* MOZ_SCHEME_OUTLOOK_EXPRESS = "moz-aboutlookdirectory://oe/";
+ static sal_Bool USES_FACTORY_OUTLOOK_EXPRESS= sal_True ;
+ }
+}
+
+
+OConnection::OConnection(MozabDriver* _pDriver)
+ : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this),
+ m_pDriver(_pDriver),
+ m_bClosed(sal_False),
+ m_xMetaData(NULL),
+ m_bUseCatalog(sal_False),
+ m_bUseOldDateFormat(sal_False),
+ m_nAnonABCount( 0 ),
+ m_nMaxResultRecords( -1 ),
+ m_UsesFactory(sal_False),
+ m_IsLDAP(sal_False),
+ m_bOutlookExpress(sal_False)
+{
+ m_pDriver->acquire();
+
+ // Initialise m_aColumnAlias.
+ m_aColumnAlias.setAlias(_pDriver->getMSFactory());
+}
+//-----------------------------------------------------------------------------
+OConnection::~OConnection()
+{
+ if(!isClosed())
+ close();
+ m_pDriver->release();
+ m_pDriver = NULL;
+}
+//-----------------------------------------------------------------------------
+void SAL_CALL OConnection::release() throw(RuntimeException)
+{
+ relase_ChildImpl();
+}
+// -----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException)
+{
+ osl_incrementInterlockedCount( &m_refCount );
+
+ OSL_TRACE("IN OConnection::construct()\n" );
+ // open file
+
+ //
+ // Skip 'sdbc:mozab: part of URL
+ //
+ sal_Int32 nLen = url.indexOf(':');
+ nLen = url.indexOf(':',nLen+1);
+ ::rtl::OUString aAddrbookURI(url.copy(nLen+1));
+ // Get Scheme
+ nLen = aAddrbookURI.indexOf(':');
+ ::rtl::OUString aAddrbookScheme;
+ if ( nLen == -1 )
+ {
+ // There isn't any subschema: - but could be just subschema
+ if ( aAddrbookURI.getLength() > 0 ) {
+ aAddrbookScheme= aAddrbookURI;
+ }
+ else {
+ OSL_TRACE( "No subschema given!!!\n");
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No subschema provided"),NULL);
+ }
+ }
+ else {
+ aAddrbookScheme = aAddrbookURI.copy(0, nLen);
+ }
+
+ OSL_TRACE("URI = %s\n", ((OUtoCStr(aAddrbookURI)) ? (OUtoCStr(aAddrbookURI)):("NULL")) );
+ OSL_TRACE("Scheme = %s\n", ((OUtoCStr(aAddrbookScheme)) ?
+ (OUtoCStr(aAddrbookScheme)):("NULL")) );
+
+ //
+ // Now we have a URI convert it to a MozillaURI
+ //
+ // The Mapping being used is:
+ //
+ // * for Mozilla
+ // "sdbc:address:mozilla:" -> abdirectory://
+ // * for LDAP
+ // "sdbc:address:ldap:" -> abldapdirectory://
+ // * for Outlook (using MAPI API)
+ // "sdbc:address:outlook:" -> aboutlookdirectory://op/
+ // * for windows system address book
+ // "sdbc:address:outlookexp:" -> aboutlookdirectory://oe/
+ //
+ m_IsLDAP = sal_False ;
+ if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_MOZILLA ) == 0 ) {
+ m_sMozillaURI = rtl::OUString::createFromAscii( MOZ_SCHEME_MOZILLA );
+ m_UsesFactory = USES_FACTORY_MOZILLA ;
+ }
+ else if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_LDAP ) == 0 ) {
+ rtl::OUString sHostName;
+ rtl::OUString sBaseDN;
+ sal_Int32 nPortNumber = -1;
+
+ m_sMozillaURI = rtl::OUString::createFromAscii( MOZ_SCHEME_LDAP );
+ m_UsesFactory = USES_FACTORY_LDAP ;
+ m_IsLDAP = sal_True ;
+
+ const PropertyValue* pInfo = info.getConstArray();
+ const PropertyValue* pInfoEnd = pInfo + info.getLength();
+
+ for (; pInfo != pInfoEnd; ++pInfo)
+ {
+ OSL_TRACE( "info[%d].Name = %s\n", pInfo - info.getConstArray(), OUtoCStr( pInfo->Name ) );
+
+ if ( 0 == pInfo->Name.compareToAscii("HostName") )
+ {
+ pInfo->Value >>= sHostName;
+ }
+ else if ( 0 == pInfo->Name.compareToAscii("BaseDN") )
+ {
+ pInfo->Value >>= sBaseDN;
+ }
+ else if ( 0 == pInfo->Name.compareToAscii("PortNumber") )
+ {
+ pInfo->Value >>= nPortNumber;
+ }
+ else if ( 0 == pInfo->Name.compareToAscii("MaxRowCount") )
+ {
+ pInfo->Value >>= m_nMaxResultRecords;
+ }
+ }
+ if ( sHostName.getLength() != 0 ) {
+ m_sMozillaURI += sHostName;
+ }
+ else {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No HostName provided"),NULL);
+ }
+
+ if ( nPortNumber > 0 ) {
+ m_sMozillaURI += rtl::OUString::createFromAscii( ":" );
+ m_sMozillaURI += rtl::OUString::valueOf( nPortNumber );
+ }
+
+ if ( sBaseDN.getLength() != 0 ) {
+ m_sMozillaURI += rtl::OUString::createFromAscii( "/" );
+ m_sMozillaURI += sBaseDN;
+ }
+ else {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No BaseDN provided"),NULL);
+ }
+ // Addition of a fake query to enable the Mozilla LDAP directory to work correctly.
+ m_sMozillaURI += ::rtl::OUString::createFromAscii("?(or(DisplayName,=,DontDoThisAtHome))");
+
+ }
+ else if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_OUTLOOK_MAPI ) == 0 ) {
+ m_sMozillaURI = ::rtl::OUString::createFromAscii( MOZ_SCHEME_OUTLOOK_MAPI );
+ m_UsesFactory = USES_FACTORY_OUTLOOK_MAPI ;
+ }
+ else if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_OUTLOOK_EXPRESS ) == 0 ) {
+ m_sMozillaURI = rtl::OUString::createFromAscii( MOZ_SCHEME_OUTLOOK_EXPRESS );
+ m_UsesFactory = USES_FACTORY_OUTLOOK_EXPRESS ;
+ m_bOutlookExpress = sal_True;
+ }
+ else
+ {
+ OSL_TRACE("Invalid subschema given!!!\n");
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Invalid subschema provided"),NULL);
+ }
+
+ OSL_TRACE("Moz URI = %s, %s\n", ((OUtoCStr(m_sMozillaURI)) ?
+ (OUtoCStr(m_sMozillaURI)):("NULL")),
+ m_UsesFactory ? "uses factory" : "no factory");
+ OSL_TRACE( "\tOUT OConnection::construct()\n" );
+
+ // Test connection by getting to get the Table Names
+ MDatabaseMetaDataHelper _aDbHelper;
+
+ _aDbHelper.getTableStrings( this, sal_True ); // Will throw an exception on failure
+
+ osl_decrementInterlockedCount( &m_refCount );
+}
+// XServiceInfo
+// --------------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.mozab.OConnection", "com.sun.star.sdbc.Connection")
+
+// --------------------------------------------------------------------------------
+Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // create a statement
+ // the statement can only be executed once
+ Reference< XStatement > xReturn = new OStatement(this);
+ m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ return xReturn;
+}
+// --------------------------------------------------------------------------------
+Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("OConnection::prepareStatement( %s )", OUtoCStr( _sSql ) );
+ // the pre
+ if(m_aTypeInfo.empty())
+ buildTypeInfo();
+
+ // create a statement
+ // the statement can only be executed more than once
+ Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,m_aTypeInfo,_sSql);
+ m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ return xReturn;
+}
+// --------------------------------------------------------------------------------
+Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("OConnection::prepareCall( %s )", OUtoCStr( _sSql ) );
+ // not implemented yet :-) a task to do
+ return NULL;
+}
+// --------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OConnection::nativeSQL( const ::rtl::OUString& _sSql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ // when you need to transform SQL92 to you driver specific you can do it here
+ OSL_TRACE("OConnection::nativeSQL( %s )", OUtoCStr( _sSql ) );
+
+ return _sSql;
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ // here you have to set your commit mode please have a look at the jdbc documentation to get a clear explanation
+}
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+ // you have to distinguish which if you are in autocommit mode or not
+ // at normal case true should be fine here
+
+ return sal_True;
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // when you database does support transactions you should commit here
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+
+ // same as commit but for the other case
+}
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent)
+ return OConnection_BASE::rBHelper.bDisposed;
+}
+// --------------------------------------------------------------------------------
+Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // here we have to create the class with biggest interface
+ // The answer is 42 :-)
+ Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
+ if(!xMetaData.is())
+ {
+ xMetaData = new ODatabaseMetaData(this); // need the connection because it can return it
+ m_xMetaData = xMetaData;
+ }
+
+ return xMetaData;
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // set you connection to readonly
+}
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // return if your connection to readonly
+ return sal_False;
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // if your database doesn't work with catalogs you go to next method otherwise you kjnow what to do
+}
+// --------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+
+ // return your current catalog
+ return ::rtl::OUString();
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // set your isolation level
+ // please have a look at @see com.sun.star.sdbc.TransactionIsolation
+}
+// --------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+
+ // please have a look at @see com.sun.star.sdbc.TransactionIsolation
+ return TransactionIsolation::NONE;
+}
+// --------------------------------------------------------------------------------
+Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ // if your driver has special database types you can return it here
+
+ return NULL;
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
+{
+ // the other way around
+}
+// --------------------------------------------------------------------------------
+// XCloseable
+void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
+{
+ // we just dispose us
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
+ }
+ dispose();
+}
+// --------------------------------------------------------------------------------
+// XWarningsSupplier
+Any SAL_CALL OConnection::getWarnings( ) throw(SQLException, RuntimeException)
+{
+ // when you collected some warnings -> return it
+ return Any();
+}
+// --------------------------------------------------------------------------------
+void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeException)
+{
+ // you should clear your collected warnings here
+}
+//--------------------------------------------------------------------
+void OConnection::buildTypeInfo() throw( SQLException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XResultSet> xRs = getMetaData ()->getTypeInfo ();
+ Reference< XRow> xRow(xRs,UNO_QUERY);
+ // Information for a single SQL type
+
+ // Loop on the result set until we reach end of file
+
+ while (xRs->next ())
+ {
+ OTypeInfo aInfo;
+ aInfo.aTypeName = xRow->getString (1);
+ aInfo.nType = xRow->getShort (2);
+ aInfo.nPrecision = xRow->getInt (3);
+ aInfo.aLiteralPrefix = xRow->getString (4);
+ aInfo.aLiteralSuffix = xRow->getString (5);
+ aInfo.aCreateParams = xRow->getString (6);
+ aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE;
+ aInfo.bCaseSensitive = xRow->getBoolean (8);
+ aInfo.nSearchType = xRow->getShort (9);
+ aInfo.bUnsigned = xRow->getBoolean (10);
+ aInfo.bCurrency = xRow->getBoolean (11);
+ aInfo.bAutoIncrement = xRow->getBoolean (12);
+ aInfo.aLocalTypeName = xRow->getString (13);
+ aInfo.nMinimumScale = xRow->getShort (14);
+ aInfo.nMaximumScale = xRow->getShort (15);
+ aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt(18);
+
+
+
+ // Now that we have the type info, save it
+ // in the Hashtable if we don't already have an
+ // entry for this SQL type.
+
+ m_aTypeInfo.push_back(aInfo);
+ }
+
+ // Close the result set/statement.
+
+ Reference< XCloseable> xClose(xRs,UNO_QUERY);
+ xClose->close();
+}
+//------------------------------------------------------------------------------
+void OConnection::disposing()
+{
+ // we noticed that we should be destroied in near future so we have to dispose our statements
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
+ {
+ Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ if (xComp.is())
+ xComp->dispose();
+ }
+ m_aStatements.clear();
+
+ m_bClosed = sal_True;
+ m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>();
+
+ dispose_ChildImpl();
+ OConnection_BASE::disposing();
+}
+// -----------------------------------------------------------------------------
+
+Reference< XTablesSupplier > SAL_CALL OConnection::createCatalog()
+{
+ OSL_TRACE("IN OConnection::createCatalog()\n" );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XTablesSupplier > xTab = m_xCatalog;
+ if(!m_xCatalog.is())
+ {
+ OCatalog *pCat = new OCatalog(this);
+ xTab = pCat;
+ m_xCatalog = xTab;
+ }
+ OSL_TRACE( "\tOUT OConnection::createCatalog()\n" );
+ return xTab;
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
new file mode 100644
index 000000000000..0c1b600e65d3
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * $RCSfile: MConnection.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SCONNECTION_HXX
+#define CONNECTIVITY_SCONNECTION_HXX
+
+#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+#include "MColumnAlias.hxx"
+#endif
+#ifndef _CONNECTIVITY_MAB_CATALOG_HXX_
+#include "MCatalog.hxx"
+#endif
+
+
+
+#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
+#include "OSubComponent.hxx"
+#endif
+#ifndef INCLUDED_MAP
+#include <map>
+#define INCLUDED_MAP
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "connectivity/CommonTools.hxx"
+#endif
+#ifndef CONNECTIVITY_CONNECTION_HXX
+#include "TConnection.hxx"
+#endif
+#ifndef _CONNECTIVITY_OTYPEINFO_HXX_
+#include "OTypeInfo.hxx"
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX_
+#include <cppuhelper/weakref.hxx>
+#endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+
+ class OStatement_Base;
+ class MozabDriver;
+ class ODatabaseMetaData;
+
+ typedef connectivity::OMetaConnection OConnection_BASE; // implements basics and text encoding
+ typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector;
+
+ class OConnection : public OConnection_BASE,
+ public connectivity::OSubComponent<OConnection, OConnection_BASE>
+ {
+ friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
+
+ protected:
+ //====================================================================
+ // Data attributes
+ //====================================================================
+ TTypeInfoVector m_aTypeInfo; // vector containing an entry
+ // for each row returned by
+ // DatabaseMetaData.getTypeInfo.
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ connectivity::OWeakRefArray m_aStatements; // vector containing a list
+ // of all the Statement objects
+ // for this Connection
+
+ ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
+ // an operation
+ ::rtl::OUString m_aURL; // URL of connection
+ ::rtl::OUString m_sUser; // the user name
+ MozabDriver* m_pDriver; // Pointer to the owning
+ // driver object
+
+ sal_Bool m_bClosed;
+ sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases
+ sal_Bool m_bUseOldDateFormat;
+
+ // Store Catalog
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
+ // Start of Additions from the land of mozilla
+ OColumnAlias m_aColumnAlias;
+ rtl::OUString m_sMozillaURI;
+ sal_Int32 m_nAnonABCount;
+ sal_Int32 m_nMaxResultRecords;
+ sal_Bool m_UsesFactory ;
+ sal_Bool m_IsLDAP ;
+ sal_Bool m_bOutlookExpress;
+ // End of Additions from the land of mozilla
+
+ void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException);
+
+ public:
+ virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
+
+ OConnection(MozabDriver* _pDriver);
+ virtual ~OConnection();
+
+ void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ // XConnection
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) 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);
+ // XWarningsSupplier
+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ //
+
+ sal_Bool isCatalogUsed() const { return m_bUseCatalog; }
+ ::rtl::OUString getUserName() const { return m_sUser; }
+
+ MozabDriver* getDriver() const { return m_pDriver;}
+
+ // Added to enable me to use SQLInterpreter which requires an
+ // XNameAccess i/f to access tables.
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL createCatalog();
+
+ // Additions from the land of mozilla
+ rtl::OUString getConnectionURL() const
+ { return m_aURL; }
+
+ rtl::OUString getMozURI() const
+ { return m_sMozillaURI; }
+
+ sal_Bool usesFactory(void) const { return m_UsesFactory ; }
+ sal_Bool isLDAP(void) const { return m_IsLDAP ; }
+
+ sal_Bool isOutlookExpress() const { return m_bOutlookExpress;}
+ sal_Int32 getNextAnonymousAB() { return (++m_nAnonABCount); }
+ sal_Int32 getMaxResultRecords() const { return m_nMaxResultRecords; }
+
+ const OColumnAlias & getColumnAlias() const
+ { return (m_aColumnAlias); }
+
+ // End of Additions from the land of mozilla
+ };
+ }
+}
+#endif // CONNECTIVITY_SCONNECTION_HXX
+
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
new file mode 100644
index 000000000000..30a0c3213465
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
@@ -0,0 +1,1198 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDatabaseMetaData.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX
+#include "MDatabaseMetaData.hxx"
+#endif
+#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
+#include "FDatabaseMetaDataResultSet.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_TRANSACTIONISOLATION_HPP_
+#include <com/sun/star/sdbc/TransactionIsolation.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#include <connectivity/FValue.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+
+#include <vector>
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+using namespace connectivity::mozab;
+using namespace connectivity;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ static sal_Int32 const s_nCOLUMN_SIZE = 256;
+ static sal_Int32 const s_nDECIMAL_DIGITS = 0;
+ static sal_Int32 const s_nNULLABLE = 1;
+ static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
+ }
+}
+
+
+ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
+ : ::connectivity::ODatabaseMetaDataBase(_pCon)
+ ,m_pConnection(_pCon)
+ ,m_bUseCatalog(sal_True)
+{
+ OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
+ if(!m_pConnection->isCatalogUsed())
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable());
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+ m_pDbMetaDataHelper = new MDatabaseMetaDataHelper();
+
+}
+// -------------------------------------------------------------------------
+ODatabaseMetaData::~ODatabaseMetaData()
+{
+ delete m_pDbMetaDataHelper;
+}
+
+// -------------------------------------------------------------------------
+ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
+ const ::rtl::OUString& tableNamePattern,
+ const ::rtl::OUString& columnNamePattern ) throw(SQLException)
+{
+ static ODatabaseMetaDataResultSet::ORows aRows;
+ ODatabaseMetaDataResultSet::ORow aRow(19);
+
+ ODatabaseMetaDataResultSet::ORows().swap(aRows); // this makes real clear where memory is freed as well
+ aRows.clear();
+
+
+ const ::std::vector< ::rtl::OUString > colNames = m_pConnection->getColumnAlias().getAlias();
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::std::vector< ::rtl::OUString > tables = m_pDbMetaDataHelper->getTableStrings( m_pConnection );
+
+ // ****************************************************
+ // Some entries in a row never change, so set them now
+ // ****************************************************
+
+ // Catalog
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii(""));
+ // Schema
+ aRow[2] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii(""));
+ // DATA_TYPE
+ aRow[5] = new ORowSetValueDecorator(static_cast<sal_Int16>(DataType::VARCHAR));
+ // TYPE_NAME, not used
+ aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"));
+ // COLUMN_SIZE
+ aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE);
+ // BUFFER_LENGTH, not used
+ aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue();
+ // DECIMAL_DIGITS.
+ aRow[9] = new ORowSetValueDecorator(s_nDECIMAL_DIGITS);
+ // NUM_PREC_RADIX
+ aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
+ // NULLABLE
+ aRow[11] = new ORowSetValueDecorator(s_nNULLABLE);
+ // REMARKS
+ aRow[12] = ODatabaseMetaDataResultSet::getEmptyValue();
+ // COULUMN_DEF, not used
+ aRow[13] = ODatabaseMetaDataResultSet::getEmptyValue();
+ // SQL_DATA_TYPE, not used
+ aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue();
+ // SQL_DATETIME_SUB, not used
+ aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue();
+ // CHAR_OCTET_LENGTH, refer to [5]
+ aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH);
+ // IS_NULLABLE
+ aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES"));
+
+ // Iterate over all tables
+ for(sal_Int32 j = 0; j < tables.size(); j++ ) {
+ if(match(tableNamePattern, tables[j],'\0')) {
+ // TABLE_NAME
+ aRow[3] = new ORowSetValueDecorator( tables[j] );
+
+ OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
+
+ // Iterate over all collumns in the table.
+ for ( sal_Int32 i = 0; i < colNames.size(); i++ ) {
+ if(match(columnNamePattern, colNames[i],'\0')) {
+ OSL_TRACE( "\t\t\tColumnName = %s;\n",OUtoCStr( colNames[i] ));
+ // COLUMN_NAME
+ aRow[4] = new ORowSetValueDecorator( colNames[i] );
+ // ORDINAL_POSITION
+ aRow[17] = new ORowSetValueDecorator(i);
+ aRows.push_back(aRow);
+ }
+ }
+ }
+ }
+ return( aRows );
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aVal;
+ if(m_bUseCatalog)
+ { // do some special here for you database
+ }
+
+ return aVal;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTablesInSelect( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 1; // We only support a single table
+ return nValue;
+}
+// -------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aVal;
+ if(m_bUseCatalog)
+ {
+ }
+ return aVal;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException)
+{
+ // normally this is "
+ ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\"");
+ return aVal;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aVal;
+ return aVal;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
+{
+ sal_Bool bValue = sal_False;
+ if(m_bUseCatalog)
+ {
+ }
+ return bValue;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInDataManipulation( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException)
+{
+ return sal_True; // should be supported at least
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatements( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException)
+{
+ // We allow you to select from any table.
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException)
+{
+ // For now definately read-only, no support for update/delete
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException)
+{
+ // Support added for this.
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
+{
+ // Any case may be used
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return m_pConnection->getConnectionURL();
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)1);
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue = ::rtl::OUString::valueOf((sal_Int32)0);
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException)
+{
+ return 1;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException)
+{
+ return TransactionIsolation::NONE;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException)
+{
+ return 0;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUString aValue;
+ return aValue;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException)
+{
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
+{
+ sal_Int32 nValue = 0; // 0 means no limit
+ return nValue;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQLException, RuntimeException)
+{
+ return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle);
+}
+// -------------------------------------------------------------------------
+// here follow all methods which return a resultset
+// the first methods is an example implementation how to use this resultset
+// of course you could implement it on your and you should do this because
+// the general way is more memory expensive
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
+{
+ // there exists no possibility to get table types so we have to check
+ static ::rtl::OUString sTableTypes[] =
+ {
+ ::rtl::OUString::createFromAscii("TABLE"),
+ //
+ // Currently we only support a 'TABLE' nothing more complex
+ //
+ // ::rtl::OUString::createFromAscii("VIEW"),
+ // ::rtl::OUString::createFromAscii("SYSTEM TABLE"),
+ // ::rtl::OUString::createFromAscii("GLOBAL TEMPORARY"),
+ // ::rtl::OUString::createFromAscii("LOCAL TEMPORARY"),
+ // ::rtl::OUString::createFromAscii("ALIAS"),
+ // ::rtl::OUString::createFromAscii("SYNONYM")
+ };
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xRef = pResult;
+ // this call initialies the resultset metadata with the corresponding information
+ pResult->setTableTypes();
+
+ // here we fill the rows which should be visible when ask for data from the resultset returned here
+ sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
+ ODatabaseMetaDataResultSet::ORows aRows;
+ for(sal_Int32 i=0;i < nSize;++i)
+ {
+ ODatabaseMetaDataResultSet::ORow aRow;
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(sTableTypes[i]));
+ // bound row
+ ODatabaseMetaDataResultSet::ORow::iterator aIter = aRow.begin();
+ aRows.push_back(aRow);
+ }
+ // here we set the rows at the resultset
+ pResult->setRows(aRows);
+ return xRef;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo( ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setTypeInfoMap();
+ static ODatabaseMetaDataResultSet::ORows aRows;
+
+ if(aRows.empty())
+ {
+ ODatabaseMetaDataResultSet::ORow aRow;
+ aRow.reserve(19);
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")));
+ aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ // aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
+ aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
+
+ aRows.push_back(aRow);
+
+ aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"));
+ aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
+ aRow[3] = new ORowSetValueDecorator((sal_Int32)65535);
+ aRows.push_back(aRow);
+ }
+ pResultSet->setRows(aRows);
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setCatalogsMap();
+ return xResultSet;
+}
+// -----------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setSchemasMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
+ const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setColumnPrivilegesMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
+ const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
+ const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setColumnsMap();
+ pResultSet->setRows( getColumnRows( tableNamePattern, columnNamePattern ));
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
+ const Any& catalog, const ::rtl::OUString& schemaPattern,
+ const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setTablesMap();
+
+ // ODatabaseMetaDataResultSet::ORows aRows;
+ // aRows = m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern );
+ // pResultSet->setRows( aRows );
+ pResultSet->setRows( m_pDbMetaDataHelper->getTables( m_pConnection, tableNamePattern ) );
+
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
+ const Any& catalog, const ::rtl::OUString& schemaPattern,
+ const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setProcedureColumnsMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
+ const Any& catalog, const ::rtl::OUString& schemaPattern,
+ const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setProceduresMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setVersionColumnsMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setExportedKeysMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setImportedKeysMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setPrimaryKeysMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
+ sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setIndexInfoMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
+ const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
+ sal_Bool nullable ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setBestRowIdentifierMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
+ const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setTablePrivilegesMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
+ const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
+ const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
+ const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
+{
+ // this returns an empty resultset where the column-names are already set
+ // in special the metadata of the resultset already returns the right columns
+ ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xResultSet = pResultSet;
+ pResultSet->setCrossReferenceMap();
+ return xResultSet;
+}
+// -------------------------------------------------------------------------
+Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
+{
+ OSL_ENSURE(0,"Not implemented yet!");
+ throw SQLException();
+ return NULL;
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
new file mode 100644
index 000000000000..2e455962be52
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDatabaseMetaData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SDATABASEMETADATA_HXX
+#define CONNECTIVITY_SDATABASEMETADATA_HXX
+#include "MConnection.hxx"
+#include "mozillasrc/MDatabaseMetaDataHelper.hxx"
+
+#ifndef _CONNECTIVITY_ODATABASEMETADATABASE_HXX_
+#include "TDatabaseMetaDataBase.hxx"
+#endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ //**************************************************************
+ //************ Class: ODatabaseMetaData
+ //**************************************************************
+
+ class ODatabaseMetaData : public ODatabaseMetaDataBase
+ {
+ OConnection* m_pConnection;
+ sal_Bool m_bUseCatalog;
+ MDatabaseMetaDataHelper* m_pDbMetaDataHelper;
+
+ ODatabaseMetaDataResultSet::ORows& SAL_CALL getColumnRows( const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw( ::com::sun::star::sdbc::SQLException );
+
+ public:
+
+ inline OConnection* getOwnConnection() const { return m_pConnection; }
+
+ ODatabaseMetaData(OConnection* _pCon);
+ virtual ~ODatabaseMetaData();
+
+
+ // as I mentioned before this interface is really BIG
+ // XDatabaseMetaData
+ virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // CONNECTIVITY_SDATABASEMETADATA_HXX
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
new file mode 100644
index 000000000000..9e446e997e2e
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDriver.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "MDriver.hxx"
+#include "MConnection.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace connectivity::mozab;
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ //------------------------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
+ {
+ return *(new MozabDriver( _rxFactory ));
+ }
+ }
+}
+// --------------------------------------------------------------------------------
+MozabDriver::MozabDriver(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
+ : ODriver_BASE(m_aMutex), m_xMSFactory( _rxFactory )
+{
+}
+// --------------------------------------------------------------------------------
+void MozabDriver::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ // when driver will be destroied so all our connections have to be destroied as well
+ for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
+ {
+ Reference< XComponent > xComp(i->get(), UNO_QUERY);
+ if (xComp.is())
+ xComp->dispose();
+ }
+ m_xConnections.clear();
+
+ ODriver_BASE::disposing();
+}
+
+// static ServiceInfo
+//------------------------------------------------------------------------------
+rtl::OUString MozabDriver::getImplementationName_Static( ) throw(RuntimeException)
+{
+ return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.MozabDriver");
+ // this name is referenced in the configuration and in the mozab.xml
+ // Please take care when changing it.
+}
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > MozabDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
+{
+ // which service is supported
+ // for more information @see com.sun.star.sdbc.Driver
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver");
+ return aSNS;
+}
+
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL MozabDriver::getImplementationName( ) throw(RuntimeException)
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------
+sal_Bool SAL_CALL MozabDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
+ ;
+
+ return pSupported != pEnd;
+}
+
+//------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL MozabDriver::getSupportedServiceNames( ) throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+
+// --------------------------------------------------------------------------------
+Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
+{
+ // create a new connection with the given properties and append it to our vector
+ OConnection* pCon = new OConnection(this);
+ Reference< XConnection > xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
+ pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so
+ m_xConnections.push_back(WeakReferenceHelper(*pCon));
+
+ return xCon;
+}
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL MozabDriver::acceptsURL( const ::rtl::OUString& url )
+ throw(SQLException, RuntimeException)
+{
+ // here we have to look if we support this url format
+ return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:address:"),13));
+}
+// --------------------------------------------------------------------------------
+Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
+{
+ // if you have somthing special to say return it here :-)
+ return Sequence< DriverPropertyInfo >();
+}
+// --------------------------------------------------------------------------------
+sal_Int32 SAL_CALL MozabDriver::getMajorVersion( ) throw(RuntimeException)
+{
+ return 1; // depends on you
+}
+// --------------------------------------------------------------------------------
+sal_Int32 SAL_CALL MozabDriver::getMinorVersion( ) throw(RuntimeException)
+{
+ return 0; // depends on you
+}
+// --------------------------------------------------------------------------------
+
+
+
diff --git a/connectivity/source/drivers/mozab/MDriver.hxx b/connectivity/source/drivers/mozab/MDriver.hxx
new file mode 100644
index 000000000000..0dedf08b6715
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MDriver.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDriver.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SDRIVER_HXX
+#define CONNECTIVITY_SDRIVER_HXX
+
+#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_
+#include <com/sun/star/sdbc/XDriver.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _CPPUHELPER_COMPBASE2_HXX_
+#include <cppuhelper/compbase2.hxx>
+#endif
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "connectivity/CommonTools.hxx"
+#endif
+
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MozabDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
+ ::com::sun::star::lang::XServiceInfo > ODriver_BASE;
+
+ class MozabDriver : public ODriver_BASE
+ {
+ protected:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMSFactory;
+
+ ::osl::Mutex m_aMutex; // mutex is need to control member access
+ connectivity::OWeakRefArray m_xConnections; // vector containing a list
+ // of all the Connection objects
+ // for this Driver
+ public:
+
+ MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDriver
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException);
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ & getMSFactory(void) const { return m_xMSFactory; }
+
+ };
+ }
+
+}
+
+#endif // CONNECTIVITY_SDRIVER_HXX
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
new file mode 100644
index 000000000000..4024ad89ca21
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
@@ -0,0 +1,668 @@
+/*************************************************************************
+ *
+ * $RCSfile: MPreparedStatement.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#include "MColumn.hxx"
+#include "MPreparedStatement.hxx"
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#include "MResultSetMetaData.hxx"
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include "connectivity/dbtools.hxx"
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+using namespace ::comphelper;
+using namespace connectivity;
+using namespace connectivity::mozab;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+
+IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mozab.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+
+
+OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql)
+ :OStatement_BASE2(_pConnection)
+ ,m_aTypeInfo(_TypeInfo)
+ ,m_bPrepared(sal_False)
+ ,m_sSqlStatement(sql)
+ ,m_nNumParams(0)
+{
+}
+// -----------------------------------------------------------------------------
+OPreparedStatement::~OPreparedStatement()
+{
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OPreparedStatement::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ if(m_pResultSet)
+ m_pResultSet->release();
+
+ clearMyResultSet();
+
+ OStatement_BASE2::disposing();
+
+ m_xMetaData = NULL;
+ if(m_aParameterRow.isValid())
+ {
+ m_aParameterRow->clear();
+ m_aParameterRow = NULL;
+ }
+ m_xParamColumns = NULL;
+}
+// -----------------------------------------------------------------------------
+
+void OPreparedStatement::parseSql( const ::rtl::OUString& sql ) throw (
+ ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
+{
+ OSL_TRACE("In/Out :: OPreparedStatement::parseSql()");
+ OStatement_Base::parseSql( sql );
+
+ 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);
+
+ m_pResultSet = createResultSet();
+ m_pResultSet->acquire();
+ m_xResultSet = Reference<XResultSet>(m_pResultSet);
+ initializeResultSet(m_pResultSet);
+}
+
+// -----------------------------------------------------------------------------
+
+OResultSet* OPreparedStatement::createResultSet( )
+{
+ OSL_TRACE("In/Out : OPreparedStatement::createResultSet( )");
+ return new OResultSet( this, m_aSQLIterator );
+}
+
+// -----------------------------------------------------------------------------
+void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
+{
+ OStatement_Base::initializeResultSet( _pResult );
+
+ OSL_TRACE("In/Out : OPreparedStatement::initializeResultSet( )");
+ _pResult->setParameterColumns(m_xParamColumns);
+ _pResult->setParameterRow(m_aParameterRow);
+}
+
+// -----------------------------------------------------------------------------
+void SAL_CALL OPreparedStatement::acquire() throw(::com::sun::star::uno::RuntimeException)
+{
+ OStatement_BASE2::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPreparedStatement::release() throw(::com::sun::star::uno::RuntimeException)
+{
+ OStatement_BASE2::release();
+}
+// -----------------------------------------------------------------------------
+Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = OStatement_BASE2::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = OPreparedStatement_BASE::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+::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());
+}
+// -------------------------------------------------------------------------
+
+Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ if(!m_xMetaData.is())
+ m_xMetaData = new OResultSetMetaData( m_aSQLIterator.getSelectColumns(), m_aSQLIterator.getTables().begin()->first ,m_pTable );
+ 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);
+
+
+ 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();
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ // same as in statement with the difference that this statement also can contain parameter
+ OSL_TRACE("In/Out: OPreparedStatement::executeUpdate" );
+ return 0;
+}
+// -------------------------------------------------------------------------
+
+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);
+
+ OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
+ setParameter( parameterIndex, x );
+}
+// -------------------------------------------------------------------------
+
+Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ return (Reference< XConnection >)m_pConnection;
+}
+// -------------------------------------------------------------------------
+
+Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ Reference< XResultSet > rs = OStatement_Base::executeQuery( m_sSqlStatement );
+
+ OSL_TRACE("In/Out: OPreparedStatement::executeQuery" );
+ return rs;
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+
+void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ checkAndResizeParameters(parameterIndex);
+
+ (*m_aParameterRow)[parameterIndex].setNull();
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
+{
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+
+void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OPreparedStatement::addBatch( ) throw(SQLException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+
+Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLException, RuntimeException)
+{
+ return Sequence< sal_Int32 > ();
+}
+// -------------------------------------------------------------------------
+void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
+{
+ switch(nHandle)
+ {
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ break;
+ case PROPERTY_ID_RESULTSETTYPE:
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ break;
+ case PROPERTY_ID_USEBOOKMARKS:
+ break;
+ default:
+ OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
+ }
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex)
+{
+ if( !_parameterIndex || _parameterIndex > m_nNumParams)
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
+{
+ ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ if ( !m_aParameterRow.isValid() ) {
+ m_aParameterRow = new OValueVector();
+ m_aParameterRow->push_back(sal_Int32(0));
+ }
+
+ if ((sal_Int32)(*m_aParameterRow).size() <= parameterIndex)
+ (*m_aParameterRow).resize(parameterIndex+1);
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const
+ORowSetValue& x)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkAndResizeParameters(parameterIndex);
+
+ OSL_TRACE("setParameter( %d, '%s')", parameterIndex, OUtoCStr(x) );
+ (*m_aParameterRow)[parameterIndex] = x;
+}
+
+//------------------------------------------------------------------
+sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol)
+{
+
+ // Nr. des neu hinzuzufuegenden Parameters:
+ sal_uInt32 nParameter = m_xParamColumns->size()+1;
+
+ OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter");
+ OSL_ENSURE(pParameter->count() > 0,"OResultSet: Fehler im Parse Tree");
+ OSQLParseNode * pMark = pParameter->getChild(0);
+
+ ::rtl::OUString sParameterName;
+
+ // Parameter-Column aufsetzen:
+ sal_Int32 eType = DataType::VARCHAR;
+ sal_uInt32 nPrecision = 255;
+ sal_Int32 nScale = 0;
+ sal_Int32 nNullable = ColumnValue::NULLABLE;
+
+ if (_xCol.is())
+ {
+ // Typ, Precision, Scale ... der angegebenen Column verwenden,
+ // denn dieser Column wird der Wert zugewiesen bzw. mit dieser
+ // Column wird der Wert verglichen.
+ eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
+ nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
+ nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
+ nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
+ _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName;
+ }
+
+ Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName
+ ,::rtl::OUString()
+ ,::rtl::OUString()
+ ,nNullable
+ ,nPrecision
+ ,nScale
+ ,eType
+ ,sal_False
+ ,sal_False
+ ,sal_False
+ ,m_aSQLIterator.isCaseSensitive());
+ m_xParamColumns->push_back(xParaColumn);
+ return nParameter;
+}
+// -----------------------------------------------------------------------------
+void OPreparedStatement::describeColumn(OSQLParseNode*
+_pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable)
+{
+ Reference<XPropertySet> xProp;
+ if(SQL_ISRULE(_pNode,column_ref))
+ {
+ ::rtl::OUString sColumnName,sTableRange;
+ m_aSQLIterator.getColumnRange(_pNode,sColumnName,sTableRange);
+ if(sColumnName.getLength())
+ {
+ Reference<XNameAccess> xNameAccess = _xTable->getColumns();
+ if(xNameAccess->hasByName(sColumnName))
+ xNameAccess->getByName(sColumnName) >>= xProp;
+ AddParameter(_pParameter,xProp);
+ }
+ }
+ // else
+ // AddParameter(_pParameter,xProp);
+}
+// -------------------------------------------------------------------------
+void OPreparedStatement::describeParameter()
+{
+ ::std::vector< OSQLParseNode*> aParseNodes;
+ scanParameter(m_pParseTree,aParseNodes);
+ if(aParseNodes.size())
+ {
+ m_xParamColumns = new OSQLColumns();
+ const OSQLTables& xTabs = m_aSQLIterator.getTables();
+ if(xTabs.size())
+ {
+ OSQLTable xTable = xTabs.begin()->second;
+ ::std::vector< OSQLParseNode*>::const_iterator aIter =
+aParseNodes.begin();
+ for (;aIter != aParseNodes.end();++aIter )
+ {
+ describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
+{
+ OSL_ENSURE(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode");
+
+ // Parameter Name-Regel gefunden?
+ if (SQL_ISRULE(pParseNode,parameter))
+ {
+ OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft");
+ OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft");
+
+ _rParaNodes.push_back(pParseNode);
+ // Weiterer Abstieg nicht erforderlich
+ return;
+ }
+
+ // Weiter absteigen im Parse Tree
+ for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
+ scanParameter(pParseNode->getChild(i),_rParaNodes);
+}
+
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
new file mode 100644
index 000000000000..bd911c0ce208
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * $RCSfile: MPreparedStatement.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX
+#define CONNECTIVITY_SPREPAREDSTATEMENT_HXX
+#include "MResultSet.hxx"
+#include "MStatement.hxx"
+
+#ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_
+#include <com/sun/star/sdbc/XParameters.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XPREPAREDBATCHEXECUTION_HPP_
+#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+
+ class OBoundParam;
+ typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement,
+ ::com::sun::star::sdbc::XParameters,
+ ::com::sun::star::sdbc::XPreparedBatchExecution,
+ ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
+
+ class OPreparedStatement : public OStatement_BASE2,
+ public OPreparedStatement_BASE
+ {
+ protected:
+ struct Parameter
+ {
+ ::com::sun::star::uno::Any aValue;
+ sal_Int32 nDataType;
+
+ Parameter(const ::com::sun::star::uno::Any& rValue,
+ sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType)
+ {
+ }
+
+ };
+
+ ::std::vector< Parameter> m_aParameters;
+ //====================================================================
+ // Data attributes
+ //====================================================================
+ TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry
+ // for each row returned by
+ // DatabaseMetaData.getTypeInfo.
+
+ sal_Int32 m_nNumParams; // Number of parameter markers
+ // for the prepared statement
+
+ ::rtl::OUString m_sSqlStatement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
+ sal_Bool m_bPrepared;
+ OResultSet* m_pResultSet;
+ ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns
+ OValueRow m_aParameterRow;
+
+
+ void checkParameterIndex(sal_Int32 _parameterIndex);
+
+ protected:
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::uno::Exception);
+ virtual ~OPreparedStatement();
+
+ virtual void SAL_CALL disposing();
+ virtual void parseSql( const ::rtl::OUString& sql ) 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();
+
+ 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 TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql);
+
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPreparedStatement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XParameters
+ virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ 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);
+ // XPreparedBatchExecution
+ virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) 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);
+ };
+ }
+}
+#endif // CONNECTIVITY_SPREPAREDSTATEMENT_HXX
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
new file mode 100644
index 000000000000..524cc0c9534d
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MResultSet.cxx
@@ -0,0 +1,2097 @@
+/*************************************************************************
+ *
+ * $RCSfile: MResultSet.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
+#include <com/sun/star/sdbcx/CompareBookmark.hpp>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_TSORTINDEX_HXX_
+#include <TSortIndex.hxx>
+#endif
+
+#include <rtl/string.hxx>
+#include <vector>
+
+#include "MResultSet.hxx"
+#include "MResultSetMetaData.hxx"
+
+#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
+#include "FDatabaseMetaDataResultSet.hxx"
+#endif
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+using namespace ::comphelper;
+using namespace connectivity;
+using namespace connectivity::mozab;
+using namespace ::cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+
+//------------------------------------------------------------------------------
+// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
+::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.mozab.ResultSet");
+}
+// -------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(2);
+ aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet");
+ aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet");
+ return aSupported;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException)
+{
+ Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
+ ;
+
+ return pSupported != pEnd;
+}
+
+// -------------------------------------------------------------------------
+OResultSet::OResultSet(OStatement_Base* pStmt, connectivity::OSQLParseTreeIterator& _aSQLIterator )
+ : OResultSet_BASE(m_aMutex)
+ ,OPropertySetHelper(OResultSet_BASE::rBHelper)
+ ,m_aStatement((OWeakObject*)pStmt)
+ ,m_nRowPos(0)
+ ,m_bLastRecord(sal_False)
+ ,m_bEOF(sal_False)
+ ,m_xMetaData(NULL)
+ ,m_bInserting(sal_False)
+ ,m_nLastColumnPos(0)
+ ,m_nIsAlwaysFalseQuery(sal_False)
+ ,m_nParamIndex(0)
+ ,m_nRowCountResult(-1)
+ ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
+ ,m_aQuery(pStmt->getOwnConnection()->getColumnAlias().getAliasMap())
+ ,m_pKeySet(NULL)
+ ,m_pStatement(pStmt)
+ ,m_pParseTree(_aSQLIterator.getParseTree())
+ ,m_aSQLIterator(_aSQLIterator)
+ ,m_nIsBookmarkable(sal_False)
+ ,m_nFetchSize(0)
+ ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
+ ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
+ ,m_nFetchDirection(FetchDirection::FORWARD)
+{
+ m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords());
+}
+// -------------------------------------------------------------------------
+OResultSet::~OResultSet()
+{
+}
+
+// -------------------------------------------------------------------------
+void OResultSet::disposing(void)
+{
+ OPropertySetHelper::disposing();
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_aStatement = NULL;
+ m_xMetaData = NULL;
+ m_pParseTree = NULL;
+ m_xColumns = NULL;
+ m_xParamColumns = NULL;
+ m_pKeySet = NULL;
+ if(m_pTable)
+ {
+ m_pTable->release();
+ m_pTable = NULL;
+ }
+}
+// -------------------------------------------------------------------------
+Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = OPropertySetHelper::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = OResultSet_BASE::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+ Sequence< Type > SAL_CALL OResultSet::getTypes( ) throw( RuntimeException)
+{
+ OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
+ ::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
+ ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
+
+ return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
+{
+
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // find the first column with the name columnName
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XResultSetMetaData > xMeta = getMetaData();
+ sal_Int32 nLen = xMeta->getColumnCount();
+ sal_Int32 i = 1;
+ for(;i<=nLen;++i)
+ if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
+ columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
+ break;
+ return i;
+}
+// -------------------------------------------------------------------------
+Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ return NULL;
+}
+// -------------------------------------------------------------------------
+Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ return NULL;
+}
+
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ m_bWasNull = sal_True;
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+
+sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ sal_Int8 nRet = 0;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return Sequence< sal_Int8 >();
+}
+// -------------------------------------------------------------------------
+
+Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ Date nRet;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ double nRet = 0;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ float nVal(0);
+ return nVal;
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ sal_Int32 nRet=0;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ sal_Int32 nValue = 0;
+ OSL_TRACE("In/Out: OResultSet::getRow" );
+ return nValue;
+}
+// -------------------------------------------------------------------------
+
+sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return sal_Int64();
+}
+// -------------------------------------------------------------------------
+
+Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ if(!m_xMetaData.is())
+ m_xMetaData = new OResultSetMetaData( m_aSQLIterator.getSelectColumns(), m_aSQLIterator.getTables().begin()->first ,m_pTable );
+ return m_xMetaData;
+}
+// -------------------------------------------------------------------------
+Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return NULL;
+}
+
+// -------------------------------------------------------------------------
+
+Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return NULL;
+}
+// -------------------------------------------------------------------------
+Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return NULL;
+}
+// -------------------------------------------------------------------------
+
+Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return NULL;
+}
+// -------------------------------------------------------------------------
+
+Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return Any();
+}
+// -------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ sal_Int16 nRet=0;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
+{
+ if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->size())
+ ::dbtools::throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+sal_uInt32 OResultSet::currentRowCount()
+{
+ if ( m_nRowCountResult != -1 )
+ return m_nRowCountResult;
+ if ( m_pKeySet.isValid() )
+ return m_pKeySet->size();
+ else
+ return m_aQuery.getRealRowCount();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool OResultSet::fetchRow(sal_uInt32 rowIndex) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ ORowSetValue value;
+ ::rtl::OUString sTableColumnName;
+ Reference<XPropertySet> xTableColumn;
+ Reference<XIndexAccess> xNames(m_xTableColumns,UNO_QUERY);
+ const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+
+ // Check whether we've already fetched the row...
+ if ( !(*m_aRow)[0].isNull() && (sal_Int32)(*m_aRow)[0] == (sal_Int32)rowIndex )
+ return sal_True;
+
+ if ( validRow( rowIndex ) == sal_False )
+ return sal_False;
+
+#ifndef DARREN_WORK
+ (*m_aRow)[0] = (sal_Int32)rowIndex;
+ for( sal_Int32 i = 1; i < xNames->getCount(); i++ ) {
+#else /* DARREN_WORK */
+ for( sal_Int32 i = 1; i < xNames->getCount(); i++ ) {
+#endif /* DARREN_WORK */
+ if ( (*m_aRow)[i].isBound() ) {
+ OSL_TRACE("Row[%d] is Bound", i );
+ xNames->getByIndex(i-1) >>= xTableColumn;
+ OSL_ENSURE(xTableColumn.is(), "OResultSet::fetchRow: invalid table column!");
+ if (xTableColumn.is())
+ xTableColumn->getPropertyValue(sPropertyName) >>= sTableColumnName;
+ else
+ sTableColumnName = ::rtl::OUString();
+
+ OSL_TRACE("getValue : columnName is : %s ", OUtoCStr( sTableColumnName ) );
+ //
+ // Everything in the addressbook is a string!
+ //
+ m_aQuery.getRowValue( value, rowIndex, sTableColumnName, DataType::VARCHAR );
+ OSL_TRACE("getValue : %s returned", OUtoCStr( value ) );
+ (*m_aRow)[i] = value;
+ }
+ else {
+ OSL_TRACE("Row[%d] is NOT Bound", i );
+ }
+ }
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+
+const ORowSetValue& OResultSet::getValue(sal_uInt32 rowIndex, sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ if ( fetchRow( rowIndex ) == sal_False ) {
+ OSL_ASSERT("fetchRow() returned False" );
+ m_bWasNull = sal_True;
+ return *ODatabaseMetaDataResultSet::getEmptyValue();
+ }
+
+ m_bWasNull = (*m_aRow)[columnIndex].isNull();
+ return (*m_aRow)[columnIndex];
+
+#ifdef DARREN_WORK
+ ORowSetValue value;
+ ::rtl::OUString sTableColumnName;
+ Reference<XPropertySet> xTableColumn;
+ Reference<XIndexAccess> xNames(m_xTableColumns,UNO_QUERY);
+ OSL_ENSURE( columnIndex < xNames->getCount(), "Invalid Column Index");
+
+ const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+
+ OSL_TRACE("In/Out: OResultSet::getValue" );
+ OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!");
+
+ xNames->getByIndex(columnIndex) >>= xTableColumn;
+ OSL_ENSURE(xTableColumn.is(), "OResultSet::getValue: invalid table column!");
+ if (xTableColumn.is())
+ xTableColumn->getPropertyValue(sPropertyName) >>= sTableColumnName;
+ else
+ sTableColumnName = ::rtl::OUString();
+
+ //
+ // Everything in the addressbook is a string!
+ //
+ m_aQuery.getRowValue( value, rowIndex, sTableColumnName, DataType::VARCHAR );
+ OSL_TRACE("getValue : %s returned", OUtoCStr( value ) );
+ m_bWasNull = value.isNull();
+ return value;
+#endif /* DARREN_WORK */
+}
+// -------------------------------------------------------------------------
+
+
+::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("In/Out: OResultSet::getString" );
+ OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!");
+ OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->size(), "Trying to access invalid columns number");
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ checkIndex( columnIndex );
+
+ // If this query was sorted then we should have a valid KeySet, so use it
+ if ( m_pKeySet.isValid() ) {
+ OSL_TRACE( "%u <= %u", m_nRowPos, m_pKeySet->size());
+ OSL_ENSURE( m_nRowPos > 0 && m_nRowPos <= m_pKeySet->size(), "Invalid Row Position");
+ return getValue( (*m_pKeySet)[m_nRowPos-1], mapColumn( columnIndex ) );
+ }
+ else
+ return getValue( m_nRowPos, mapColumn( columnIndex ) );
+
+#ifdef DARREN_WORK
+ const ::rtl::OUString sPropertyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+
+ ORowSetValue value;
+ ::rtl::OUString columnName;
+ ((m_xColumns.getBody())[columnIndex-1])->getPropertyValue( sPropertyName ) >>= columnName;
+ // If this query was sorted then we should have a valid KeySet, so use it
+ if ( m_pKeySet.isValid() ) {
+ OSL_TRACE( "%u <= %u", m_nRowPos, m_pKeySet->size());
+ OSL_ENSURE( m_nRowPos > 0 && m_nRowPos <= m_pKeySet->size(), "Invalid Row Position");
+ m_aQuery.getRowValue( value, (*m_pKeySet)[m_nRowPos-1], columnName, DataType::VARCHAR );
+ }
+ else
+ m_aQuery.getRowValue( value, m_nRowPos, columnName, DataType::VARCHAR );
+ OSL_TRACE("getString : %s returned", OUtoCStr( value ) );
+ m_bWasNull = sal_False;
+ return value;
+#endif /* DARREN_WORK */
+}
+// -------------------------------------------------------------------------
+
+Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Time nRet;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+
+DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ DateTime nRet;
+ return nRet;
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ // here you have to implement your movements
+ // return true means there is no data
+ OSL_TRACE("In/Out: OResultSet::isBeforeFirst" );
+ return( m_nRowPos < 1 );
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::isAfterLast" );
+ if ( m_nRowPos > currentRowCount() && m_aQuery.queryComplete()) {
+ return sal_True;
+ }
+
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::isFirst" );
+ return m_nRowPos == 1;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::isLast" );
+ if ( m_nRowPos == currentRowCount() && m_aQuery.queryComplete()) {
+ return sal_True;
+ }
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // move before the first row so that isBeforeFirst returns false
+ OSL_TRACE("In/Out: OResultSet::beforeFirst" );
+ if ( first() )
+ previous();
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::afterLast( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ OSL_TRACE("In/Out: OResultSet::afterLast" );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ if(last())
+ next();
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException)
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ }
+ OSL_TRACE("In/Out: OResultSet::close" );
+ // dispose();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::first" );
+ return seekRow( FIRST_POS );
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::last( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::last" );
+ return seekRow( LAST_POS );
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::absolute" );
+ return seekRow( ABSOLUTE_POS, row );
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::relative" );
+ return seekRow( RELATIVE_POS, row );
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::previous( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::previous" );
+ return seekRow( PRIOR_POS );
+}
+// -------------------------------------------------------------------------
+Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::getStatement" );
+ return m_aStatement.get();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::rowDeleted" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::rowInserted" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::rowUpdated" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::next" );
+ return seekRow( NEXT_POS );
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::wasNull" );
+ return m_bWasNull;
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::cancel( ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ OSL_TRACE("In/Out: OResultSet::cancel" );
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("In/Out: OResultSet::clearWarnings" );
+}
+// -------------------------------------------------------------------------
+Any SAL_CALL OResultSet::getWarnings( ) throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("In/Out: OResultSet::getWarnings" );
+ return Any();
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // you only have to implement this if you want to insert new rows
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ // only when you allow updates
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::deleteRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ // only when you allow insert's
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::moveToCurrentRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ OSL_TRACE("In/Out: OResultSet::moveToCurrentRow" );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
+{
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
+{
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -----------------------------------------------------------------------
+void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+ OSL_TRACE("In/Out: OResultSet::refreshRow" );
+
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+}
+// -------------------------------------------------------------------------
+// XRowLocate
+Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ // if you don't want to support bookmark you must remove the XRowLocate interface
+
+ OSL_TRACE("In/Out: OResultSet::getBookmark" );
+ return Any();
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::moveToBookmark" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("In/Out: OResultSet::moveRelativeToBookmark" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+
+ OSL_TRACE("In/Out: OResultSet::compareBookmarks" );
+ return CompareBookmark::NOT_EQUAL;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw( SQLException, RuntimeException)
+{
+ OSL_TRACE("In/Out: OResultSet::hasOrderedBookmarks" );
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw( SQLException, RuntimeException)
+{
+ throw SQLException();
+}
+// -------------------------------------------------------------------------
+// XDeleteRows
+Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw( SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+ return Sequence< sal_Int32 >();
+}
+// -------------------------------------------------------------------------
+IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
+{
+ Sequence< Property > aProps(6);
+ Property* pProperties = aProps.getArray();
+ sal_Int32 nPos = 0;
+ DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY);
+ DECL_PROP0(FETCHDIRECTION, sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
+ DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
+ DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY);
+
+ return new OPropertyArrayHelper(aProps);
+}
+// -------------------------------------------------------------------------
+IPropertyArrayHelper & OResultSet::getInfoHelper()
+{
+ return *const_cast<OResultSet*>(this)->getArrayHelper();
+}
+// -------------------------------------------------------------------------
+sal_Bool OResultSet::convertFastPropertyValue(
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ switch(nHandle)
+ {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ default:
+ ;
+ }
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+void OResultSet::setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const Any& rValue
+ )
+ throw (Exception)
+{
+ switch(nHandle)
+ {
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ throw Exception();
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ break;
+ default:
+ ;
+ }
+}
+// -------------------------------------------------------------------------
+void OResultSet::getFastPropertyValue(
+ Any& rValue,
+ sal_Int32 nHandle
+ ) const
+{
+ switch(nHandle)
+ {
+#ifdef DARREN_WORK
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ ;
+#else /* DARREN_WORK */
+ case PROPERTY_ID_ISBOOKMARKABLE:
+ // rValue = bool2any(isBookmarkable());
+ rValue = bool2any(m_nIsBookmarkable);
+ break;
+ case PROPERTY_ID_CURSORNAME:
+ // rValue <<= getCursorName();
+ break;
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ rValue <<= (sal_Int32)m_nResultSetConcurrency;
+ break;
+ case PROPERTY_ID_RESULTSETTYPE:
+ rValue <<= m_nResultSetType;
+ break;
+ case PROPERTY_ID_FETCHDIRECTION:
+ rValue <<= m_nFetchDirection;
+ break;
+ case PROPERTY_ID_FETCHSIZE:
+ rValue <<= m_nFetchSize;
+ break;
+#endif /* DARREN_WORK */
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OResultSet::acquire() throw(::com::sun::star::uno::RuntimeException)
+{
+ OResultSet_BASE::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OResultSet::release() throw(::com::sun::star::uno::RuntimeException)
+{
+ OResultSet_BASE::release();
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+}
+// -----------------------------------------------------------------------------
+void OResultSet::initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount)
+{
+ if(!_rRow.isValid())
+ {
+ _rRow = new OValueVector(_nColumnCount);
+ (*_rRow)[0].setBound(sal_True);
+ ::std::for_each(_rRow->begin()+1,_rRow->end(),TSetBound(sal_False));
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+// -------------------------------------------------------------------------
+void OResultSet::fillColumns()
+{
+#ifdef DARREN_WORK
+
+ OSL_TRACE( "IN OResultSet::fillColumns()\n" );
+
+
+ ::rtl::OUString aTypeName;
+
+ m_aAttributeStrings.clear();
+ m_aAttributeStrings.push_back( ::rtl::OUString::createFromAscii("card:URI") );
+
+ Reference< XDatabaseMetaData > xMtd = m_pConnection->getMetaData();
+ ::comphelper::UStringMixEqual aCase(xMtd->storesMixedCaseQuotedIdentifiers());
+
+ Reference< XResultSet > xRes = xMtd->getColumns( Any(),
+ ::rtl::OUString(),
+ m_Name,
+ ::rtl::OUString::createFromAscii("%"));
+ Reference<XRow> xRow(xRes,UNO_QUERY);
+
+ // clear the whole vector stuff
+ if(!m_aColumns.isValid())
+ m_aColumns = new OSQLColumns();
+ else
+ m_aColumns->clear();
+
+ m_aTypes.clear();
+ m_aPrecisions.clear();
+ m_aScales.clear();
+ // reserve some space to speed up this think
+ m_aAttributeStrings.reserve(m_nNR_OF_FIELDS+1);
+ m_aColumns->reserve(m_nNR_OF_FIELDS);
+ m_aTypes.reserve(m_nNR_OF_FIELDS);
+ m_aPrecisions.reserve(m_nNR_OF_FIELDS);
+ m_aScales.reserve(m_nNR_OF_FIELDS);
+
+ for (sal_Int32 i = 1; i <= m_nNR_OF_FIELDS; i++)
+ {
+ ::rtl::OUString aColumnName;
+ sal_Int32 eType = DataType::OTHER;
+ sal_Bool bCurrency = sal_False;
+ sal_Int32 nPrecision = 0; //! ...
+ sal_Int32 nDecimals = 0; //! ...
+ sal_Int32 nNullable = ColumnValue::NULLABLE;
+
+ if(xRes.is() && xRes->next())
+ {
+ aColumnName = xRow->getString(4);
+ eType = xRow->getShort(5);
+ aTypeName = xRow->getString(6);
+ nPrecision = xRow->getInt(7);
+ nDecimals = xRow->getInt(9);
+ nNullable = xRow->getInt(11);
+ }
+ else
+ {
+ OSL_TRACE(0,"OResultSet::fillColumns: getColumns doesn't return a resultset!");
+ }
+ // getColumnInfo( i, aColumnName, eType );
+
+ OSL_TRACE( "inserting string %s\n", OUtoCStr( aColumnName ) );
+ m_aAttributeStrings.push_back( aColumnName );
+
+ // check if the column name already exists
+ ::rtl::OUString aAlias = aColumnName;
+ OSQLColumns::const_iterator aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase);
+ sal_Int32 nExprCnt = 0;
+ while(aFind != m_aColumns->end())
+ {
+ (aAlias = aColumnName) += ::rtl::OUString::valueOf((sal_Int32)++nExprCnt);
+ aFind = connectivity::find(m_aColumns->begin(),m_aColumns->end(),aAlias,aCase);
+ }
+
+ sdbcx::OColumn* pColumn = new sdbcx::OColumn( aAlias, aTypeName, ::rtl::OUString(),
+ nNullable, nPrecision, nDecimals,
+ eType, sal_False, sal_False, bCurrency,
+ aCase.isCaseSensitive() );
+ Reference< XPropertySet> xCol = pColumn;
+ m_aColumns->push_back(xCol);
+ m_aTypes.push_back(eType);
+ m_aPrecisions.push_back(nPrecision);
+ m_aScales.push_back(nDecimals);
+ }
+
+
+ OSL_TRACE( "\tOUT OResultSet::fillColumns()\n" );
+
+#endif /* DARREN_WORK */
+}
+
+// -------------------------------------------------------------------------
+#ifdef DARREN_WORK
+#if defined DEBUG || defined DBG_UTIL
+extern void printParseTree( const OSQLParseNode* parseTree, rtl::OString tab );
+#endif
+#endif /* DARREN_WORK */
+// -------------------------------------------------------------------------
+void OResultSet::parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString )
+{
+ OSL_ENSURE(pNode->count() > 0,"Error parsing parameter in Parse Tree");
+ OSQLParseNode *pMark = pNode->getChild(0);
+
+ // Initialize to empty string
+ rMatchString = ::rtl::OUString::createFromAscii("");
+
+ rtl::OUString aParameterName;
+ if (SQL_ISPUNCTUATION(pMark,"?")) {
+ aParameterName = ::rtl::OUString::createFromAscii("?");
+ }
+ else if (SQL_ISPUNCTUATION(pMark,":")) {
+ aParameterName = pNode->getChild(1)->getTokenValue();
+ }
+ // XXX - Now we know name, what's value????
+ m_nParamIndex ++;
+ OSL_TRACE("Parameter name [%d]: %s\n", m_nParamIndex,
+ OUtoCStr(aParameterName) );
+
+ if ( m_aParameterRow.isValid() ) {
+ OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->size() + 1, "More parameters than values found" );
+ rMatchString = (*m_aParameterRow)[(sal_uInt16)m_nParamIndex];
+ OSL_TRACE("Prop Value : %s\n", OUtoCStr( rMatchString ) );
+ }
+ else {
+ OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
+ }
+}
+
+void OResultSet::analyseWhereClause( const OSQLParseNode* parseTree,
+ ::std::vector< ::rtl::OUString > &matchItems,
+ ::std::vector< MQuery::eSqlOppr > &matchOper,
+ ::std::vector< ::rtl::OUString > &matchValues,
+ connectivity::OSQLParseTreeIterator& m_aSQLIterator)
+{
+ ::rtl::OUString columnName;
+ MQuery::eSqlOppr op;
+ ::rtl::OUString matchString;
+
+ if ( parseTree == NULL )
+ return;
+
+ if ( m_aSQLIterator.getParseTree() != NULL ) {
+ OSL_TRACE("FULL QUERY IS : \n" );
+#ifdef DARREN_WORK
+#if defined DEBUG || defined DBG_UTIL
+ printParseTree( m_aSQLIterator.getParseTree(), "XX " );
+#endif
+#endif /* DARREN_WORK */
+ OSL_TRACE("FULL QUERY IS : \n" );
+
+ ::vos::ORef<OSQLColumns> xColumns = m_aSQLIterator.getParameters();
+ if(xColumns.isValid())
+ {
+ ::rtl::OUString aTabName,aColName,aParameterName,aParameterValue;
+ OSQLColumns::iterator aIter = xColumns->begin();
+ sal_Int32 i = 1;
+ for(;aIter != xColumns->end();++aIter)
+ {
+ (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
+ OSL_TRACE("Prop Column Name : %s\n", OUtoCStr( aColName ) );
+ if ( m_aParameterRow.isValid() ) {
+ aParameterValue = (*m_aParameterRow)[(sal_uInt16)i];
+ OSL_TRACE("Prop Value : %s\n", OUtoCStr( aParameterValue ) );
+ }
+ else {
+ OSL_TRACE("Prop Value : Invalid ParameterRow!\n" );
+ }
+ i++;
+ }
+ }
+
+ }
+#ifdef DARREN_WORK
+#if defined DEBUG || defined DBG_UTIL
+ printParseTree( parseTree, "XX " );
+#endif
+#endif /* DARREN_WORK */
+
+ if ( SQL_ISRULE(parseTree,where_clause) )
+ {
+ OSL_TRACE("analyseSQL : Got WHERE clause\n");
+ // Reset Parameter Counter
+ resetParameters();
+ analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues, m_aSQLIterator);
+ }
+ else if ( SQL_ISRULE(parseTree,where_clause) )
+ {
+ OSL_TRACE("analyseSQL : Got WHERE clause\n");
+ analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues, m_aSQLIterator);
+ }
+ else if ( parseTree->count() == 3 && // Handle ()'s
+ SQL_ISPUNCTUATION(parseTree->getChild(0),"(") &&
+ SQL_ISPUNCTUATION(parseTree->getChild(2),")"))
+ {
+
+ OSL_TRACE("analyseSQL : Got Punctuation ()\n");
+ analyseWhereClause( parseTree->getChild( 1 ), matchItems, matchOper, matchValues,m_aSQLIterator );
+ }
+ else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term)))
+ && parseTree->count() == 3) // Handle AND/OR
+ {
+
+ OSL_TRACE("analyseSQL : Got AND/OR clause\n");
+
+ // TODO - Need to take care or AND, for now match is always OR
+ analyseWhereClause( parseTree->getChild( 0 ), matchItems, matchOper, matchValues, m_aSQLIterator );
+ analyseWhereClause( parseTree->getChild( 2 ), matchItems, matchOper, matchValues, m_aSQLIterator );
+ }
+ else if (SQL_ISRULE(parseTree,comparison_predicate))
+ {
+ OSL_ENSURE(parseTree->count() == 3, "Error parsing COMPARE predicate");
+ if (!(SQL_ISRULE(parseTree->getChild(0),column_ref) ||
+ parseTree->getChild(2)->getNodeType() == SQL_NODE_STRING ||
+ parseTree->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
+ parseTree->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
+ SQL_ISTOKEN(parseTree->getChild(2),TRUE) ||
+ SQL_ISTOKEN(parseTree->getChild(2),FALSE) ||
+ SQL_ISRULE(parseTree->getChild(2),parameter) ||
+ // odbc date
+ (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{"))))
+ {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Statement too complex"),NULL);
+ }
+
+ OSQLParseNode *pPrec = parseTree->getChild(1);
+ if (pPrec->getNodeType() == SQL_NODE_EQUAL)
+ op = MQuery::matchIs;
+ else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
+ op = MQuery::matchIsNot;
+
+ ::rtl::OUString sTableRange;
+ if(SQL_ISRULE(parseTree->getChild(0),column_ref))
+ m_aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange);
+ else if(parseTree->getChild(0)->isToken())
+ columnName = parseTree->getChild(0)->getTokenValue();
+
+ if ( SQL_ISRULE(parseTree->getChild(2),parameter) ) {
+ parseParameter( parseTree->getChild(2), matchString );
+ }
+ else {
+ matchString = parseTree->getChild(2)->getTokenValue();
+ }
+
+ if ( columnName.compareToAscii("0") ==0 && op == MQuery::matchIs &&
+ matchString.compareToAscii("1") == 0 ) {
+ OSL_TRACE("Query always evaluates to FALSE");
+ m_nIsAlwaysFalseQuery = sal_True;
+ }
+ matchItems.push_back( columnName );
+ matchOper.push_back( op );
+ matchValues.push_back( matchString );
+ }
+ else if (SQL_ISRULE(parseTree,like_predicate))
+ {
+ OSL_ENSURE(parseTree->count() >= 4, "Error parsing LIKE predicate");
+
+ OSL_TRACE("analyseSQL : Got LIKE rule\n");
+
+ if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) )
+ {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Invalid Statement - Not a Column"),NULL);
+ }
+
+
+ OSQLParseNode *pColumn;
+ OSQLParseNode *pAtom;
+ OSQLParseNode *pOptEscape;
+ pColumn = parseTree->getChild(0); // Match Item
+ pAtom = parseTree->getChild(parseTree->count()-2); // Match String
+ pOptEscape = parseTree->getChild(parseTree->count()-1); // Opt Escape Rule
+
+ if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
+ pAtom->getNodeType() == SQL_NODE_NAME ||
+ SQL_ISRULE(pAtom,parameter) ||
+ ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_NAME ) ||
+ ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING )
+ ) )
+ {
+#ifdef DARREN_WORK
+#if defined DEBUG || defined DBG_UTIL
+ printParseTree( pAtom, "AnalyseSQL " );
+#endif
+#endif /* DARREN_WORK */
+ OSL_TRACE("analyseSQL : pAtom->count() = %d\n", pAtom->count() );
+#ifdef DBG_UTIL
+ for ( sal_uInt32 i = 0; i < pAtom->count(); ++i )
+ OSL_TRACE("analyseSQL : pAtom (%d) : %d, %d = %s\n", i,
+ (sal_Int32)pAtom->getRuleID(),
+ pAtom->getChild(i)->getNodeType(),
+ OUtoCStr(pAtom->getChild(i)->getTokenValue()));
+#endif
+
+
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Invalid Statement - Not a String"),NULL);
+ }
+
+ const sal_Unicode WILDCARD = '%';
+ const sal_Unicode ALT_WILDCARD = '*';
+ const sal_Unicode MATCHCHAR = '_';
+
+ ::rtl::OUString sTableRange;
+ if(SQL_ISRULE(pColumn,column_ref))
+ m_aSQLIterator.getColumnRange(pColumn,columnName,sTableRange);
+
+ OSL_TRACE("ColumnName = %s\n", OUtoCStr( columnName ) );
+
+ if ( SQL_ISRULE(pAtom,parameter) ) {
+ parseParameter( pAtom, matchString );
+ // Replace all '*' with '%' : UI Usually does this but not with
+ // Parameters for some reason.
+ matchString = matchString.replace( ALT_WILDCARD, WILDCARD );
+ }
+ else
+ {
+ matchString = pAtom->getTokenValue();
+ }
+
+ // Determine where '%' character is...
+
+ if ( matchString.equals( ::rtl::OUString::valueOf( WILDCARD ) ) )
+ {
+ // String containing only a '%' and nothing else
+ op = MQuery::matchExists;
+ // Will be ignored for Exists case, but clear anyway.
+ matchString = ::rtl::OUString::createFromAscii("");
+ }
+ else if ( matchString.indexOf ( WILDCARD ) == -1 &&
+ matchString.indexOf ( MATCHCHAR ) == -1 )
+ {
+ // Simple string , eg. "to match"
+ if ( parseTree->count() == 5 )
+ op = MQuery::matchDoesNotContain;
+ else
+ op = MQuery::matchContains;
+ }
+ else if ( matchString.indexOf ( WILDCARD ) == 0
+ && matchString.lastIndexOf ( WILDCARD ) == matchString.getLength() -1
+ && matchString.indexOf ( WILDCARD, 1 ) == matchString.lastIndexOf ( WILDCARD )
+ && matchString.indexOf( MATCHCHAR ) == -1
+ )
+ {
+ // Relatively simple "%string%" - ie, contains...
+ // Cut '%' from front and rear
+ matchString = matchString.replaceAt( 0, 1, rtl::OUString() );
+ matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
+
+ if ( parseTree->count() == 5 )
+ op = MQuery::matchDoesNotContain;
+ else
+ op = MQuery::matchContains;
+ }
+ else if ( parseTree->count() == 5 )
+ {
+ // We currently can't handle a 'NOT LIKE' when there are '%' or
+ // '_' dispersed throughout
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Statement too complex"),NULL);
+ }
+ else
+ {
+ if ( (matchString.indexOf ( WILDCARD ) == matchString.lastIndexOf ( WILDCARD ))
+ && matchString.indexOf( MATCHCHAR ) == -1
+ )
+ {
+ // One occurance of '%' - no '_' matches...
+ if ( matchString.indexOf ( WILDCARD ) == 0 )
+ {
+ op = MQuery::matchEndsWith;
+ matchString = matchString.replaceAt( 0, 1, rtl::OUString());
+ }
+ else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 )
+ {
+ op = MQuery::matchBeginsWith;
+ matchString = matchString.replaceAt( matchString.getLength() -1 , 1, rtl::OUString() );
+ }
+ else
+ {
+ sal_Int32 pos = matchString.indexOf ( WILDCARD );
+ matchString = matchString.replaceAt( pos, 1,::rtl::OUString::createFromAscii(".*") );
+ op = MQuery::matchRegExp;
+ }
+
+ }
+ else
+ {
+ // Most Complex, need to use an RE
+ sal_Int32 pos = matchString.indexOf ( WILDCARD );
+ while ( (pos = matchString.indexOf ( WILDCARD )) != -1 )
+ {
+ matchString = matchString.replaceAt( pos, 1, ::rtl::OUString::createFromAscii(".*") );
+ }
+
+ pos = matchString.indexOf ( MATCHCHAR );
+ while ( (pos = matchString.indexOf( MATCHCHAR )) != -1 )
+ {
+ matchString = matchString.replaceAt( pos, 1, ::rtl::OUString::createFromAscii(".") );
+ }
+
+ op = MQuery::matchRegExp;
+ }
+ }
+
+ matchItems.push_back( columnName );
+ matchOper.push_back( op );
+ matchValues.push_back( matchString );
+ }
+ else if (SQL_ISRULE(parseTree,test_for_null))
+ {
+ OSL_ENSURE(parseTree->count() >= 3,"Error in ParseTree");
+ OSL_ENSURE(SQL_ISTOKEN(parseTree->getChild(1),IS),"Error in ParseTree");
+
+ if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
+ {
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement - Not a Column"),NULL);
+ }
+
+ if (SQL_ISTOKEN(parseTree->getChild(2),NOT))
+ {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Statement too complex"),NULL);
+ }
+ else
+ op = MQuery::matchExists;
+
+ ::rtl::OUString sTableRange;
+ m_aSQLIterator.getColumnRange(parseTree->getChild(0),columnName,sTableRange);
+
+ matchItems.push_back( columnName );
+ matchOper.push_back( op );
+ matchValues.push_back( rtl::OUString() );
+ }
+ else
+ {
+ OSL_TRACE( "Unexpected statement!!!" );
+
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Invalid Statement - Unexpected"),NULL);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
+void OResultSet::fillRowData()
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ OSL_TRACE( "IN OResultSet::fillRowData()\n" );
+
+ OSL_ENSURE( m_pStatement, "Require a statement" );
+
+ ::std::vector< ::rtl::OUString > matchItems;
+ ::std::vector< MQuery::eSqlOppr > matchOper;
+ ::std::vector< ::rtl::OUString > matchValues;
+
+ OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
+ m_xColumns = m_aSQLIterator.getSelectColumns();
+
+ OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!");
+
+ OSQLColumns::const_iterator aIter = m_xColumns->begin();
+ const ::rtl::OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+ ::rtl::OUString sName;
+ m_aAttributeStrings.clear();
+ for (sal_Int32 i = 1; aIter != m_xColumns->end();++aIter, i++)
+ {
+ (*aIter)->getPropertyValue(sProprtyName) >>= sName;
+ OSL_TRACE("Query Columns : (%d) %s\n", i, OUtoCStr(sName) );
+ m_aAttributeStrings.push_back( sName );
+ }
+
+
+ // Generate Match Conditions for Query
+ const OSQLParseNode* pParseTree = m_aSQLIterator.getWhereTree();
+
+ // const OSQLParseNode* pParseTree = NULL;
+
+ m_nIsAlwaysFalseQuery = sal_False;
+ if ( pParseTree != NULL )
+ {
+ // Extract required info
+
+ OSL_TRACE("\tHave a Where Clause\n");
+
+ analyseWhereClause( pParseTree, matchItems, matchOper, matchValues ,m_aSQLIterator);
+ }
+ else
+ {
+ OSL_TRACE("\tDon't have a Where Clause\n");
+
+ // LDAP does not allow a query without restriction, so we add a dummy
+ // for FirstName
+ // For other types we stick to the old behaviour of using
+ // card:nsIAbCard.
+ OSL_ENSURE(m_pStatement, "Cannot determine Parent Statement");
+ if (xConnection->isLDAP())
+ matchItems.push_back( ::rtl::OUString::createFromAscii("FirstName") );
+ else
+ matchItems.push_back( ::rtl::OUString::createFromAscii("card:nsIAbCard") );
+
+ matchOper.push_back( MQuery::matchExists );
+ matchValues.push_back( ::rtl::OUString() );
+
+// matchItems.push_back( ::rtl::OUString::createFromAscii("DisplayName") );
+// matchOper.push_back( MQuery::matchBeginsWith );
+// matchValues.push_back( ::rtl::OUString::createFromAscii("Darren") );
+// matchItems.push_back( ::rtl::OUString::createFromAscii("PrimaryEmail") );
+// matchOper.push_back( MQuery::matchBeginsWith );
+// matchValues.push_back( ::rtl::OUString::createFromAscii("Darren") );
+ }
+
+ // If the query is a 0=1 then set Row count to 0 and return
+ if ( m_nIsAlwaysFalseQuery ) {
+ m_nRowCountResult = 0;
+ return;
+ }
+
+ m_aQuery.setMatchItems( matchItems );
+ m_aQuery.setSqlOppr( matchOper );
+ m_aQuery.setMatchValues( matchValues );
+
+ // We need a unique id for caching mechanism so should fetch card:URI
+ m_aQuery.setAttributes( m_aAttributeStrings );
+
+ m_aQuery.setAddressbook( m_pTable->getName() );
+
+ sal_Int32 rv = m_aQuery.executeQuery(xConnection->isOutlookExpress());
+ if ( rv == -1 ) {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Error querying addressbook"),NULL);
+ }
+
+ OSL_TRACE( "executeQuery returned %d\n", rv );
+
+ OSL_TRACE( "\tOUT OResultSet::fillRowData()\n" );
+}
+
+// -----------------------------------------------------------------------------
+static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 ) {
+ OValueVector::iterator row1Iter = row1->begin();
+ OValueVector::iterator row2Iter = row2->begin();
+ for ( ++row1Iter,++row2Iter; // the first column is the bookmark column
+ row1Iter != row1->end(); ++row1Iter,++row2Iter) {
+ if ( row1Iter->isBound()) {
+ // Compare values, if at anytime there's a mismatch return false
+ if ( !( (*row1Iter) == (*row2Iter) ) )
+ return sal_False;
+ }
+ }
+
+ // If we get to here the rows match
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ OSL_ENSURE( m_pTable, "Need a Table object");
+ if(!m_pTable)
+ {
+ const OSQLTables& xTabs = m_aSQLIterator.getTables();
+ if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
+ ::dbtools::throwGenericSQLException( ::rtl::OUString::createFromAscii("The statement is invalid."),
+ static_cast<XWeak*>(this),
+ makeAny(m_aSQLIterator.getWarning())
+ );
+
+ m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
+
+ }
+
+ m_nRowPos = 0;
+ m_nRowCountResult = -1;
+
+ fillRowData();
+
+ OSL_ENSURE(m_xColumns.isValid(), "Need the Columns!!");
+
+ sal_Int32 nColumnCount = m_xColumns->size();
+
+ // initializeRow(m_aRow,nColumnCount);
+ // initializeRow(m_aEvaluateRow,nColumnCount);
+
+ sal_uInt32 nLoopCount = 0;
+ switch(m_aSQLIterator.getStatementType())
+ {
+ case SQL_STATEMENT_SELECT:
+ {
+ if(m_nIsAlwaysFalseQuery) {
+ break;
+ }
+ else if(isCount())
+ {
+ m_nRowCountResult = 0;
+ m_aQuery.waitForQueryComplete();
+ m_nRowCountResult = m_aQuery.getRowCount();
+ }
+ else
+ {
+ sal_Bool bDistinct = sal_False;
+ sal_Bool bWasSorted = sal_False;
+ OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
+ if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT
+)
+ {
+ if(!IsSorted())
+ {
+ m_aOrderbyColumnNumber.push_back(m_aColMapping[1]);
+ m_aOrderbyAscending.push_back(SQL_DESC);
+ }
+ else
+ bWasSorted = sal_True;
+ bDistinct = sal_True;
+ }
+
+ OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
+ OValueVector::iterator aRowIter = m_aRow->begin()+1;
+ ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
+ for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
+ {
+ OSL_ENSURE((sal_Int32)m_aRow->size() > *aOrderByIter,"Invalid Index");
+ switch ((m_aRow->begin()+*aOrderByIter)->getTypeKind())
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ eKeyType[i] = SQL_ORDERBYKEY_STRING;
+ break;
+
+ case DataType::OTHER:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ case DataType::BIT:
+ eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
+ break;
+
+ // Andere Typen sind nicht implementiert (und damit immer
+ // FALSE)
+ default:
+ eKeyType[i] = SQL_ORDERBYKEY_NONE;
+ OSL_ASSERT("MResultSet::executeQuery: Order By Data Type not implemented");
+ break;
+ }
+ }
+
+ if (IsSorted())
+ {
+ // Implement Sorting
+
+ // So that we can sort we need to wait until the executed
+ // query to the mozilla addressbooks has returned all
+ // values.
+
+ OSL_TRACE("Query is to be sorted");
+ if( ! m_aQuery.queryComplete() )
+ m_aQuery.waitForQueryComplete();
+
+ OSL_ENSURE( m_aQuery.queryComplete(), "Query not complete!!");
+
+ m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
+
+ OSL_TRACE("OrderbyColumnNumber->size() = %d",m_aOrderbyColumnNumber.size());
+ for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ )
+ OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
+ for ( sal_Int32 nRow = 1; nRow <= m_aQuery.getRowCount(); nRow++ ) {
+
+ OKeyValue* pKeyValue = new OKeyValue(nRow);
+
+ ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
+ for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
+ {
+ ORowSetValue value = getValue(nRow, *aIter);
+
+ OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,
+ OUtoCStr( value ));
+
+ pKeyValue->pushKey(new ORowSetValueDecorator(value));
+ }
+
+ m_pSortIndex->AddKeyValue( pKeyValue );
+ }
+
+ m_pKeySet = m_pSortIndex->CreateKeySet();
+ for( i = 0; i < m_pKeySet->size(); i++ )
+ OSL_TRACE("Sorted: %d -> %d", i, (*m_pKeySet)[i] );
+
+ m_pSortIndex = NULL;
+ beforeFirst(); // Go back to start
+ }
+
+ // Handle the DISTINCT case
+ if ( bDistinct && m_pKeySet.isValid() ) {
+ OValueRow aSearchRow = new OValueVector( m_aRow->size() );
+
+ for( i = 0; i < m_pKeySet->size(); i++ ) {
+ fetchRow( (*m_pKeySet)[i] ); // Fills m_aRow
+ if ( matchRow( m_aRow, aSearchRow ) ) {
+ (*m_pKeySet)[i] = 0; // Marker for later to be removed
+ }
+ else {
+ // They don't match, so it's not a duplicate.
+ // Use the current Row as the next one to match against
+ *aSearchRow = *m_aRow;
+ }
+ }
+ // Now remove any keys marked with a 0
+ m_pKeySet->erase(::std::remove_if(m_pKeySet->begin(),m_pKeySet->end()
+ ,::std::bind2nd(::std::equal_to<sal_Int32>(),0))
+ ,m_pKeySet->end());
+
+ }
+ }
+ } break;
+
+ case SQL_STATEMENT_SELECT_COUNT:
+ case SQL_STATEMENT_UPDATE:
+ case SQL_STATEMENT_DELETE:
+ case SQL_STATEMENT_INSERT:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OResultSet::setBoundedColumns(const OValueRow& _rRow,
+ const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,
+ const Reference<XIndexAccess>& _xNames,
+ sal_Bool _bSetColumnMapping,
+ const Reference<XDatabaseMetaData>& _xMetaData,
+ ::std::vector<sal_Int32>& _rColMapping)
+{
+ ::comphelper::UStringMixEqual aCase(_xMetaData->storesMixedCaseQuotedIdentifiers());
+
+ Reference<XPropertySet> xTableColumn;
+ ::rtl::OUString sTableColumnName, sSelectColumnRealName;
+
+ const ::rtl::OUString sName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
+ const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
+ const ::rtl::OUString sType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
+
+ OValueVector::iterator aRowIter = _rRow->begin()+1;
+ for (sal_Int32 i=0; // the first column is the bookmark column
+ aRowIter != _rRow->end();
+ ++i, ++aRowIter
+ )
+ {
+ try
+ {
+ // get the table column and it's name
+ _xNames->getByIndex(i) >>= xTableColumn;
+ OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
+ if (xTableColumn.is())
+ xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
+ else
+ sTableColumnName = ::rtl::OUString();
+
+ // look if we have such a select column
+ // TODO: would like to have a O(log n) search here ...
+ for ( OSQLColumns::iterator aIter = _rxColumns->begin();
+ aIter != _rxColumns->end();
+ ++aIter
+ )
+ {
+ if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
+ (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
+ else
+ (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
+
+ if (aCase(sTableColumnName, sSelectColumnRealName))
+ {
+ if(_bSetColumnMapping)
+ {
+ sal_Int32 nSelectColumnPos = aIter - _rxColumns->begin() + 1;
+ // the getXXX methods are 1-based ...
+ sal_Int32 nTableColumnPos = i + 1;
+ // get first table column is the bookmark column
+ // ...
+ OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos );
+ _rColMapping[nSelectColumnPos] = nTableColumnPos;
+ }
+
+ aRowIter->setBound(sal_True);
+ sal_Int32 nType = DataType::OTHER;
+ if (xTableColumn.is())
+ xTableColumn->getPropertyValue(sType) >>= nType;
+ aRowIter->setTypeKind(nType);
+ }
+ }
+ }
+ catch (Exception&)
+ {
+ OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!");
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::isCount() const
+{
+ return (m_pParseTree &&
+ m_pParseTree->count() > 2 &&
+ SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist) &&
+ SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column)
+&&
+ SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct)
+ );
+}
+
+// -----------------------------------------------------------------------------
+//
+// Check for valid row in m_aQuery
+//
+sal_Bool OResultSet::validRow( sal_uInt32 nRow )
+{
+ sal_Int32 nNumberOfRecords = m_aQuery.getRealRowCount();
+
+ while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQuery.queryComplete() ) {
+ OSL_TRACE("validRow: waiting...");
+ m_aQuery.checkRowAvailable( nRow );
+ nNumberOfRecords = m_aQuery.getRealRowCount();
+ }
+
+ if (( nRow == 0 ) ||
+ ( nRow > (sal_uInt32)nNumberOfRecords && m_aQuery.queryComplete()) ){
+ OSL_TRACE("validRow(%u): return False", nRow);
+ return sal_False;
+ }
+
+ OSL_TRACE("validRow(%u): return True", nRow);
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
+{
+ sal_Int32 nNumberOfRecords = currentRowCount();
+ sal_Int32 nCurPos = m_nRowPos;
+
+ OSL_TRACE("seekRow: nCurPos = %d", nCurPos );
+ switch( pos ) {
+ case NEXT_POS:
+ OSL_TRACE("seekRow: NEXT");
+ nCurPos++;
+ break;
+ case PRIOR_POS:
+ OSL_TRACE("seekRow: PRIOR");
+ if ( nCurPos > 0 )
+ nCurPos--;
+ break;
+
+ case FIRST_POS:
+ OSL_TRACE("seekRow: FIRST");
+ nCurPos = 1;
+ break;
+
+ case LAST_POS:
+ OSL_TRACE("seekRow: LAST");
+ nCurPos = nNumberOfRecords;
+ break;
+ case ABSOLUTE_POS:
+ OSL_TRACE("seekRow: ABSOLUTE : %d", nOffset);
+ nCurPos = nOffset;
+ break;
+ case RELATIVE_POS:
+ OSL_TRACE("seekRow: RELATIVE : %d", nOffset);
+ nCurPos += sal_uInt32( nOffset );
+ break;
+ }
+ while ( nCurPos > nNumberOfRecords && !m_aQuery.queryComplete() ) {
+ m_aQuery.checkRowAvailable( nCurPos );
+ nNumberOfRecords = currentRowCount();
+ }
+
+ if ( nCurPos <= 0 ) {
+ m_nRowPos = 0;
+ OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
+ return sal_False;
+ }
+ if ( nCurPos > nNumberOfRecords && m_aQuery.queryComplete()) {
+ m_nRowPos = nNumberOfRecords + 1;
+ OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
+ return sal_False;
+ }
+
+ m_nRowPos = (sal_uInt32)nCurPos;
+ OSL_TRACE("seekRow: return True, m_nRowPos = %u", m_nRowPos );
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+#ifndef DARREN_WORK
+void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping)
+{
+ m_aColMapping = _aColumnMapping;
+ for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ )
+ OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] );
+}
+#endif /* DARREN_WORK */
+
diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx
new file mode 100644
index 000000000000..0b7d9b781ecc
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MResultSet.hxx
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * $RCSfile: MResultSet.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SRESULTSET_HXX
+#define CONNECTIVITY_SRESULTSET_HXX
+
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
+#include <com/sun/star/util/XCancellable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#endif
+#ifndef _CPPUHELPER_COMPBASE12_HXX_
+#include <cppuhelper/compbase12.hxx>
+#endif
+#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#include <comphelper/proparrhlp.hxx>
+#endif
+#include "MStatement.hxx"
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "connectivity/CommonTools.hxx"
+#endif
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#include "connectivity/FValue.hxx"
+#endif
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+#include "connectivity/sqliterator.hxx"
+#endif
+#ifndef CONNECTIVITY_TSORTINDEX_HXX
+#include "TSortIndex.hxx"
+#endif
+#include "mozillasrc/MQuery.hxx"
+
+namespace connectivity
+{
+ namespace mozab
+ {
+
+ /*
+ ** java_sql_ResultSet
+ */
+ typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet,
+ ::com::sun::star::sdbc::XRow,
+ ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::sdbc::XWarningsSupplier,
+ ::com::sun::star::sdbc::XResultSetUpdate,
+ ::com::sun::star::sdbc::XRowUpdate,
+ ::com::sun::star::sdbcx::XRowLocate,
+ ::com::sun::star::sdbcx::XDeleteRows,
+ ::com::sun::star::sdbc::XCloseable,
+ ::com::sun::star::sdbc::XColumnLocate,
+ ::com::sun::star::lang::XServiceInfo> OResultSet_BASE;
+
+
+ typedef sal_Int64 TVoidPtr;
+ typedef ::std::allocator< TVoidPtr > TVoidAlloc;
+ typedef ::std::vector<TVoidPtr> TVoidVector;
+
+ class OResultSet : public comphelper::OBaseMutex,
+ public OResultSet_BASE,
+ public ::cppu::OPropertySetHelper,
+ public ::comphelper::OPropertyArrayUsageHelper<OResultSet>
+ {
+ protected:
+ TVoidVector m_aBindVector;
+ ::std::vector<sal_Int32> m_aLengthVector;
+ OStatement_Base* m_pStatement;
+ ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
+ rtl_TextEncoding m_nTextEncoding;
+ sal_uInt32 m_nRowPos;
+ sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are
+ sal_Bool m_bWasNull;
+ sal_Bool m_bBOF; // before first record
+ sal_Bool m_bEOF; // after last record
+ sal_Bool m_bLastRecord;
+ sal_Bool m_bFreeHandle;
+ sal_Bool m_bInserting;
+ sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow
+
+ sal_Bool m_nIsBookmarkable;
+ sal_Int32 m_nFetchSize;
+ sal_Int32 m_nResultSetType;
+ sal_Int32 m_nFetchDirection;
+ sal_Int32 m_nResultSetConcurrency;
+
+
+
+ connectivity::OSQLParseTreeIterator& m_aSQLIterator;
+ const connectivity::OSQLParseNode* m_pParseTree;
+
+ // sal_Bool isBookmarkable() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ // void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ // void fillRow(sal_Int32 _nToColumn);
+ // void allocBuffer(sal_Bool _bAllocRow);
+ // void releaseBuffer();
+
+
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ throw (::com::sun::star::uno::Exception);
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+ // you can't delete objects of this type
+ virtual ~OResultSet();
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OResultSet(OStatement_Base* pStmt, connectivity::OSQLParseTreeIterator& _aSQLIterator );
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this);
+ }
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XResultSet
+ virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XRow
+ virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) 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);
+ // XCancellable
+ virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
+ // XCloseable
+ virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XWarningsSupplier
+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XResultSetUpdate
+ virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XRowUpdate
+ virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XRowLocate
+ virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XDeleteRows
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+protected:
+ MQuery m_aQuery;
+ OTable* m_pTable;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ m_xTableColumns;
+
+ ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
+ ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
+ ::std::vector<sal_Int16> m_aOrderbyAscending;
+ OValueRow m_aRow;
+ OValueRow m_aParameterRow;
+ ::std::vector< ::rtl::OUString> m_aAttributeStrings;
+ sal_Int32 m_nParamIndex;
+ sal_Int32 m_nRowCountResult;
+ sal_Bool m_nIsAlwaysFalseQuery;
+ ::vos::ORef<OKeySet> m_pKeySet;
+ OSortIndex* m_pSortIndex;
+
+
+ inline void resetParameters() { m_nParamIndex = 0; }
+
+ ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns
+ ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns;
+
+ void fillColumns();
+ void parseParameter( const OSQLParseNode* pNode, rtl::OUString& rMatchString );
+ void fillRowData() throw( ::com::sun::star::sdbc::SQLException );
+ void initializeRow(OValueRow& _rRow,sal_Int32 _nColumnCount);
+ void analyseWhereClause( const OSQLParseNode* parseTree,
+ ::std::vector< ::rtl::OUString > &matchItems,
+ ::std::vector< MQuery::eSqlOppr > &matchOper,
+ ::std::vector< ::rtl::OUString > &matchValues,
+ connectivity::OSQLParseTreeIterator& aSQLIterator);
+
+ sal_Bool isCount() const;
+
+ // XXX sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != STRING_NOTFOUND ;}
+ sal_Bool IsSorted() const { return !m_aOrderbyColumnNumber.empty(); }
+
+ enum eRowPosition {
+ NEXT_POS, PRIOR_POS, FIRST_POS, LAST_POS, ABSOLUTE_POS, RELATIVE_POS
+ };
+
+ sal_uInt32 currentRowCount();
+
+ sal_Bool fetchRow(sal_uInt32 rowIndex) throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException);
+ sal_Bool validRow( sal_uInt32 nRow );
+ sal_Bool seekRow( eRowPosition pos, sal_Int32 nOffset = 0 );
+
+ const ORowSetValue& getValue(sal_uInt32 rowIndex, sal_Int32 columnIndex)
+ throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+public:
+ // MozAddressbook Specific methods
+ void SAL_CALL executeQuery() throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException);
+
+ void setTable(OTable* _rTable)
+ { m_pTable = _rTable; m_pTable->acquire();
+ m_xTableColumns = m_pTable->getColumns();
+ }
+
+ void setParameterRow(const OValueRow& _rParaRow)
+ { m_aParameterRow = _rParaRow; }
+
+ void setParameterColumns(const ::vos::ORef<connectivity::OSQLColumns>& _xParamColumns)
+ { m_xParamColumns = _xParamColumns; }
+
+ void setBindingRow(const OValueRow& _aRow)
+ { m_aRow = _aRow; }
+
+#ifdef DARREN_WORK
+ void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping)
+ { m_aColMapping = _aColumnMapping; }
+#else /* DARREN_WORK */
+ void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping);
+#endif /* DARREN_WORK */
+
+ void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy)
+ { m_aOrderbyColumnNumber = _aColumnOrderBy; }
+
+ void setOrderByAscending(const ::std::vector<sal_Int16>& _aOrderbyAsc)
+ { m_aOrderbyAscending = _aOrderbyAsc; }
+
+ inline sal_Int32 mapColumn(sal_Int32 column);
+
+ void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
+
+ static void setBoundedColumns(
+ const OValueRow& _rRow,
+ const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames,
+ sal_Bool _bSetColumnMapping,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ ::std::vector<sal_Int32>& _rColMapping);
+ };
+
+ inline sal_Int32 OResultSet::mapColumn(sal_Int32 column)
+ {
+ sal_Int32 map = column;
+
+ OSL_ENSURE(column > 0, "OResultSet::mapColumn: invalid column index!");
+ // the first column (index 0) is for convenience only. The
+ // first real select column is no 1.
+ if ((column > 0) && (column < (sal_Int32)m_aColMapping.size()))
+ map = m_aColMapping[column];
+
+ return map;
+ }
+
+ }
+}
+#endif // CONNECTIVITY_SRESULTSET_HXX
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
new file mode 100644
index 000000000000..cfc823a40753
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * $RCSfile: MResultSetMetaData.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include "connectivity/dbtools.hxx"
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#include "MResultSetMetaData.hxx"
+
+using namespace connectivity::mozab;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace ::dbtools;
+using namespace ::comphelper;
+
+// -------------------------------------------------------------------------
+OResultSetMetaData::~OResultSetMetaData()
+{
+ m_xColumns = NULL;
+}
+
+// -----------------------------------------------------------------------------
+void OResultSetMetaData::checkColumnIndex(sal_Int32 column) throw(SQLException, RuntimeException)
+{
+ if(column <= 0 || column > (sal_Int32)(sal_Int32)m_xColumns->size())
+ throwInvalidIndexException(*this);
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return getPrecision(column);
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSetMetaData::getColumnCount( ) throw(SQLException, RuntimeException)
+{
+ return (*m_xColumns).size();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL OResultSetMetaData::getSchemaName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL OResultSetMetaData::getColumnName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+
+ Any aName((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
+ return aName.hasValue() ? getString(aName) : getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return m_aTableName;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OResultSetMetaData::getCatalogName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OResultSetMetaData::getColumnTypeName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ return getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)));
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OResultSetMetaData::getColumnLabel( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return getColumnName(column);
+}
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OResultSetMetaData::getColumnServiceName( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ return getBOOL((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)));
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isAutoIncrement( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSetMetaData::isSigned( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
+}
+// -------------------------------------------------------------------------
+sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ checkColumnIndex(column);
+ return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
+}
+// -------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL OResultSetMetaData::isNullable( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ return getINT32((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ OSL_TRACE("In/Out : OResultSetMetaData::isSearchable() : True");
+ return sal_True;
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isReadOnly( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ checkColumnIndex(column);
+ sal_Bool bReadOnly = (*m_xColumns)[column-1]->getPropertySetInfo()->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)) &&
+ ::cppu::any2bool((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FUNCTION)));
+
+ return bReadOnly || m_pTable->isReadOnly();
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OResultSetMetaData::isDefinitelyWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return !isReadOnly(column);
+}
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLException, RuntimeException)
+{
+ return !isReadOnly(column);
+}
+// -------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.hxx b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
new file mode 100644
index 000000000000..6dcbab103a10
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MResultSetMetaData.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: MResultSetMetaData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
+#define CONNECTIVITY_SRESULSETMETADATA_HXX
+
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+#include "MConnection.hxx"
+#include "MTable.hxx"
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ //**************************************************************
+ //************ Class: ResultSetMetaData
+ //**************************************************************
+ typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE;
+
+ class OResultSetMetaData : public OResultSetMetaData_BASE
+ {
+ ::rtl::OUString m_aTableName;
+ ::vos::ORef<connectivity::OSQLColumns> m_xColumns;
+ OTable* m_pTable;
+
+
+ protected:
+ virtual ~OResultSetMetaData();
+ public:
+ // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
+ // OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){}
+ OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,
+ const ::rtl::OUString& _aTableName,OTable* _pTable)
+ : m_xColumns(_rxColumns), m_aTableName(_aTableName), m_pTable(_pTable) {}
+
+
+ /// Avoid ambigous cast error from the compiler.
+ inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw()
+ { return this; }
+
+ void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // CONNECTIVITY_SRESULSETMETADATA_HXX
diff --git a/connectivity/source/drivers/mozab/MServices.cxx b/connectivity/source/drivers/mozab/MServices.cxx
new file mode 100644
index 000000000000..6dee7a8f4083
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MServices.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: MServices.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "MDriver.hxx"
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+using namespace connectivity::mozab;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::registry::XRegistryKey;
+using ::com::sun::star::lang::XSingleServiceFactory;
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc)
+ (
+ const Reference< XMultiServiceFactory > & rServiceManager,
+ const OUString & rComponentName,
+ ::cppu::ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames,
+ rtl_ModuleCount* _pTemp
+ );
+
+//***************************************************************************************
+//
+// Die vorgeschriebene C-Api muss erfuellt werden!
+// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
+//
+
+//---------------------------------------------------------------------------------------
+void REGISTER_PROVIDER(
+ const OUString& aServiceImplName,
+ const Sequence< OUString>& Services,
+ const Reference< ::com::sun::star::registry::XRegistryKey > & xKey)
+{
+ OUString aMainKeyName;
+ aMainKeyName = OUString::createFromAscii("/");
+ aMainKeyName += aServiceImplName;
+ aMainKeyName += OUString::createFromAscii("/UNO/SERVICES");
+
+ Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) );
+ OSL_ENSURE(xNewKey.is(), "MOZAB::component_writeInfo : could not create a registry key !");
+
+ for (sal_uInt32 i=0; i<Services.getLength(); ++i)
+ xNewKey->createKey(Services[i]);
+}
+
+
+//---------------------------------------------------------------------------------------
+struct ProviderRequest
+{
+ Reference< XSingleServiceFactory > xRet;
+ Reference< XMultiServiceFactory > const xServiceManager;
+ OUString const sImplementationName;
+
+ ProviderRequest(
+ void* pServiceManager,
+ sal_Char const* pImplementationName
+ )
+ : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
+ , sImplementationName(OUString::createFromAscii(pImplementationName))
+ {
+ }
+
+ inline
+ sal_Bool CREATE_PROVIDER(
+ const OUString& Implname,
+ const Sequence< OUString > & Services,
+ ::cppu::ComponentInstantiation Factory,
+ createFactoryFunc creator
+ )
+ {
+ if (!xRet.is() && (Implname == sImplementationName))
+ try
+ {
+ xRet = creator( xServiceManager, sImplementationName,Factory, Services,0);
+ }
+ catch(...)
+ {
+ }
+ return xRet.is();
+ }
+
+ void* getProvider() const { return xRet.get(); }
+};
+
+//---------------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **ppEnvTypeName,
+ uno_Environment **ppEnv
+ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//---------------------------------------------------------------------------------------
+extern "C" sal_Bool SAL_CALL component_writeInfo(
+ void* pServiceManager,
+ void* pRegistryKey
+ )
+{
+ if (pRegistryKey)
+ try
+ {
+ Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey));
+
+ REGISTER_PROVIDER(
+ MozabDriver::getImplementationName_Static(),
+ MozabDriver::getSupportedServiceNames_Static(), xKey);
+
+ return sal_True;
+ }
+ catch (::com::sun::star::registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "Mozab::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
+ }
+
+ return sal_False;
+}
+
+//---------------------------------------------------------------------------------------
+extern "C" void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* pRegistryKey)
+{
+ void* pRet = 0;
+ if (pServiceManager)
+ {
+ ProviderRequest aReq(pServiceManager,pImplementationName);
+
+ aReq.CREATE_PROVIDER(
+ MozabDriver::getImplementationName_Static(),
+ MozabDriver::getSupportedServiceNames_Static(),
+ MozabDriver_CreateInstance, ::cppu::createSingleFactory)
+ ;
+
+ if(aReq.xRet.is())
+ aReq.xRet->acquire();
+
+ pRet = aReq.getProvider();
+ }
+
+ return pRet;
+};
+
+
diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx
new file mode 100644
index 000000000000..6930b05b8449
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MStatement.cxx
@@ -0,0 +1,650 @@
+/*************************************************************************
+ *
+ * $RCSfile: MStatement.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX_
+#include <comphelper/uno3.hxx>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+
+
+#include "MDriver.hxx"
+#include "MStatement.hxx"
+#include "MConnection.hxx"
+#include "MResultSet.hxx"
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+
+using namespace ::comphelper;
+using namespace connectivity::mozab;
+using namespace connectivity;
+//------------------------------------------------------------------------------
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::util;
+//------------------------------------------------------------------------------
+OStatement_Base::OStatement_Base(OConnection* _pConnection )
+ : OStatement_BASE(m_aMutex),
+ OPropertySetHelper(OStatement_BASE::rBHelper),
+ rBHelper(OStatement_BASE::rBHelper),
+ m_pConnection(_pConnection),
+ m_pTable(NULL),
+ m_pParseTree(NULL),
+ m_aSQLIterator(_pConnection->createCatalog()->getTables(), _pConnection->getMetaData(), NULL),
+ m_xDBMetaData(_pConnection->getMetaData()),
+ m_aParser(_pConnection->getDriver()->getMSFactory())
+{
+ m_pConnection->acquire();
+}
+// -----------------------------------------------------------------------------
+OStatement_Base::~OStatement_Base()
+{
+}
+//------------------------------------------------------------------------------
+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()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ disposeResultSet();
+
+ if (m_pConnection)
+ m_pConnection->release();
+ m_pConnection = NULL;
+
+ dispose_ChildImpl();
+ OStatement_Base::disposing();
+}
+//-----------------------------------------------------------------------------
+void SAL_CALL OStatement_BASE2::release() throw(RuntimeException)
+{
+ relase_ChildImpl();
+}
+//-----------------------------------------------------------------------------
+Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = OStatement_BASE::queryInterface(rType);
+ if(!aRet.hasValue())
+ aRet = OPropertySetHelper::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+Sequence< Type > SAL_CALL OStatement_Base::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());
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement_Base::cancel( ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+ // cancel the current sql statement
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException)
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::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);
+
+
+ Reference<XCloseable> xCloseable;
+ if(::comphelper::query_interface(m_xResultSet.get(),xCloseable))
+ xCloseable->close();
+ m_xResultSet = Reference< XResultSet>();
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement::clearBatch( ) throw(SQLException, RuntimeException)
+{
+ // if you support batches clear it here
+}
+// -------------------------------------------------------------------------
+
+void OStatement_Base::parseSql( const ::rtl::OUString& sql )
+ throw ( SQLException, RuntimeException )
+{
+ ::rtl::OUString aErr;
+
+ OSL_TRACE("In/Out :: OStatement::parseSql(%s)\n", OUtoCStr( sql ) );
+
+ m_pParseTree = m_aParser.parseTree(aErr,sql);
+
+#ifdef DEBUG
+ {
+ const char* str = OUtoCStr(sql);
+ OSL_TRACE("ParseSQL: %s\n", OUtoCStr( sql ) );
+ }
+#endif // DEBUG
+
+ if(m_pParseTree)
+ {
+ m_aSQLIterator.setParseTree(m_pParseTree);
+ m_aSQLIterator.traverseAll();
+ const OSQLTables& xTabs = m_aSQLIterator.getTables();
+ if(xTabs.empty())
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Driver requires a single table to be specified in query"),NULL);
+
+ // at this moment we support only one table per select statement
+ #ifdef DARREN_WORK
+ Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(xTabs.begin()->second,UNO_QUERY);
+ if(xTunnel.is())
+ {
+ if(m_pTable)
+ m_pTable->release();
+ m_pTable = (OFileTable*)xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId());
+ if(m_pTable)
+ m_pTable->acquire();
+ }
+ OSL_ENSURE(m_pTable,"No table!");
+ m_xColNames = m_pTable->getColumns();
+ Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+ // set the binding of the resultrow
+ m_aRow = new OValueVector(xNames->getCount());
+ (*m_aRow)[0].setBound(sal_True);
+ ::std::for_each(m_aRow->begin()+1,m_aRow->end(),TSetBound(sal_False));
+ // create teh column mapping
+ createColumnMapping();
+
+ m_pSQLAnalyzer = createAnalyzer();
+
+ OSL_ENSURE(m_pTable,"We need a table object!");
+ Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY);
+ if(xIndexSup.is())
+ m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes());
+
+ anylizeSQL();
+ #else
+ OSQLTables::const_iterator citer;
+ for( citer = xTabs.begin(); citer != xTabs.end(); ++citer ) {
+ OSL_TRACE("SELECT Table : %s\n", OUtoCStr(citer->first) );
+ }
+
+ OSL_ENSURE( xTabs.begin() != xTabs.end(), "Need a Table");
+
+ m_pTable = static_cast< OTable* > (xTabs.begin()->second.get());
+ m_xColNames = m_pTable->getColumns();
+ Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+ // set the binding of the resultrow
+ m_aRow = new OValueVector(xNames->getCount());
+ (*m_aRow)[0].setBound(sal_True);
+ ::std::for_each(m_aRow->begin()+1,m_aRow->end(),TSetBound(sal_False));
+ // create the column mapping
+ createColumnMapping();
+
+ analyseSQL();
+ #endif /* DARREN_WORK */
+ }
+ else
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Problem parsing SQL!"),NULL);
+
+}
+// -------------------------------------------------------------------------
+
+OResultSet* OStatement_Base::createResultSet()
+{
+ return new OResultSet(this,m_aSQLIterator);
+}
+// -------------------------------------------------------------------------
+
+void OStatement_Base::initializeResultSet( OResultSet* _pResult )
+{
+ _pResult->setColumnMapping(m_aColMapping);
+ _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
+ _pResult->setOrderByAscending(m_aOrderbyAscending);
+ _pResult->setBindingRow(m_aRow);
+ _pResult->setTable(m_pTable);
+}
+
+// -------------------------------------------------------------------------
+sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
+
+ Reference< XResultSet > xRS = executeQuery( sql );
+ // returns true when a resultset is available
+ return xRS.is();
+}
+// -------------------------------------------------------------------------
+
+Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
+
+ parseSql( sql );
+ 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;
+}
+// -------------------------------------------------------------------------
+
+Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ // just return our connection here
+ return (Reference< XConnection >)m_pConnection;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+// -------------------------------------------------------------------------
+
+Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
+ if(!aRet.hasValue())
+ aRet = OStatement_Base::queryInterface(rType);
+ return aRet;
+}
+// -------------------------------------------------------------------------
+
+void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+
+ m_aBatchList.push_back(sql);
+}
+// -------------------------------------------------------------------------
+Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ return Sequence< sal_Int32 >();
+}
+// -------------------------------------------------------------------------
+
+
+sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ // the return values gives information about how many rows are affected by executing the sql statement
+ return 0;
+
+}
+// -------------------------------------------------------------------------
+
+Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+// return our save resultset here
+ return m_xResultSet;
+}
+// -------------------------------------------------------------------------
+
+sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+ // if your driver supports more than only one resultset
+ // and has one more at this moment return true
+ return sal_False;
+}
+// -------------------------------------------------------------------------
+
+// -------------------------------------------------------------------------
+Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+
+ return makeAny(m_aLastWarning);
+}
+// -------------------------------------------------------------------------
+
+// -------------------------------------------------------------------------
+void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
+
+ m_aLastWarning = SQLWarning();
+}
+// -------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
+{
+ // this properties are define by the service resultset
+ // they must in alphabetic order
+ Sequence< Property > aProps(10);
+ Property* pProperties = aProps.getArray();
+ sal_Int32 nPos = 0;
+ DECL_PROP0(CURSORNAME, ::rtl::OUString);
+ DECL_BOOL_PROP0(ESCAPEPROCESSING);
+ DECL_PROP0(FETCHDIRECTION,sal_Int32);
+ DECL_PROP0(FETCHSIZE, sal_Int32);
+ DECL_PROP0(MAXFIELDSIZE,sal_Int32);
+ DECL_PROP0(MAXROWS, sal_Int32);
+ DECL_PROP0(QUERYTIMEOUT,sal_Int32);
+ DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
+ DECL_PROP0(RESULTSETTYPE,sal_Int32);
+ DECL_BOOL_PROP0(USEBOOKMARKS);
+
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+// -------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
+{
+ return *const_cast<OStatement_Base*>(this)->getArrayHelper();
+}
+// -------------------------------------------------------------------------
+sal_Bool OStatement_Base::convertFastPropertyValue(
+ Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Bool bConverted = sal_False;
+ // here we have to try to convert
+ return bConverted;
+}
+// -------------------------------------------------------------------------
+void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
+{
+ // set the value to what ever is nescessary
+ switch(nHandle)
+ {
+ case PROPERTY_ID_QUERYTIMEOUT:
+ case PROPERTY_ID_MAXFIELDSIZE:
+ case PROPERTY_ID_MAXROWS:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ case PROPERTY_ID_ESCAPEPROCESSING:
+ case PROPERTY_ID_USEBOOKMARKS:
+ default:
+ ;
+ }
+}
+// -------------------------------------------------------------------------
+void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+{
+ switch(nHandle)
+ {
+ case PROPERTY_ID_QUERYTIMEOUT:
+ case PROPERTY_ID_MAXFIELDSIZE:
+ case PROPERTY_ID_MAXROWS:
+ case PROPERTY_ID_CURSORNAME:
+ case PROPERTY_ID_RESULTSETCONCURRENCY:
+ case PROPERTY_ID_RESULTSETTYPE:
+ case PROPERTY_ID_FETCHDIRECTION:
+ case PROPERTY_ID_FETCHSIZE:
+ case PROPERTY_ID_ESCAPEPROCESSING:
+ case PROPERTY_ID_USEBOOKMARKS:
+ default:
+ ;
+ }
+}
+// -------------------------------------------------------------------------
+IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatement_Base::acquire() throw(RuntimeException)
+{
+ OStatement_BASE::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatement_Base::release() throw(RuntimeException)
+{
+ OStatement_BASE::release();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatement::acquire() throw(RuntimeException)
+{
+ OStatement_BASE2::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OStatement::release() throw(RuntimeException)
+{
+ OStatement_BASE2::release();
+}
+// -----------------------------------------------------------------------------
+Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( ) throw(RuntimeException)
+{
+ return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
+}
+// -----------------------------------------------------------------------------
+void OStatement_Base::createColumnMapping()
+{
+ sal_Int32 i;
+
+ // initialize the column index map (mapping select columns to table columns)
+ ::vos::ORef<connectivity::OSQLColumns> xColumns = m_aSQLIterator.getSelectColumns();
+ m_aColMapping.resize(xColumns->size() + 1);
+ for (i=0; i<(sal_Int32)m_aColMapping.size(); ++i)
+ m_aColMapping[i] = i;
+
+ Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+ // now check which columns are bound
+ for ( i = 0; i < m_aColMapping.size(); i++ )
+ OSL_TRACE("BEFORE Mapped: %d -> %d", i, m_aColMapping[i] );
+ OResultSet::setBoundedColumns(m_aRow,xColumns,xNames,sal_True,m_xDBMetaData,m_aColMapping);
+ for ( i = 0; i < m_aColMapping.size(); i++ )
+ OSL_TRACE("AFTER Mapped: %d -> %d", i, m_aColMapping[i] );
+}
+// -----------------------------------------------------------------------------
+
+void OStatement_Base::analyseSQL()
+{
+ const OSQLParseNode* pOrderbyClause = m_aSQLIterator.getOrderTree();
+ if(pOrderbyClause)
+ {
+ OSQLParseNode * pOrderingSpecCommalist = pOrderbyClause->getChild(2);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpecCommalist,ordering_spec_commalist),"OResultSet: Fehler im Parse Tree");
+
+ for (sal_uInt32 m = 0; m < pOrderingSpecCommalist->count(); m++)
+ {
+ OSQLParseNode * pOrderingSpec = pOrderingSpecCommalist->getChild(m);
+ OSL_ENSURE(SQL_ISRULE(pOrderingSpec,ordering_spec),"OResultSet: Fehler im Parse Tree");
+ OSL_ENSURE(pOrderingSpec->count() == 2,"OResultSet: Fehler im Parse Tree");
+
+ OSQLParseNode * pColumnRef = pOrderingSpec->getChild(0);
+ if(!SQL_ISRULE(pColumnRef,column_ref))
+ {
+ throw SQLException();
+ }
+ OSQLParseNode * pAscendingDescending = pOrderingSpec->getChild(1);
+ setOrderbyColumn(pColumnRef,pAscendingDescending);
+ }
+ }
+}
+//------------------------------------------------------------------
+void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef,
+ OSQLParseNode* pAscendingDescending)
+{
+ ::rtl::OUString aColumnName;
+ if (pColumnRef->count() == 1)
+ aColumnName = pColumnRef->getChild(0)->getTokenValue();
+ else if (pColumnRef->count() == 3)
+ {
+ pColumnRef->getChild(2)->parseNodeToStr(aColumnName,m_xDBMetaData,NULL,sal_False,sal_False);
+ }
+ else
+ {
+ throw SQLException();
+ }
+
+ Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY);
+ if(!xColLocate.is())
+ return;
+
+ m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName));
+
+ // Ascending or Descending?
+ m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx
new file mode 100644
index 000000000000..023db6a589de
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MStatement.hxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * $RCSfile: MStatement.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_SSTATEMENT_HXX
+#define CONNECTIVITY_SSTATEMENT_HXX
+
+#ifndef _COM_SUN_STAR_SDBC_XSTATEMENT_HPP_
+#include <com/sun/star/sdbc/XStatement.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XMULTIPLERESULTS_HPP_
+#include <com/sun/star/sdbc/XMultipleResults.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XBATCHEXECUTION_HPP_
+#include <com/sun/star/sdbc/XBatchExecution.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
+#include <com/sun/star/util/XCancellable.hpp>
+#endif
+#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#include <comphelper/proparrhlp.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE5_HXX_
+#include <cppuhelper/compbase5.hxx>
+#endif
+#ifndef _COMPHELPER_UNO3_HXX_
+#include <comphelper/uno3.hxx>
+#endif
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "connectivity/CommonTools.hxx"
+#endif
+#ifndef INCLUDED_LIST
+#include <list>
+#define INCLUDED_LIST
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#include <comphelper/broadcasthelper.hxx>
+#endif
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+#include "connectivity/sqliterator.hxx"
+#endif
+#ifndef _CONNECTIVITY_PARSE_SQLPARSE_HXX_
+#include "connectivity/sqlparse.hxx"
+#endif
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#include <connectivity/FValue.hxx>
+#endif
+#include "MConnection.hxx"
+#include "MTable.hxx"
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class OResultSet;
+
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement,
+ ::com::sun::star::sdbc::XWarningsSupplier,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::sdbc::XCloseable,
+ ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE;
+
+ //**************************************************************
+ //************ Class: OStatement_Base
+ // 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>
+
+ {
+ ::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::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns
+
+ // for this Statement
+
+ ::std::list< ::rtl::OUString> m_aBatchList;
+
+ OTable* m_pTable;
+ OConnection* m_pConnection; // The owning Connection object
+
+ OValueRow m_aRow;
+
+ connectivity::OSQLParser m_aParser;
+ connectivity::OSQLParseTreeIterator m_aSQLIterator;
+
+ connectivity::OSQLParseNode* m_pParseTree;
+
+ ::std::vector<sal_Int32> m_aColMapping;
+ ::std::vector<sal_Int32> m_aOrderbyColumnNumber;
+ ::std::vector<sal_Int16> m_aOrderbyAscending;
+
+ protected:
+
+ void disposeResultSet();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle) const;
+ virtual ~OStatement_Base();
+
+ protected:
+ //
+ // Driver Internal Methods
+ //
+ virtual void parseSql( const ::rtl::OUString& sql ) throw (
+ ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+
+ 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);
+
+ public:
+ // other methods
+ OConnection* getOwnConnection() const { return m_pConnection;}
+
+ ::cppu::OBroadcastHelper& rBHelper;
+ OStatement_Base(OConnection* _pConnection );
+ using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
+ // XInterface
+ virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XStatement
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
+ // XWarningsSupplier
+ virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XCancellable
+ virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
+ // XCloseable
+ virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XMultipleResults
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ };
+
+ 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(::com::sun::star::uno::RuntimeException);
+ };
+
+ class OStatement : public OStatement_BASE2,
+ public ::com::sun::star::sdbc::XBatchExecution,
+ 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){}
+ 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);
+ virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+ // XBatchExecution
+ virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+#endif // CONNECTIVITY_SSTATEMENT_HXX
diff --git a/connectivity/source/drivers/mozab/MTable.cxx b/connectivity/source/drivers/mozab/MTable.cxx
new file mode 100644
index 000000000000..24f0de9a6693
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MTable.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTable.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
+#include "MTable.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
+#include "MTables.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_COLUMNS_HXX_
+#include "MColumns.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_
+#include <com/sun/star/sdbc/KeyRule.hpp>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include "connectivity/dbtools.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
+#include "MCatalog.hxx"
+#endif
+
+
+using namespace ::comphelper;
+using namespace connectivity::mozab;
+using namespace connectivity;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection)
+ : OTable_TYPEDEF(_pTables, sal_True),m_pConnection(_pConnection)
+{
+ construct();
+}
+// -------------------------------------------------------------------------
+OTable::OTable( sdbcx::OCollection* _pTables,
+ OConnection* _pConnection,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description ,
+ const ::rtl::OUString& _SchemaName,
+ const ::rtl::OUString& _CatalogName
+ ) : OTable_TYPEDEF(_pTables,sal_True,
+ _Name,
+ _Type,
+ _Description,
+ _SchemaName,
+ _CatalogName)
+ ,m_pConnection(_pConnection)
+{
+ construct();
+}
+// -------------------------------------------------------------------------
+void OTable::refreshColumns()
+{
+ TStringVector aVector;
+ if(!isNew())
+ {
+ Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(),
+ m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%"));
+
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while(xResult->next())
+ aVector.push_back(xRow->getString(4));
+ }
+ }
+
+ if(m_pColumns)
+ m_pColumns->reFill(aVector);
+ else
+ m_pColumns = new OColumns(this,m_aMutex,aVector);
+}
+// -------------------------------------------------------------------------
+void OTable::refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys)
+{
+ Reference< XResultSet > xResult = m_pConnection->getMetaData()->getPrimaryKeys(Any(),m_SchemaName,m_Name);
+
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ if(xResult->next()) // there can be only one primary key
+ {
+ ::rtl::OUString aPkName = xRow->getString(6);
+ _rKeys.push_back(aPkName);
+ }
+ }
+}
+// -------------------------------------------------------------------------
+void OTable::refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys)
+{
+ Reference< XResultSet > xResult = m_pConnection->getMetaData()->getImportedKeys(Any(),m_SchemaName,m_Name);
+
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ while(xResult->next())
+ _rKeys.push_back(xRow->getString(12));
+ }
+}
+// -------------------------------------------------------------------------
+void OTable::refreshKeys()
+{
+}
+// -------------------------------------------------------------------------
+void OTable::refreshIndexes()
+{
+}
+//--------------------------------------------------------------------------
+Sequence< sal_Int8 > OTable::getUnoTunnelImplementationId()
+{
+ static ::cppu::OImplementationId * pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// com::sun::star::lang::XUnoTunnel
+//------------------------------------------------------------------
+sal_Int64 OTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
+{
+ return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
+ ?
+ (sal_Int64)this
+ :
+ OTable_TYPEDEF::getSomething(rId);
+}
+// -------------------------------------------------------------------------
+// XRename
+void SAL_CALL OTable::rename( const ::rtl::OUString& newName ) throw(SQLException, ElementExistException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+// XAlterTable
+void SAL_CALL OTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
+{
+}
+
+// -------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OTable::getName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return m_Name;
+}
+#ifdef DARREN_WORK
+// -----------------------------------------------------------------------------
+void SAL_CALL OTable::acquire() throw(::com::sun::star::uno::RuntimeException)
+{
+ OTable_TYPEDEF::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OTable::release() throw(::com::sun::star::uno::RuntimeException)
+{
+ OTable_TYPEDEF::release();
+}
+#endif /* DARREN_WORK */
+// -----------------------------------------------------------------------------
+void OTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor)
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName)
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::dropDefaultValue(const ::rtl::OUString& _rColName)
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName)
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::beginTransAction()
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::endTransAction()
+{
+}
+// -----------------------------------------------------------------------------
+void OTable::rollbackTransAction()
+{
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName )
+{
+ ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("");
+ return sSql;
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/connectivity/source/drivers/mozab/MTable.hxx b/connectivity/source/drivers/mozab/MTable.hxx
new file mode 100644
index 000000000000..20a7e027bc12
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MTable.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTable.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
+#define _CONNECTIVITY_MOZAB_TABLE_HXX_
+
+#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
+#include "connectivity/sdbcx/VTable.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#endif
+#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
+#include "MConnection.hxx"
+#endif
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+
+ ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
+
+ class OTable : public OTable_TYPEDEF
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+ OConnection* m_pConnection;
+
+ void refreshPrimaryKeys(std::vector< ::rtl::OUString>& _rKeys);
+ void refreshForgeinKeys(std::vector< ::rtl::OUString>& _rKeys);
+
+
+
+ public:
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+
+ public:
+ OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection);
+ OTable( sdbcx::OCollection* _pTables,
+ OConnection* _pConnection,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description = ::rtl::OUString(),
+ const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _CatalogName = ::rtl::OUString()
+ );
+
+ OConnection* getConnection() { return m_pConnection;}
+
+ sal_Bool isReadOnly() const { return sal_True; }
+
+ ::rtl::OUString getTableName() const { return m_Name; }
+ ::rtl::OUString getSchema() const { return m_SchemaName; }
+
+ // virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
+ // virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ // XRename
+ virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+ /**
+ returns the ALTER TABLE XXX COLUMN statement
+ */
+ ::rtl::OUString getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName );
+
+ // starts a sql transaaction
+ void beginTransAction();
+ // rolls back a sql transaaction
+ void rollbackTransAction();
+ // ends a sql transaaction
+ void endTransAction();
+ // some methods to alter table structures
+ void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor);
+ void alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName);
+ void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
+ void dropDefaultValue(const ::rtl::OUString& _sNewDefault);
+ void addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
+ };
+ }
+}
+#endif // _CONNECTIVITY_MOZAB_TABLE_HXX_
+
diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx
new file mode 100644
index 000000000000..d126d07839fa
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MTables.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTables.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
+#include "MTables.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
+#include "MTable.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_
+#include <com/sun/star/sdbc/KeyRule.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
+#include "MCatalog.hxx"
+#endif
+#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
+#include "MConnection.hxx"
+#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include "connectivity/dbtools.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#include <cppuhelper/interfacecontainer.h>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+
+using namespace ::comphelper;
+
+using namespace ::cppu;
+using namespace connectivity::mozab;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace dbtools;
+typedef connectivity::sdbcx::OCollection OCollection_TYPE;
+
+Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
+{
+ ::rtl::OUString aName,aSchema;
+ // sal_Int32 nLen = _rName.indexOf('.');
+ // aSchema = _rName.copy(0,nLen);
+ // aName = _rName.copy(nLen+1);
+ aSchema = ::rtl::OUString::createFromAscii("%");
+ aName = _rName;
+
+ Sequence< ::rtl::OUString > aTypes(1);
+ aTypes[0] = ::rtl::OUString::createFromAscii("%");
+ // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE");
+ // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE");
+
+ Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
+
+ Reference< XNamed > xRet = NULL;
+ if(xResult.is())
+ {
+ Reference< XRow > xRow(xResult,UNO_QUERY);
+ if(xResult->next()) // there can be only one table with this name
+ {
+ OTable* pRet = new OTable( this, static_cast<OCatalog&>(m_rParent).getConnection(),
+ aName,xRow->getString(4),xRow->getString(5),aSchema);
+ xRet = pRet;
+ }
+ }
+
+ return xRet;
+}
+// -------------------------------------------------------------------------
+void OTables::impl_refresh( ) throw(RuntimeException)
+{
+ static_cast<OCatalog&>(m_rParent).refreshTables();
+}
+// -------------------------------------------------------------------------
+void OTables::disposing(void)
+{
+ m_xMetaData = NULL;
+ OCollection::disposing();
+}
+// -------------------------------------------------------------------------
+Reference< XPropertySet > OTables::createEmptyObject()
+{
+ OTable* pNew = new OTable(this, static_cast<OCatalog&>(m_rParent).getConnection());
+ return pNew;
+}
+// -------------------------------------------------------------------------
+// XAppend
+void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard(m_rMutex);
+ ::rtl::OUString aName = getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
+ ObjectMap::iterator aIter = m_aNameMap.find(aName);
+ if( aIter != m_aNameMap.end())
+ throw ElementExistException(aName,*this);
+ if(!aName.getLength())
+ ::dbtools::throwFunctionSequenceException(*this);
+
+ createTable(descriptor);
+
+ OCollection_TYPE::appendByDescriptor(descriptor);
+}
+// -------------------------------------------------------------------------
+void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+// XDrop
+void SAL_CALL OTables::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+void SAL_CALL OTables::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException)
+{
+}
+// -------------------------------------------------------------------------
+void OTables::createTable( const Reference< XPropertySet >& descriptor )
+{
+}
+// -----------------------------------------------------------------------------
+void OTables::appendNew(const ::rtl::OUString& _rsNewTable)
+{
+ insertElement(_rsNewTable,NULL);
+
+ // notify our container listeners
+ ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rsNewTable), Any(), Any());
+ OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
+ while (aListenerLoop.hasMoreElements())
+ static_cast<XContainerListener*>(aListenerLoop.next())->elementInserted(aEvent);
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OTables::getColumnSqlType(const Reference<XPropertySet>& _rxColProp)
+{
+ ::rtl::OUString sSql;
+ sal_Int32 nDataType = 0;
+ _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nDataType;
+ switch(nDataType)
+ {
+ case DataType::VARBINARY:
+ sSql += ::rtl::OUString::createFromAscii("VAR");
+ /* run through*/
+ case DataType::BINARY:
+ sSql += ::rtl::OUString::createFromAscii("CHAR");
+ break;
+ default:
+ {
+ Any aTypeName = _rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME));
+ if(aTypeName.hasValue() && getString(aTypeName).getLength())
+ sSql += getString(aTypeName);
+ else
+ sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString::createFromAscii(" ");
+ }
+ }
+
+ switch(nDataType)
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ sSql += ::rtl::OUString::createFromAscii("(")
+ + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
+ + ::rtl::OUString::createFromAscii(")");
+ break;
+
+ case DataType::DECIMAL:
+ case DataType::NUMERIC:
+ sSql += ::rtl::OUString::createFromAscii("(")
+ + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
+ + ::rtl::OUString::createFromAscii(",")
+ + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))))
+ + ::rtl::OUString::createFromAscii(")");
+ break;
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ sSql += ::rtl::OUString::createFromAscii("(")
+ + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))))
+ + ::rtl::OUString::createFromAscii(") BYTE");
+ break;
+ }
+ return sSql;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OTables::getColumnSqlNotNullDefault(const Reference<XPropertySet>& _rxColProp)
+{
+ OSL_ENSURE(_rxColProp.is(),"OTables::getColumnSqlNotNullDefault: Column is null!");
+ ::rtl::OUString sSql;
+ ::rtl::OUString aDefault = getString(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE)));
+ if(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS)
+ {
+ sSql += ::rtl::OUString::createFromAscii(" NOT NULL");
+ if(aDefault.getLength())
+ sSql += ::rtl::OUString::createFromAscii(" WITH DEFAULT");
+ }
+ else if(aDefault.getLength())
+ {
+ sSql +=::rtl::OUString::createFromAscii(" DEFAULT '") + aDefault;
+ sSql += ::rtl::OUString::createFromAscii("'");
+ }
+ return sSql;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OTables::getTypeString(const Reference< XPropertySet >& _rxColProp)
+{
+ ::rtl::OUString aValue;
+ switch(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))))
+ {
+ case DataType::BIT:
+ aValue = ::rtl::OUString::createFromAscii("BOOLEAN");
+ break;
+ case DataType::TINYINT:
+ aValue = ::rtl::OUString::createFromAscii("SMALLINT");
+ break;
+ case DataType::SMALLINT:
+ aValue = ::rtl::OUString::createFromAscii("SMALLINT");
+ break;
+ case DataType::INTEGER:
+ aValue = ::rtl::OUString::createFromAscii("INT");
+ break;
+ case DataType::FLOAT:
+ aValue = ::rtl::OUString::createFromAscii("FLOAT");
+ break;
+ case DataType::REAL:
+ aValue = ::rtl::OUString::createFromAscii("REAL");
+ break;
+ case DataType::DOUBLE:
+ aValue = ::rtl::OUString::createFromAscii("DOUBLE");
+ break;
+ case DataType::NUMERIC:
+ aValue = ::rtl::OUString::createFromAscii("DECIMAL");
+ break;
+ case DataType::DECIMAL:
+ aValue = ::rtl::OUString::createFromAscii("DECIMAL");
+ break;
+ case DataType::CHAR:
+ aValue = ::rtl::OUString::createFromAscii("CHAR");
+ break;
+ case DataType::VARCHAR:
+ aValue = ::rtl::OUString::createFromAscii("VARCHAR");
+ break;
+ case DataType::LONGVARCHAR:
+ aValue = ::rtl::OUString::createFromAscii("LONG VARCHAR");
+ break;
+ case DataType::DATE:
+ aValue = ::rtl::OUString::createFromAscii("DATE");
+ break;
+ case DataType::TIME:
+ aValue = ::rtl::OUString::createFromAscii("TIME");
+ break;
+ case DataType::TIMESTAMP:
+ aValue = ::rtl::OUString::createFromAscii("TIMESTAMP");
+ break;
+ case DataType::BINARY:
+ aValue = ::rtl::OUString::createFromAscii("CHAR () BYTE");
+ break;
+ case DataType::VARBINARY:
+ aValue = ::rtl::OUString::createFromAscii("VARCHAR () BYTE");
+ break;
+ case DataType::LONGVARBINARY:
+ aValue = ::rtl::OUString::createFromAscii("LONG BYTE");
+ break;
+ }
+ return aValue;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/mozab/MTables.hxx b/connectivity/source/drivers/mozab/MTables.hxx
new file mode 100644
index 000000000000..b9f7ad15b613
--- /dev/null
+++ b/connectivity/source/drivers/mozab/MTables.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTables.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_MOZAB_TABLES_HXX_
+#define _CONNECTIVITY_MOZAB_TABLES_HXX_
+
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#include "connectivity/sdbcx/VCollection.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#endif
+namespace connectivity
+{
+ namespace mozab
+ {
+ class OTables : public sdbcx::OCollection
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+ // OCatalog* m_pParent;
+ protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
+ void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ public:
+ OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
+ ,m_xMetaData(_rMetaData)
+ {}
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XDrop
+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void appendNew(const ::rtl::OUString& _rsNewTable);
+ // some helper functions
+ /**
+ returns a sql string which contains the column definition part for create or alter statements
+ */
+ static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+ /**
+ returns the "not null" part or the default part of the table statement
+ */
+ static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+ /**
+ returns the corresponding typename
+ can contain () which have to filled with values
+ */
+ static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+ };
+ }
+}
+#endif // _CONNECTIVITY_MOZAB_TABLES_HXX_
+
diff --git a/connectivity/source/drivers/mozab/exports.dxp b/connectivity/source/drivers/mozab/exports.dxp
new file mode 100644
index 000000000000..9630d7e06768
--- /dev/null
+++ b/connectivity/source/drivers/mozab/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
new file mode 100644
index 000000000000..e7851fa214f7
--- /dev/null
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -0,0 +1,177 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=..$/..
+PRJNAME=connectivity
+TARGET=mozab
+
+.IF "$(BUILD_SOSL)"!=""
+all:
+ @echo " Not building the addressbook driver in OpenOffice.org build"
+ @echo " dependency to Mozilla developer snapshots not feasable at the moment"
+.ENDIF
+
+#mozilla specific stuff.
+MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
+MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)/$/mozilla
+#.ENDIF
+
+.IF "$(OS)"=="WNT"
+LIB += $(MOZ_LIB)
+MOZ_LIB_XPCOM= $(MOZ_LIB)$/baseembed_s.lib $(MOZ_LIB)$/nspr4.lib $(MOZ_LIB)$/mozreg.lib $(MOZ_LIB)$/xpcom.lib
+.ELSE
+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
+.ENDIF
+#End of mozilla specific stuff.
+
+
+USE_LDUMP2=TRUE
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+LDUMP=ldump2.exe
+# --- Settings ----------------------------------
+.IF "$(DBGUTIL_OJ)"!=""
+ENVCFLAGS+=/FR$(SLO)$/
+.ENDIF
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/version.mk
+
+
+# --- Recursiveness ---------------------------------------------------
+
+RC_SUBDIRS = mozillasrc
+
+# --- Files -------------------------------------
+MOZSLOFILES=\
+ $(SLO)$/MNSInit.obj \
+ $(SLO)$/MQueryHelper.obj \
+ $(SLO)$/MDatabaseMetaDataHelper.obj \
+ $(SLO)$/MQuery.obj \
+ $(SLO)$/MTypeConverter.obj \
+ $(SLO)$/MNameMapper.obj
+
+SLOFILES=\
+ $(SLO)$/MCatalog.obj \
+ $(SLO)$/MColumns.obj \
+ $(SLO)$/MTable.obj \
+ $(SLO)$/MTables.obj \
+ $(SLO)$/MColumnAlias.obj \
+ $(SLO)$/MPreparedStatement.obj \
+ $(SLO)$/MStatement.obj \
+ $(SLO)$/MResultSetMetaData.obj \
+ $(SLO)$/MResultSet.obj \
+ $(SLO)$/MDatabaseMetaData.obj \
+ $(SLO)$/MDriver.obj \
+ $(SLO)$/MServices.obj \
+ $(SLO)$/MConnection.obj \
+ $(MOZSLOFILES)
+
+
+
+# --- MOZAB BASE Library -----------------------------------
+
+SHL1VERSIONMAP= $(TARGET).map
+SHL1TARGET= $(MOZAB_TARGET)$(MOZAB_MAJOR)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(OSLLIB) \
+ $(SALLIB) \
+ $(DBTOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(MOZ_LIB_XPCOM)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(MOZAB_TARGET)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
+ $(SLB)$/$(TARGET).lib
+DEFLIB1NAME=$(TARGET)
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+# --- filter file ------------------------------
+
+.IF "$(depend)"==""
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo CLEAR_THE_FILE > $@
+ @echo _TI >>$@
+ @echo _real >>$@
+.ENDIF
+
+killdpc:
+ -+$(RM) $(DPCTARGET)
+ -+$(RM) $(DEPFILES)
+ @+echo Dependency files removed
+
diff --git a/connectivity/source/drivers/mozab/mozab.map b/connectivity/source/drivers/mozab/mozab.map
new file mode 100644
index 000000000000..9f3a1f27d0f5
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab.map
@@ -0,0 +1,8 @@
+MOZAB_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml
new file mode 100644
index 000000000000..8b45122d71a3
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozab.xml
@@ -0,0 +1,65 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name> odbc </module-name>
+ <component-description>
+ <Author>Your name</Author>
+ <Name>com.sun.star.comp.sdbc.MozabDriver</Name>
+ <Description>
+ This is the implementation of the sdbc-mozab bridge.
+ </Description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service> com.sun.star.sdbc.Driver </supported-service>
+ <service-dependency> ... </service-dependency>
+ <project-build-dependency> cppuhelper </project-build-dependency>
+ <project-build-dependency> cppu </project-build-dependency>
+ <project-build-dependency> sal </project-build-dependency>
+ <project-build-dependency> vos </project-build-dependency>
+
+ <runtime-module-dependency> cppuhelper </runtime-module-dependency>
+ <runtime-module-dependency> cppu1 </runtime-module-dependency>
+ <runtime-module-dependency> sal1 </runtime-module-dependency>
+ <runtime-module-dependency> vos </runtime-module-dependency>
+
+
+
+ <type> com.sun.star.util.XCancellable </type>
+ <type> com.sun.star.util.XNumberFormatter </type>
+ <type> com.sun.star.uno.TypeClass </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XAggregation </type>
+ <type> com.sun.star.beans.XPropertyState </type>
+ <type> com.sun.star.beans.XPropertySet </type>
+ <type> com.sun.star.beans.PropertyValue </type>
+ <type> com.sun.star.beans.XMultiPropertySet </type>
+ <type> com.sun.star.beans.XFastPropertySet </type>
+ <type> com.sun.star.lang.XTypeProvider </type>
+ <type> com.sun.star.lang.EventObject </type>
+ <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.lang.IllegalArgumentException </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.java.XJavaThreadRegister_11 </type>
+ <type> com.sun.star.java.XJavaVM </type>
+ <type> com.sun.star.sdbc.XConnection </type>
+ <type> com.sun.star.sdbc.XStatement </type>
+ <type> com.sun.star.sdbc.XResultSet </type>
+ <type> com.sun.star.sdbc.XResultSetMetaDataSupplier</type>
+ <type> com.sun.star.sdbc.XColumnLocate </type>
+ <type> com.sun.star.sdbc.XResultSetUpdate </type>
+ <type> com.sun.star.sdbc.XWarningsSupplier </type>
+ <type> com.sun.star.sdbc.XRowUpdate </type>
+ <type> com.sun.star.sdbc.XMultipleResults </type>
+ <type> com.sun.star.sdbc.XBatchExecution </type>
+ <type> com.sun.star.sdbc.XPreparedBatchExecution </type>
+ <type> com.sun.star.sdbc.XParameters </type>
+ <type> com.sun.star.sdbc.XOutParameters </type>
+ <type> com.sun.star.sdbc.DriverPropertyInfo </type>
+ <type> com.sun.star.sdbc.XRow </type>
+ <type> com.sun.star.sdb.XColumnUpdate </type>
+ <type> com.sun.star.sdb.XColumn </type>
+ </component-description>
+</module-description>
+
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
new file mode 100644
index 000000000000..6bfe2ccf1961
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDatabaseMetaDataHelper.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp, Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+// Mozilla includes.
+#include <MNSInclude.hxx>
+
+#ifndef _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
+#include "MDatabaseMetaDataHelper.hxx"
+#endif
+#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_
+#include "MTypeConverter.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+
+#include <MNSInit.hxx>
+#include <MNameMapper.hxx>
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+
+static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
+static NS_DEFINE_CID(kAbDirFactoryServiceCID, NS_ABDIRFACTORYSERVICE_CID);
+static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID);
+
+using namespace connectivity::mozab;
+using namespace connectivity;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbc;
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ static const char * const s_pADDRESSBOOKROOTDIR = "moz-abdirectory://";
+ }
+}
+
+// -------------------------------------------------------------------------
+MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()
+ : m_bProfileExists(sal_False)
+{
+ OSL_TRACE( "IN MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
+ sal_Bool rv = MNS_Init(m_bProfileExists);
+
+ OSL_TRACE( "\tMAB_NS_Init returned %s\n", rv?"True":"False" );
+ OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::MDatabaseMetaDataHelper()\n" );
+
+}
+// -------------------------------------------------------------------------
+MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()
+{
+ m_aTableNames.clear();
+
+ sal_Bool rv = MNS_Term();
+
+ OSL_TRACE( "IN/OUT MDatabaseMetaDataHelper::~MDatabaseMetaDataHelper()\n" );
+}
+// -------------------------------------------------------------------------
+// Case where we get a parent uri, and need to list its children.
+// We know we are dealing with the top level address book, so we add the personal
+// and collected addresses address books by hand.
+static nsresult getSubsFromParent(const rtl::OString& aParent, nsIEnumerator **aSubs, sal_Bool aProfileExists)
+{
+ if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
+ *aSubs = nsnull ;
+ nsresult retCode = NS_OK ;
+ nsCOMPtr<nsISupportsArray> array ;
+
+ NS_NewISupportsArray(getter_AddRefs(array)) ;
+ if (aProfileExists) {
+ nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIRDFResource> rdfResource ;
+
+ OSL_TRACE("uri: %s\n", aParent.getStr()) ;
+ retCode = rdfService->GetResource(aParent.getStr(), getter_AddRefs(rdfResource)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
+ nsCOMPtr<nsIEnumerator> tempEnum ;
+
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ retCode = directory->GetChildNodes(getter_AddRefs(tempEnum)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIRDFResource> personalAddressBook ;
+ nsCOMPtr<nsIRDFResource> collectedAddresses ;
+
+ retCode = rdfService->GetResource("moz-abmdbdirectory://abook.mab", getter_AddRefs(personalAddressBook)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIAbDirectory> dirPAB = do_QueryInterface(personalAddressBook, &retCode) ;
+
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsAutoString nameAB ;
+
+ nameAB.AssignWithConversion("Personal Address Book") ;
+ dirPAB->SetDirName(nameAB.get()) ;
+ array->AppendElement(personalAddressBook) ;
+ retCode = rdfService->GetResource("moz-abmdbdirectory://history.mab", getter_AddRefs(collectedAddresses)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIAbDirectory> dirCA = do_QueryInterface(collectedAddresses, &retCode) ;
+
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nameAB.AssignWithConversion("Collected Addresses") ;
+ dirCA->SetDirName(nameAB.get()) ;
+ array->AppendElement(collectedAddresses) ;
+ if (NS_SUCCEEDED(tempEnum->First())) {
+ do {
+ nsCOMPtr<nsISupports> element ;
+
+ retCode = tempEnum->CurrentItem(getter_AddRefs(element)) ;
+ if (NS_SUCCEEDED(retCode)) { array->AppendElement(element) ; }
+ } while (NS_SUCCEEDED(tempEnum->Next())) ;
+ }
+ }
+ array->Enumerate(aSubs) ;
+ return retCode ;
+}
+
+// Case where we get a factory uri and need to have it build the directories.
+static const char *kPropertyName = "uri" ;
+
+static nsresult getSubsFromFactory(const rtl::OString& aFactory, nsIEnumerator **aSubs)
+{
+ if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
+ *aSubs = nsnull ;
+ nsresult retCode = NS_OK ;
+
+ nsCOMPtr<nsIAbDirFactoryService> dirFactoryService = do_GetService(NS_ABDIRFACTORYSERVICE_CONTRACTID, &retCode);
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIAbDirFactory> dirFactory ;
+
+ retCode = dirFactoryService->GetDirFactory(aFactory.getStr(), getter_AddRefs(dirFactory)) ;
+ NS_ENSURE_SUCCESS (retCode, retCode) ;
+ OUString value = OStringToOUString(aFactory, RTL_TEXTENCODING_ASCII_US) ;
+ const PRUnichar *valueChars = value.getStr() ;
+ nsCOMPtr<nsISimpleEnumerator> subDirs ;
+
+ retCode = dirFactory->CreateDirectory(1, &kPropertyName, &valueChars, getter_AddRefs(subDirs)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ PRBool hasMore = PR_TRUE ;
+ nsCOMPtr<nsISupportsArray> array ;
+
+ NS_NewISupportsArray(getter_AddRefs(array)) ;
+ while (NS_SUCCEEDED(subDirs->HasMoreElements(&hasMore)) && hasMore) {
+ nsCOMPtr<nsISupports> newDirSupports ;
+
+ retCode = subDirs->GetNext(getter_AddRefs(newDirSupports)) ;
+ if (NS_FAILED(retCode)) { continue ; }
+ nsCOMPtr<nsIAbDirectory> childDir = do_QueryInterface(newDirSupports, &retCode) ;
+ if (NS_FAILED(retCode)) { continue ; }
+ array->AppendElement(childDir);
+ }
+ array->Enumerate(aSubs) ;
+ return retCode ;
+}
+
+// Case where the uri itself is the directory we're looking for.
+static nsresult getSubsFromURI(const rtl::OString& aUri, nsIEnumerator **aSubs)
+{
+ if (aSubs == nsnull) { return NS_ERROR_NULL_POINTER ; }
+ *aSubs = nsnull ;
+ nsresult retCode = NS_OK ;
+
+ nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &retCode)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIRDFResource> rdfResource ;
+
+ retCode = rdfService->GetResource(aUri.getStr(), getter_AddRefs(rdfResource)) ;
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(rdfResource, &retCode) ;
+
+ NS_ENSURE_SUCCESS(retCode, retCode) ;
+ nsAutoString nameAB ;
+
+ nameAB.AssignWithConversion("LDAP Directory") ;
+ directory->SetDirName(nameAB.get()) ;
+ nsCOMPtr<nsISupportsArray> array ;
+
+ NS_NewISupportsArray(getter_AddRefs(array)) ;
+ array->AppendElement(directory) ;
+ array->Enumerate(aSubs) ;
+ return retCode ;
+}
+
+static void throwABSpecificException( OConnection* _pCon, sal_Bool bGivenURI ) throw (SQLException)
+{
+ if ( ! bGivenURI ) {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No Mozilla Addressbook Directories Exist"),NULL);
+ }
+ else {
+ if (_pCon->usesFactory()) {
+ if ( _pCon->isOutlookExpress() ) {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No Outlook Express Addressbook Exists"),NULL);
+ }
+ else {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No Outlook (MAPI) Addressbook Exists"),NULL);
+ }
+ }
+ else {
+ if (_pCon->isLDAP()) {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Unable to connect to LDAP Server"),NULL);
+ }
+ else {
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("No Mozilla Addressbook Directories Exist"),NULL);
+ }
+ }
+ }
+}
+
+::std::vector< ::rtl::OUString >& MDatabaseMetaDataHelper::getTableStrings(
+ OConnection* _pCon,
+ sal_Bool forceLoad )
+ throw ( SQLException )
+{
+ sal_Bool bGivenURI;
+ sal_Bool bIsRootDir;
+ rtl::OUString sAbURI;
+ OString sAbURIString;
+
+ OSL_TRACE( "IN MDatabaseMetaDataHelper::getTableStrings( 0x%08X, %s)\n", _pCon, forceLoad?"True":"False" );
+
+ // Only do the query if we have to - performance degrades otherwise
+ if ( ! forceLoad && m_aTableNames.size() > 0 ) {
+ return( m_aTableNames );
+ }
+
+ m_aTableNames.clear();
+
+ sAbURI = _pCon->getMozURI();
+
+ OSL_TRACE("AbURI = %s\n", OUtoCStr( sAbURI ) );
+ if ( sAbURI.getLength() == 0 )
+ bGivenURI = sal_False;
+ else {
+ sAbURIString = ::rtl::OUStringToOString( sAbURI,
+ RTL_TEXTENCODING_ASCII_US);
+ bGivenURI = sal_True;
+ }
+
+ if ( bGivenURI )
+ OSL_TRACE("Using URI %s to getTables()\n", sAbURIString.getStr() );
+ else
+ OSL_TRACE("Using URI of ROOTDIR to getTables()\n");
+
+ // Get the mozilla addressbooks from the base directory.
+ nsresult rv = NS_OK;
+ nsCOMPtr<nsIEnumerator> subDirectories;
+
+ if (!bGivenURI) {
+ rv = getSubsFromParent(s_pADDRESSBOOKROOTDIR, getter_AddRefs(subDirectories), m_bProfileExists) ;
+ if ( NS_FAILED( rv ) ) {
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ }
+ else {
+ if (_pCon->usesFactory()) {
+ rv = getSubsFromFactory(sAbURIString, getter_AddRefs(subDirectories)) ;
+ if ( NS_FAILED( rv ) ) {
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ }
+ else {
+ if (_pCon->isLDAP()) {
+ rv = getSubsFromURI(sAbURIString, getter_AddRefs(subDirectories)) ;
+ if ( NS_FAILED( rv ) ) {
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ }
+ else {
+ rv = getSubsFromParent(sAbURIString, getter_AddRefs(subDirectories), m_bProfileExists);
+ if ( NS_FAILED( rv ) ) {
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ }
+ }
+ }
+ // Catch all (just in case), should be caught before this
+ if ( NS_FAILED( rv ) ) {
+ OSL_ASSERT( "Shouldn't have reached this line with a failure");
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ // At this point we have a list containing the nsIAbDirectory we need to map as tables
+ rv = subDirectories -> First();
+ if ( NS_FAILED( rv ) ) {
+ throwABSpecificException( _pCon, bGivenURI );
+ }
+ else {
+ bIsRootDir = sal_True;
+ }
+
+ PRUnichar *name = nsnull;
+ PRBool bIsMailList = PR_FALSE;
+
+ ::rtl::OUString aTableName;
+
+ MNameMapper *nmap = MNameMapper::getInstance();
+
+ do {
+ nsCOMPtr<nsIAbDirectory> subDirectory;
+
+ if ( bIsRootDir ) {
+ nsCOMPtr<nsISupports> item;
+ rv = subDirectories -> CurrentItem(getter_AddRefs(item));
+ if ( NS_FAILED( rv ) ) {
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Problem Getting Addressbook Entry"),NULL);
+ }
+
+ subDirectory = do_QueryInterface(item, &rv);
+ }
+ subDirectory -> GetIsMailList(&bIsMailList);
+ // For now we're not interested in mailing lists.
+ rv = subDirectory -> GetDirName(&name);
+ if ( NS_FAILED( rv ) ) {
+ ::dbtools::throwGenericSQLException(::rtl::OUString::createFromAscii("Problem Getting Addressbook Directory Name"),NULL);
+ }
+ MTypeConverter::prUnicharToOUString(name, aTableName);
+ OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
+ if (!bIsMailList) {
+ ODatabaseMetaDataResultSet::ORow aRow(3);
+
+ // Insert table into map
+ if ( aTableName.getLength() == 0 ) {
+ aTableName = rtl::OUString::createFromAscii("AddressBook");
+ }
+
+ OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
+
+ nmap->add( aTableName, subDirectory );
+
+ m_aTableNames.push_back( aTableName ); // Table name
+ }
+
+ if ( bIsRootDir ) {
+ rv = subDirectories -> Next();
+ }
+ } while ( bIsRootDir && rv == NS_OK);
+ // delete pTc;
+
+ OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTableStrings()\n" );
+ return( m_aTableNames );
+}
+
+ODatabaseMetaDataResultSet::ORows& MDatabaseMetaDataHelper::getTables(
+ OConnection* _pCon,
+ const ::rtl::OUString& tableNamePattern)
+ throw ( SQLException )
+{
+ static ODatabaseMetaDataResultSet::ORows aRows;
+
+ OSL_TRACE( "IN MDatabaseMetaDataHelper::getTables()\n" );
+
+ ODatabaseMetaDataResultSet::ORows().swap(aRows); // this makes real clear where memory is freed as well
+ aRows.clear();
+
+ // will not be detected (for now).
+ ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
+ ::std::vector< ::rtl::OUString > tables = getTableStrings( _pCon );
+
+ for ( sal_Int32 i = 0; i < tables.size(); i++ ) {
+ ODatabaseMetaDataResultSet::ORow aRow(3);
+
+ ::rtl::OUString aTableName = tables[i];
+
+ OSL_TRACE("TableName = >%s<\n", OUtoCStr( aTableName ) );
+
+ // Insert table into map
+ if (match( tableNamePattern, aTableName, '\0' ) ) {
+ if ( aTableName.getLength() == 0 ) {
+ aTableName = rtl::OUString::createFromAscii("AddressBook");
+ }
+
+ OSL_TRACE( "TableName = %s ; TableType = %s\n", OUtoCStr(aTableName), OUtoCStr(aTable) );
+
+ aRow.push_back( new ORowSetValueDecorator( aTableName ) ); // Table name
+ aRow.push_back( new ORowSetValueDecorator( aTable ) ); // Table type
+ aRow.push_back( ODatabaseMetaDataResultSet::getEmptyValue() ); // Remarks
+ aRows.push_back(aRow);
+ }
+ }
+
+ OSL_TRACE( "\tOUT MDatabaseMetaDataHelper::getTables()\n" );
+ return( aRows );
+}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
new file mode 100644
index 000000000000..118d532d5f51
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: MDatabaseMetaDataHelper.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
+#define _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
+
+ /*
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
+#include <com/sun/star/util/XCancellable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROWUPDATE_HPP_
+#include <com/sun/star/sdbc/XRowUpdate.hpp>
+#endif
+#ifndef _CPPUHELPER_COMPBASE7_HXX_
+#include <cppuhelper/compbase7.hxx>
+#endif
+*/
+#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#include <comphelper/proparrhlp.hxx>
+#endif
+ /*
+#ifndef _CONNECTIVITY_FILE_ASTATEMENT_HXX_
+#include "file/FStatement.hxx"
+#endif
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#include "connectivity/CommonTools.hxx"
+#endif
+*/
+#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
+#include <comphelper/propertycontainer.hxx>
+#endif
+
+#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
+#include "FDatabaseMetaDataResultSet.hxx"
+#endif
+
+#ifndef _CONNECTIVITY_MAB_CONNECTION_HXX_
+#include <MConnection.hxx>
+#endif
+
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class MDatabaseMetaDataHelper
+ {
+ public:
+ MDatabaseMetaDataHelper( );
+ ~MDatabaseMetaDataHelper();
+
+ ::std::vector< ::rtl::OUString >& getTableStrings(
+ OConnection* _pCon,
+ sal_Bool forceLoad = sal_False )
+ throw( ::com::sun::star::sdbc::SQLException );
+
+
+ ODatabaseMetaDataResultSet::ORows& getTables( OConnection* _pCon,
+ const ::rtl::OUString& tableNamePattern)
+ throw( ::com::sun::star::sdbc::SQLException );
+ private:
+ sal_Bool m_bProfileExists ;
+ ::std::vector< ::rtl::OUString > m_aTableNames;
+
+ };
+ }
+
+}
+#endif // _CONNECTIVITY_MAB_DATABASEMETADATAHELPER_HXX_
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
new file mode 100644
index 000000000000..60fee238a103
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: MNSInclude.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp, Darren Kenny
+ *
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
+#define _CONNECTIVITY_MAB_NS_INCLUDE_HXX_ 1
+
+//
+// Only include Mozilla include files once and using this file...
+//
+
+#ifndef BOOL
+# define MOZ_BOOL
+
+# define BOOL mozBOOL
+# define Bool mozBooL
+#endif
+
+
+// Turn off DEBUG Assertions
+#ifdef DEBUG
+# define MOZ_TMP_UDEBUG DEBUG
+# undef DEBUG
+#endif
+#include <nsDebug.h>
+#ifdef MOZ_TMP_UDEBUG
+# define DEBUG MOZ_TMP_UDEBUG
+#endif
+
+#include <xp_core.h>
+#include <nsCOMPtr.h>
+#include <nsISupportsArray.h>
+#include <nsStr.h>
+#include <nsString.h>
+#include <nsString2.h>
+#include <nsMemory.h>
+#include <prtypes.h>
+#include <nsRDFCID.h>
+#include <nsXPIDLString.h>
+#include <nsIRDFService.h>
+#include <nsIRDFResource.h>
+#include <msgCore.h>
+#include <nsIServiceManager.h>
+#include <nsIAbCard.h>
+#include <nsAbBaseCID.h>
+#include <nsAbAddressCollecter.h>
+#include <nsIPref.h>
+#include <nsIAddrBookSession.h>
+#include <nsIMsgHeaderParser.h>
+#include <nsIAddrBookSession.h>
+#include <nsIAbDirectory.h>
+#include <nsAbDirectoryQuery.h>
+#include <nsIAbDirectoryQuery.h>
+#include <nsIAbDirectoryQueryProxy.h>
+#include <nsIAbDirFactory.h>
+
+#ifdef MOZ_BOOL
+# undef BOOL
+# undef Bool
+#endif
+
+
+#endif // _CONNECTIVITY_MAB_NS_INCLUDE_HXX_
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
new file mode 100644
index 000000000000..24e985722f46
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * $RCSfile: MNameMapper.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+
+#include <MNameMapper.hxx>
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+
+using namespace connectivity::mozab;
+using namespace rtl;
+
+bool
+MNameMapper::ltstr::operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const
+{
+ return s1.compareTo(s2) < 0;
+}
+
+MNameMapper *MNameMapper::instance = NULL;
+
+MNameMapper*
+MNameMapper::getInstance()
+{
+ if ( MNameMapper::instance == NULL )
+ MNameMapper::instance = new MNameMapper();
+
+ return( MNameMapper::instance );
+}
+
+MNameMapper::MNameMapper()
+{
+ mDirMap = new MNameMapper::dirMap;
+}
+MNameMapper::~MNameMapper()
+{
+ if ( mDirMap != NULL ) {
+ MNameMapper::dirMap::iterator iter;
+ for (iter = mDirMap -> begin(); iter != mDirMap -> end(); ++iter) {
+ NS_IF_RELEASE(((*iter).second));
+ }
+ delete mDirMap;
+ }
+}
+
+// May modify the name passed in so that it's unique
+void
+MNameMapper::add( ::rtl::OUString& str, nsIAbDirectory* abook )
+{
+ MNameMapper::dirMap::iterator iter;
+
+ OSL_TRACE( "IN MNameMapper::add()\n" );
+
+ if ( abook == NULL ) {
+ OSL_TRACE( "\tOUT MNameMapper::add() called with null abook\n" );
+ return;
+ }
+
+ if ( mDirMap->find( str ) != mDirMap->end() ) {
+ // TODO - There's already and entry, so make the name unique
+ }
+ NS_IF_ADDREF(abook);
+ mDirMap->insert( MNameMapper::dirMap::value_type( str, abook ) );
+ OSL_TRACE( "\tOUT MNameMapper::add()\n" );
+}
+
+// Will replace the given dir
+void
+MNameMapper::replace( const ::rtl::OUString& str, nsIAbDirectory* abook )
+{
+ // TODO - needs to be implemented...
+ OSL_TRACE( "IN/OUT MNameMapper::add()\n" );
+}
+
+bool
+MNameMapper::getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook )
+{
+ MNameMapper::dirMap::iterator iter;
+
+ OSL_TRACE( "IN MNameMapper::getDir( %s )\n", OUtoCStr(str)?OUtoCStr(str):"NULL" );
+
+ if ( (iter = mDirMap->find( str )) != mDirMap->end() ) {
+ *abook = (*iter).second;
+ NS_IF_ADDREF(*abook);
+ } else {
+ *abook = NULL;
+ }
+
+ OSL_TRACE( "\tOUT MNameMapper::getDir() : %s\n", (*abook)?"True":"False" );
+
+ return( (*abook) != NULL );
+}
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
new file mode 100644
index 000000000000..f52f681720c8
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * $RCSfile: MNameMapper.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MAB_NAMEMAPPER_HXX_
+#define _CONNECTIVITY_MAB_NAMEMAPPER_HXX_ 1
+
+#include <map>
+
+// Mozilla includes
+#include <MNSInclude.hxx>
+
+// Star Includes
+#include <rtl/ustring.hxx>
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class MNameMapper
+ {
+ private:
+
+ struct ltstr
+ {
+ bool operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const;
+ };
+
+
+ typedef ::std::multimap< ::rtl::OUString, nsIAbDirectory *, ltstr > dirMap;
+
+ static MNameMapper *instance;
+ dirMap *mDirMap;
+
+ public:
+ static MNameMapper* getInstance();
+
+ MNameMapper();
+ ~MNameMapper();
+
+ // May modify the name passed in so that it's unique
+ void add( ::rtl::OUString& str, nsIAbDirectory* abook );
+
+ // Will replace the given dir
+ void replace( const ::rtl::OUString& str, nsIAbDirectory* abook );
+
+ // Get the directory corresponding to str
+ bool getDir( const ::rtl::OUString& str, nsIAbDirectory* *abook );
+
+ };
+
+ }
+}
+
+#endif //_CONNECTIVITY_MAB_NAMEMAPPER_HXX_
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
new file mode 100644
index 000000000000..f777696c5e1a
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
@@ -0,0 +1,591 @@
+/*************************************************************************
+ *
+ * $RCSfile: MQuery.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp, Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+#include <MQueryHelper.hxx>
+#include <MNameMapper.hxx>
+
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _CONNECTIVITY_MAB_QUERY_HXX_
+#include "MQuery.hxx"
+#endif
+#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_
+#include "MTypeConverter.hxx"
+#endif
+
+#ifdef DEBUG
+# define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
+#else /* DEBUG */
+# define OUtoCStr( x ) ("dummy")
+#endif /* DEBUG */
+
+static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
+static NS_DEFINE_CID(kAbDirectoryQueryArgumentsCID, NS_ABDIRECTORYQUERYARGUMENTS_CID);
+static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
+static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
+static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
+
+using namespace connectivity::mozab;
+using namespace connectivity;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbc;
+using namespace connectivity;
+
+// -------------------------------------------------------------------------
+// Used to store an nsIAbDirectoryQuery member without the need to use Mozilla
+// types in the MQuery.hxx file.
+//
+namespace connectivity {
+ namespace mozab {
+ struct MQueryDirectory {
+ nsCOMPtr<nsIAbDirectoryQuery> directory;
+ PRInt32 contextId;
+
+ MQueryDirectory() : contextId(-1) {}
+ };
+ }
+}
+
+// -------------------------------------------------------------------------
+MQuery::MQuery()
+{
+ OSL_TRACE( "IN MQuery::MQuery()\n" );
+
+ // Set default values. (For now just as a reminder).
+ m_bQuerySubDirs = sal_True; // LDAP Queryies require this to be set!
+ m_nMaxNrOfReturns = -1; // Unlimited number of returns.
+
+ m_aQueryDirectory = new MQueryDirectory();
+ // MQueryHelper is reference counted, so we need to add to the
+ // count here to prevent accidental deletion else where...
+ //
+ m_aQueryHelper = new MQueryHelper();
+ NS_IF_ADDREF( m_aQueryHelper);
+
+ OSL_TRACE( "\tOUT MQuery::MQuery()\n" );
+}
+// -------------------------------------------------------------------------
+MQuery::MQuery(const ::std::map< ::rtl::OUString, ::rtl::OUString> & ca)
+{
+ OSL_TRACE( "IN MQuery::MQuery( ca )\n" );
+
+ MQuery::MQuery();
+
+ m_aColumnAliasMap = ca;
+
+ OSL_TRACE( "\tOUT MQuery::MQuery( ca )\n" );
+}
+// -------------------------------------------------------------------------
+MQuery::~MQuery()
+{
+ OSL_TRACE("IN MQuery::~MQuery()\n");
+
+ // MQueryHelper is reference counted, so we need to decrement the
+ // count here.
+ //
+ if ( m_aQueryDirectory->contextId != -1 && m_aQueryDirectory->directory !=
+ NULL )
+ m_aQueryDirectory->directory->StopQuery(m_aQueryDirectory->contextId);
+
+ if ( m_aQueryDirectory )
+ delete m_aQueryDirectory;
+
+ NS_IF_RELEASE( m_aQueryHelper);
+
+ OSL_TRACE("\tOUT MQuery::~MQuery()\n");
+}
+// -------------------------------------------------------------------------
+void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
+{
+ OSL_TRACE("IN MQuery::setAttributes()\n");
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_aAttributes.clear();
+ ::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
+ ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
+ for(aIterAttr; aIterAttr != attrs.end();++aIterAttr) {
+ aIterMap = m_aColumnAliasMap.find(*aIterAttr);
+ if (aIterMap == m_aColumnAliasMap.end()) {
+ // Not found.
+ m_aAttributes.push_back(*aIterAttr);
+ } else {
+ m_aAttributes.push_back(aIterMap->second);
+ }
+ }
+
+ OSL_TRACE("\tOUT MQuery::setAttributes()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+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");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_aAddressbook = ab;
+
+ OSL_TRACE("\tOUT MQuery::setAddressbook()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+::rtl::OUString MQuery::getAddressbook() const
+{
+ OSL_TRACE("IN MQuery::getAddressbook()\n");
+
+ OSL_TRACE("\tOUT MQuery::getAddressbook()\n");
+
+ return(m_aAddressbook);
+}
+// -------------------------------------------------------------------------
+void MQuery::setMatchItems(::std::vector< ::rtl::OUString> &mi)
+{
+ OSL_TRACE("IN MQuery::setMatchItems()\n");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ ::std::vector< ::rtl::OUString>::iterator aIter = mi.begin();
+ ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
+
+ m_aMatchItems.clear();
+ for(aIter; aIter != mi.end();++aIter) {
+ aIterMap = m_aColumnAliasMap.find(*aIter);
+ if (aIterMap == m_aColumnAliasMap.end()) {
+ // Not found.
+ m_aMatchItems.push_back(*aIter);
+ }
+ else {
+ m_aMatchItems.push_back(aIterMap->second);
+ }
+ }
+ OSL_TRACE("\tOUT MQuery::setMatchItems()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+const ::std::vector< ::rtl::OUString> &MQuery::getMatchItems() const
+{
+ OSL_TRACE("IN MQuery::getMatchItems()\n");
+
+ OSL_TRACE("\tOUT MQuery::getMatchItems()\n");
+
+ return(m_aMatchItems);
+}
+// -------------------------------------------------------------------------
+void MQuery::setMatchValues(::std::vector< ::rtl::OUString>& mv)
+{
+ OSL_TRACE("IN MQuery::setMatchValues()\n");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ ::std::vector< ::rtl::OUString>::iterator aIter = mv.begin();
+ m_aMatchValues.clear();
+ for(aIter; aIter != mv.end();++aIter) {
+ m_aMatchValues.push_back(*aIter);
+ }
+ OSL_TRACE("\tOUT MQuery::setMatchValues()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+const ::std::vector< ::rtl::OUString>& MQuery::getMatchValues( void ) const
+{
+ OSL_TRACE("IN MQuery::getMatchValues()\n");
+
+ OSL_TRACE("\tOUT MQuery::getMatchValue()\n");
+
+ return(m_aMatchValues);
+}
+// -------------------------------------------------------------------------
+void MQuery::setMaxNrOfReturns(const sal_Int32 mnr)
+{
+ OSL_TRACE( "IN MQuery::setMaxNrOfReturns()\n" );
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_nMaxNrOfReturns = mnr;
+ OSL_TRACE("\tOUT MQuery::setMaxNrOfReturns()\n" );
+
+ return;
+}
+// -------------------------------------------------------------------------
+sal_Int32 MQuery::getMaxNrOfReturns() const
+{
+ OSL_TRACE("IN MQuery::getMaxNrOfReturns()\n");
+
+ OSL_TRACE("\tOUT MQuery::getMaxNrOfReturns()\n");
+
+ return(m_nMaxNrOfReturns);
+}
+// -------------------------------------------------------------------------
+void MQuery::setQuerySubDirs(sal_Bool &qsd)
+{
+ OSL_TRACE("IN MQuery::setQuerySubDirs()\n");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_bQuerySubDirs = qsd;
+ OSL_TRACE("\tOUT MQuery::setQuerySubDirs()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+sal_Bool MQuery::getQuerySubDirs() const
+{
+ OSL_TRACE("IN MQuery::getQuerySubDirs()\n");
+
+ OSL_TRACE("\tOUT MQuery::getQuerySubDirs()\n");
+
+ return(m_bQuerySubDirs);
+}
+// -------------------------------------------------------------------------
+void MQuery::setSqlOppr(::std::vector< MQuery::eSqlOppr > &so)
+{
+ OSL_TRACE("IN MQuery::setSqlOppr()\n");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ m_aSqlOppr.clear();
+ m_aSqlOppr = so;
+
+ OSL_TRACE("\tOUT MQuery::setSqlOppr()\n");
+
+ return;
+}
+// -------------------------------------------------------------------------
+const ::std::vector< MQuery::eSqlOppr > &MQuery::getSqlOppr() const
+{
+ OSL_TRACE("IN MQuery::getSqlOppr()\n");
+
+ OSL_TRACE("\tOUT MQuery::getSqlOppr()\n");
+
+ return(m_aSqlOppr);
+}
+// -------------------------------------------------------------------------
+sal_Int32 MQuery::executeQuery(sal_Bool _bIsOutlookExpress)
+{
+ OSL_TRACE("IN MQuery::executeQuery()\n");
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+
+ nsresult rv; // Store return values.
+ // MTypeConverter aTypeConverter;
+ // Create a nsIAbDirectory object to initialise the nsIAbDirectoryQuery object.
+ nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)) ;
+ if (NS_FAILED(rv))
+ return(-1);
+
+ nsCOMPtr<nsIAbDirectory> directory;
+ MNameMapper *nmap = MNameMapper::getInstance();
+
+ if ( nmap->getDir( m_aAddressbook, getter_AddRefs( directory ) ) == sal_False )
+ return( -1 );
+
+ // Create a nsIAbDirectoryQuery object which eventually will execute
+ // the query by calling DoQuery().
+ nsCOMPtr< nsIAbDirectoryQueryProxy > directoryQueryProxy = do_CreateInstance( kAbDirectoryQueryProxyCID, &rv);
+
+ m_aQueryDirectory->directory = do_QueryInterface(directory, &rv);
+
+ if ( NS_FAILED(rv) || _bIsOutlookExpress)
+ {
+ // Need to turn this off for anything using the Query Proxy since it
+ // treats Mailing Lists as directories!
+ m_bQuerySubDirs = sal_False;
+
+ rv = directoryQueryProxy->Initiate (directory);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ m_aQueryDirectory->directory = do_QueryInterface (directoryQueryProxy, &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+ OSL_TRACE("Using the directoryQueryProxy\n");
+ }
+#ifdef DEBUG
+ else
+ OSL_TRACE("Not using a Query Proxy, Query i/f supported by directory\n");
+#endif /* DEBUG */
+
+ // Array that holds all matchItems, to be passed to DoQuery().
+ nsCOMPtr<nsISupportsArray> matchItems;
+ NS_NewISupportsArray(getter_AddRefs(matchItems));
+
+ // Add every individual boolString to matchItems array.
+ ::std::vector< ::rtl::OUString>::iterator aIterMi = m_aMatchItems.begin();
+ ::std::vector< eSqlOppr >::iterator aIterOp = m_aSqlOppr.begin();
+ ::std::vector< ::rtl::OUString>::iterator aIterVal = m_aMatchValues.begin();
+ nsString matchValue;
+ // Initialise the matchItems container.
+ for(aIterMi; aIterMi != m_aMatchItems.end();++aIterMi, ++aIterOp, ++aIterVal)
+ {
+ nsCOMPtr<nsIAbBooleanConditionString> boolString = do_CreateInstance (kBooleanConditionStringCID, &rv);
+ NS_ENSURE_SUCCESS( rv, rv );
+ // Set the 'name' property of the boolString.
+ string aMiName = MTypeConverter::ouStringToStlString(*aIterMi);
+ boolString->SetName(strdup(aMiName.c_str()));
+ OSL_TRACE("Name = %s ;", aMiName.c_str() );
+ // Set the 'matchType' property of the boolString. Check for equal length.
+ if (aIterOp == m_aSqlOppr.end() && aIterMi != m_aMatchItems.end()) {
+ m_aSqlOppr.push_back(matchIs); // Add matchIs for non-set value.
+ }
+ switch(*aIterOp) {
+ case matchExists:
+ OSL_TRACE("matchExists; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::Exists);
+ break;
+ case matchDoesNotExist:
+ OSL_TRACE("matchDoesNotExist; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotExist);
+ break;
+ case matchContains:
+ OSL_TRACE("matchContains; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::Contains);
+ break;
+ case matchDoesNotContain:
+ OSL_TRACE("matchDoesNotContain; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::DoesNotContain);
+ break;
+ case matchIs:
+ OSL_TRACE("matchIs; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
+ break;
+ case matchIsNot:
+ OSL_TRACE("matchIsNot; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::IsNot);
+ break;
+ case matchBeginsWith:
+ OSL_TRACE("matchBeginsWith; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::BeginsWith);
+ break;
+ case matchEndsWith:
+ OSL_TRACE("matchEndsWith; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::EndsWith);
+ break;
+ case matchSoundsLike:
+ OSL_TRACE("matchSoundsLike; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::SoundsLike);
+ break;
+ case matchRegExp:
+ OSL_TRACE("matchRegExp; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::RegExp);
+ break;
+ default:
+ OSL_TRACE("(default) matchIs; ");
+ boolString->SetCondition(nsIAbBooleanConditionTypes::Is);
+ break;
+ }
+ // Set the 'matchValue' property of the boolString. Value returned in unicode.
+ if ( (*aIterVal) )
+ {
+ OSL_TRACE("Value = %s \n", OUtoCStr( (*aIterVal) ) );
+ MTypeConverter::ouStringToNsString( (*aIterVal), matchValue);
+ boolString->SetValue(matchValue.ToNewUnicode ());
+ }
+ // Add the individual boolString to the container of matchItems.
+ matchItems->AppendElement(boolString);
+ }
+ nsCOMPtr< nsIAbBooleanExpression > queryExpression = do_CreateInstance( kBooleanExpressionCID , &rv);
+ NS_ENSURE_SUCCESS( rv, rv );
+ queryExpression->SetExpressions(matchItems);
+ queryExpression->SetOperation(nsIAbBooleanOperationTypes::OR);
+
+ // Add every atribute we're interested in to the return properties array.
+ ::std::vector< ::rtl::OUString>::iterator aIterAttr = m_aAttributes.begin();
+ char **returnProperties = new char* [ m_aAttributes.size() + 2 ];
+
+ PRInt32 count=0;
+ returnProperties[count] = strdup( "card:nsIAbCard");
+ for(aIterAttr, count=1; aIterAttr != m_aAttributes.end();++aIterAttr,++count)
+ {
+ ::std::string aAttrName = MTypeConverter::ouStringToStlString(*aIterAttr);
+ returnProperties[count] = strdup( aAttrName.c_str() );
+ OSL_TRACE("returnProperties[%d] = %s\n", count, returnProperties[count] );
+ }
+ returnProperties[count] = NULL;
+
+ nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
+
+ NS_ENSURE_SUCCESS( rv, rv );
+ rv = arguments->SetExpression(queryExpression);
+ NS_ENSURE_SUCCESS( rv, rv );
+
+ rv = arguments->SetReturnProperties(count, (const char **)returnProperties);
+ NS_ENSURE_SUCCESS( rv, rv );
+
+ rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
+ NS_ENSURE_SUCCESS( rv, rv );
+
+ // Execute the query.
+ OSL_TRACE( "****** calling DoQuery\n");
+
+ m_aQueryHelper->reset();
+
+ rv = m_aQueryDirectory->directory->DoQuery(arguments, m_aQueryHelper, m_nMaxNrOfReturns, -1, &m_aQueryDirectory->contextId);
+
+ if (NS_FAILED(rv)) {
+ m_aQueryDirectory->contextId = -1;
+ OSL_TRACE( "****** DoQuery failed\n");
+ OSL_TRACE("\tOUT MQuery::executeQuery()\n");
+ m_aQueryHelper->notifyQueryError() ;
+ return(-1);
+ } else {
+ OSL_TRACE( "****** DoQuery succeeded \n");
+ }
+
+ OSL_TRACE("\tOUT MQuery::executeQuery()\n");
+
+ return(0);
+}
+
+// -------------------------------------------------------------------------
+//
+//
+// If the query executed is being done asynchronously then this may return
+// -1 as the count, ie. it's undetermined.
+//
+sal_Int32
+MQuery::getRowCount()
+{
+ return( m_aQueryHelper->getResultCount() );
+}
+
+// -------------------------------------------------------------------------
+//
+//
+// As opposed to getRowCount() this returns the actual number of rows fetched
+// so far (if is an async query)
+//
+sal_uInt32
+MQuery::getRealRowCount()
+{
+ return( m_aQueryHelper->getRealCount() );
+}
+
+//
+// If the query executed is being done asynchronously then this may be
+// false
+//
+sal_Bool
+MQuery::queryComplete( void )
+{
+ return( m_aQueryHelper->queryComplete() );
+}
+
+void
+MQuery::waitForQueryComplete( void )
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ m_aQueryHelper->waitForQueryComplete();
+}
+
+// -------------------------------------------------------------------------
+
+sal_Bool
+MQuery::checkRowAvailable( sal_Int32 nDBRow )
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ while( !queryComplete() && m_aQueryHelper->getRealCount() <= nDBRow )
+ m_aQueryHelper->waitForRow( nDBRow );
+
+ return( getRowCount() > nDBRow );
+}
+
+// -------------------------------------------------------------------------
+void
+MQuery::getRowValue( ORowSetValue& rValue, sal_Int32 nDBRow, rtl::OUString& aDBColumnName, sal_Int32 nType )
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ rtl::OUString sValue;
+
+ OSL_TRACE( "IN MQuery::getRowValue()\n");
+
+ MQueryHelperResultEntry* xResEntry = m_aQueryHelper->getByIndex( nDBRow );
+
+ OSL_ENSURE( xResEntry != NULL, "xResEntry == NULL");
+ if (xResEntry == NULL )
+ {
+ rValue.setNull();
+ return;
+ }
+ ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
+ switch ( nType ) {
+ case DataType::VARCHAR:
+ aIterMap = m_aColumnAliasMap.find(aDBColumnName);
+ if (aIterMap != m_aColumnAliasMap.end()) {
+ sValue = xResEntry->getValue(aIterMap->second);
+ } else {
+ sValue = xResEntry->getValue( aDBColumnName );
+ }
+ rValue = sValue;
+ break;
+ default:
+ OSL_TRACE("Unknown DataType : %d\n", nType );
+ rValue.setNull();
+ break;
+ }
+
+ OSL_TRACE( "\tOUT MQuery::getRowValue()\n");
+}
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
new file mode 100644
index 000000000000..8bcbc18a4d9d
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * $RCSfile: MQuery.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _CONNECTIVITY_MAB_QUERY_HXX_
+#define _CONNECTIVITY_MAB_QUERY_HXX_
+
+#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_
+#include <com/sun/star/sdbc/SQLException.hpp>
+#endif
+#ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
+#include "MColumnAlias.hxx"
+#endif
+#include <connectivity/FValue.hxx>
+
+namespace connectivity
+{
+ namespace mozab
+ {
+
+ class MQueryHelper;
+ struct MQueryDirectory;
+
+ //class MQuery : public nsIAbDirectoryQueryResultListener
+ class MQuery
+ {
+ /*
+ * A query resultset with a maximum limit of
+ * m_nMaxNrOfReturns return items, is created from
+ * the following SQL statement:
+ *
+ * -------------------------------------------------
+ * SELECT m_aAttributes FROM m_aAddressbook
+ * WHERE m_aMatchItems SQL_OPR m_aMatchValue
+ * -------------------------------------------------
+ *
+ * We are\are not, depending on boolean m_bQuerySubDirs,
+ * interested in querying the sub-directories of the
+ * addressbook directory, if any.
+ *
+ * SQL_OPR:
+ * m_aSqlOppr contains the SQL operations for every
+ * attribute in m_aAttributes.
+ * This member must be initialised together with
+ * m_aAttributes.
+ *
+ * The SQL operations defined for 'SQL_OPR' are:
+ * matchExists = 0,
+ * matchDoesNotExist = 1,
+ * matchContains = 2,
+ * matchDoesNotContain = 3,
+ * matchIs = 4,
+ * matchIsNot = 5,
+ * matchBeginsWith = 6,
+ * matchEndsWith = 7,
+ * matchSoundsLike = 8,
+ * matchRegExp = 9.
+ * There must be mapping to one of these values.
+ *
+ * The following members MUST be initialised before
+ * a query is executed:
+ * m_Attributes, m_aMapAttrOppr, m_aAddressbook,
+ * m_aMatchItems and m_aMatchValue.
+ *
+ * m_bQuerySubDirs and m_nMaxNrReturns are set to a
+ * default value in the constructor which can be
+ * overridden. If (element of) m_aSqlOppr is not set,
+ * the default SQL operation is 'matchIs'.
+ *
+ */
+ public:
+ typedef enum {
+ matchExists = 0,
+ matchDoesNotExist = 1,
+ matchContains = 2,
+ matchDoesNotContain = 3,
+ matchIs = 4,
+ matchIsNot = 5,
+ matchBeginsWith = 6,
+ matchEndsWith = 7,
+ matchSoundsLike = 8,
+ matchRegExp = 9
+ } eSqlOppr;
+
+ private:
+ MQueryDirectory *m_aQueryDirectory;
+ MQueryHelper *m_aQueryHelper;
+ ::std::vector< ::rtl::OUString> m_aAttributes;
+ ::rtl::OUString m_aAddressbook;
+ ::std::vector< ::rtl::OUString> m_aMatchItems;
+ ::std::vector< ::rtl::OUString> m_aMatchValues;
+ sal_Int32 m_nMaxNrOfReturns;
+ sal_Bool m_bQuerySubDirs;
+ ::std::vector<eSqlOppr> m_aSqlOppr;
+ ::std::map< ::rtl::OUString,
+ ::rtl::OUString> m_aColumnAliasMap;
+ protected:
+ ::osl::Mutex m_aMutex;
+ public:
+ /*
+ * - Contains accessors to the members of this class.
+ * - executeQuery() initiates a non-blocking query.
+ */
+ void setAttributes( ::std::vector< ::rtl::OUString>&);
+ const ::std::vector< ::rtl::OUString> &getAttributes(void) const;
+ void setAddressbook( ::rtl::OUString&);
+ ::rtl::OUString getAddressbook(void) const;
+ void setMatchItems( ::std::vector< ::rtl::OUString>&);
+ const ::std::vector< ::rtl::OUString> &getMatchItems(void) const;
+ void setMatchValues( ::std::vector< ::rtl::OUString>&);
+ const ::std::vector< ::rtl::OUString> &getMatchValues(void) const;
+ void setMaxNrOfReturns( const sal_Int32);
+ sal_Int32 getMaxNrOfReturns(void) const;
+ void setQuerySubDirs( sal_Bool&);
+ sal_Bool getQuerySubDirs(void) const;
+ void setSqlOppr( ::std::vector< eSqlOppr >&);
+ const ::std::vector< eSqlOppr > &getSqlOppr(void) const;
+ sal_Int32 executeQuery(sal_Bool _bIsOutlookExpress);
+
+ sal_Int32 getRowCount( void );
+
+ sal_uInt32 getRealRowCount( void );
+
+ sal_Bool queryComplete( void );
+
+ void waitForQueryComplete( void ) throw( ::com::sun::star::sdbc::SQLException );
+
+ sal_Bool checkRowAvailable( sal_Int32 nDBRow ) throw( ::com::sun::star::sdbc::SQLException );
+
+ void getRowValue( connectivity::ORowSetValue& rValue,
+ sal_Int32 nDBRow, rtl::OUString& aDBColumnName,
+ sal_Int32 nType )
+ throw( ::com::sun::star::sdbc::SQLException );
+
+ public:
+ MQuery();
+ MQuery(const ::std::map< ::rtl::OUString, ::rtl::OUString> &);
+ virtual ~MQuery();
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_MAB_QUERY_HXX_
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
new file mode 100644
index 000000000000..54966f1cf5d7
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx
@@ -0,0 +1,517 @@
+/*************************************************************************
+ *
+ * $RCSfile: MQueryHelper.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Darren Kenny, Willem van Dorp
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MAB_QUERYHELPER_HXX_
+#include <MQueryHelper.hxx>
+#endif
+#include "MTypeConverter.hxx"
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+
+using namespace connectivity::mozab;
+
+NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
+
+//
+// class MQueryHelperResultEntry
+//
+
+
+MQueryHelperResultEntry::MQueryHelperResultEntry()
+{
+}
+
+MQueryHelperResultEntry::~MQueryHelperResultEntry()
+{
+}
+
+void
+MQueryHelperResultEntry::insert( rtl::OUString &key, rtl::OUString &value )
+{
+ m_Fields.insert( fieldMap::value_type( key, value ) );
+}
+
+rtl::OUString
+MQueryHelperResultEntry::getValue( const rtl::OUString &key ) const
+{
+ fieldMap::const_iterator iter;
+
+ iter = m_Fields.find( key );
+
+ if ( iter == m_Fields.end() ) {
+ return rtl::OUString();
+ } else {
+ return (*iter).second;
+ }
+}
+
+//
+// class MQueryHelper
+//
+// MIME-types.
+static char PreferMailFormatTypes[2][11] = {"text/plain",
+ "text/html"};
+// This is what mozilla returns.
+static char mozPreferMailFormatTypes[3][11] = {"unknown",
+ "plaintext",
+ "html"};
+
+
+MQueryHelper::MQueryHelper()
+ : m_nIndex( 0 )
+ , m_bHasMore( sal_True )
+ , m_bQueryComplete( sal_False )
+ , m_bAtEnd( sal_False )
+ , m_bErrorCondition( sal_False )
+{
+ m_aResults.clear();
+}
+
+MQueryHelper::~MQueryHelper()
+{
+ clear_results();
+}
+
+void
+MQueryHelper::append(MQueryHelperResultEntry* resEnt )
+{
+ if ( resEnt != NULL ) {
+ m_aResults.push_back( resEnt );
+ m_bAtEnd = sal_False;
+ }
+}
+
+void
+MQueryHelper::clear_results()
+{
+ resultsArray::iterator iter = m_aResults.begin();
+ while ( iter != m_aResults.end() ) {
+ delete (*iter);
+ ++iter;
+ }
+ m_aResults.clear();
+}
+
+void
+MQueryHelper::rewind()
+{
+ m_nIndex = 0;
+}
+
+void
+MQueryHelper::reset()
+{
+ m_nIndex = 0;
+ m_bHasMore = sal_True;
+ m_bQueryComplete = sal_False;
+ m_bAtEnd = sal_False;
+ m_bErrorCondition = sal_False;
+ clear_results();
+}
+
+void
+MQueryHelper::clearResultOrComplete()
+{
+ // Don't use a Mutex, it should be called by a method already holding it.
+ OSL_TRACE("In/Out : clearResultOrComplete()");
+ m_aCondition.reset();
+}
+
+void
+MQueryHelper::notifyResultOrComplete()
+{
+ OSL_TRACE("In/Out : notifyResultOrComplete()");
+ m_aCondition.set();
+}
+
+void
+MQueryHelper::waitForResultOrComplete()
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ TimeValue timeValue = { 20, 0 }; // 20 Seconds 0 NanoSecond timeout
+ osl::Condition::Result rv = ::osl::Condition::result_ok;
+
+ OSL_TRACE("In : waitForResultOrComplete()");
+ // Can't hold mutex or condition would never get set...
+ while( m_aCondition.check() == sal_False || rv == ::osl::Condition::result_error ) {
+ rv = m_aCondition.wait( &timeValue );
+ if ( rv == ::osl::Condition::result_timeout ) {
+ OSL_TRACE("waitForResultOrComplete() : Timeout!");
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Timeout waiting from result"),NULL);
+ }
+ }
+
+ if ( isError() ) {
+ OSL_TRACE("waitForResultOrComplete() : Error returned!");
+ ::dbtools::throwGenericSQLException(
+ ::rtl::OUString::createFromAscii("Error found when executing query"),NULL);
+ }
+ OSL_TRACE(" Out : waitForResultOrComplete()");
+}
+
+
+MQueryHelperResultEntry*
+MQueryHelper::next()
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ MQueryHelperResultEntry* result;
+ sal_Int32 index;
+
+ m_aMutex.acquire();
+ index = m_nIndex;
+ m_aMutex.release();
+
+ result = getByIndex( m_nIndex + 1 ) ; // Add 1 as Row is numbered from 1 to N
+
+ if ( result ) {
+ m_aMutex.acquire();
+ m_nIndex++;
+ m_aMutex.release();
+ }
+
+ return( result );
+}
+
+MQueryHelperResultEntry*
+MQueryHelper::getByIndex( sal_Int32 nRow )
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ // Row numbers are from 1 to N, need to ensure this, and then
+ // substract 1
+ if ( nRow < 1 ) {
+ return( NULL );
+ }
+
+ do {
+ // Obtain the Mutex - don't use a guard as we want to be able to release
+ // and acquire again...
+ m_aMutex.acquire();
+ if ( nRow > m_aResults.size() ) {
+ if ( m_bQueryComplete ) {
+ m_bAtEnd = sal_True;
+ m_aMutex.release();
+ return( NULL );
+ } else {
+ clearResultOrComplete();
+ m_aMutex.release();
+ waitForResultOrComplete();
+ }
+ } else {
+ m_aMutex.release();
+ return( m_aResults[ nRow -1 ] );
+ }
+ } while ( sal_True );
+
+ OSL_TRACE("!!!!! Shouldn't have reached this!!!!\n");
+
+ return( NULL );
+
+}
+
+sal_Bool
+MQueryHelper::hasMore() const
+{
+ return m_bHasMore;
+}
+
+sal_Bool
+MQueryHelper::atEnd() const
+{
+ return m_bAtEnd;
+}
+
+sal_Bool
+MQueryHelper::isError() const
+{
+ return m_bErrorCondition;
+}
+
+sal_Bool
+MQueryHelper::queryComplete() const
+{
+ return m_bQueryComplete;
+}
+
+void
+MQueryHelper::waitForQueryComplete()
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ m_aMutex.acquire();
+
+ OSL_TRACE("In : waitForQueryComplete()");
+ if ( ! m_bQueryComplete ) {
+ do
+ {
+ m_aMutex.release();
+ clearResultOrComplete();
+ waitForResultOrComplete();
+ m_aMutex.acquire();
+ }
+ while ( !m_bQueryComplete );
+ }
+
+ m_aMutex.release();
+ OSL_TRACE("Out : waitForQueryComplete()");
+}
+
+void
+MQueryHelper::waitForRow( sal_Int32 rowNum )
+ throw( ::com::sun::star::sdbc::SQLException )
+{
+ m_aMutex.acquire();
+ do
+ {
+ m_aMutex.release();
+ clearResultOrComplete();
+ waitForResultOrComplete();
+ m_aMutex.acquire();
+ }
+ while ( !m_bQueryComplete && m_aResults.size() < rowNum );
+
+ m_aMutex.release();
+}
+
+// -------------------------------------------------------------------------
+
+sal_Int32
+MQueryHelper::getResultCount() const
+{
+ OSL_TRACE( "IN MQueryHelper::getResultCount()" );
+ if ( !m_bQueryComplete )
+ {
+ OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = -1\n");
+ return -1;
+ }
+ else
+ {
+ OSL_TRACE( "\tOUT MQueryHelper::getResultCount() = %d\n", m_aResults.size() );
+ return m_aResults.size();
+ }
+}
+
+// -------------------------------------------------------------------------
+
+sal_uInt32
+MQueryHelper::getRealCount() const
+{
+ OSL_TRACE( "IN/OUT MQueryHelper::getRealCount() = %d\n", m_aResults.size() );
+ return m_aResults.size();
+}
+
+// -------------------------------------------------------------------------
+NS_IMETHODIMP MQueryHelper::OnQueryItem(nsIAbDirectoryQueryResult *result)
+{
+ OSL_TRACE( "IN MQueryHelper::OnQueryItem()\n" );
+
+ nsresult rv;
+ PRInt32 resultType;
+
+ if ( result == NULL ) {
+ OSL_TRACE("\tresult ptr is NULL\n");
+ return NS_OK;
+ }
+
+ // Get return status of executeQuery() call.
+ rv = result -> GetType(&resultType);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Check for errors of the executeQuery() call.
+ m_bQueryComplete = sal_True; // Default to True
+ switch ( resultType ) {
+ case nsIAbDirectoryQueryResult::queryResultError:
+ OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultError\n");
+ m_bErrorCondition = sal_True;
+ notifyResultOrComplete();
+ return NS_OK;
+ break;
+ case nsIAbDirectoryQueryResult::queryResultStopped:
+ OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultStopped\n");
+ notifyResultOrComplete();
+ return NS_OK;
+ break;
+ case nsIAbDirectoryQueryResult::queryResultComplete:
+ OSL_TRACE("\tresultType == nsIAbDirectoryQueryResult::queryResultComplete\n");
+ notifyResultOrComplete();
+ return NS_OK;
+ break;
+ case nsIAbDirectoryQueryResult::queryResultMatch:
+ OSL_TRACE("IN MQueryHelper::OnQueryItem --> queryResultMatch\n");
+ // Don't return, continues onto rest of method.
+ break;
+ default:
+ OSL_TRACE("\t******** Unexpected : resultType\n");
+ return NS_OK;
+ break;
+ }
+
+ // Initialise an array that holds the resultset of the query.
+ m_bQueryComplete = sal_False;
+ nsCOMPtr<nsISupportsArray> properties;
+ rv = result -> GetResult(getter_AddRefs (properties));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRUint32 count;
+ rv = properties -> Count(&count);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Initialise the resultset (xResultSet).
+ OSL_TRACE("\tGot %d properties\n", count );
+ if ( count > 0 ) {
+ PRUint32 i;
+
+ // Need to determine if it's a MailingList, so first find the
+ // nsIAbCard property any check the boolean isMailList
+ for ( i = 0; i < count; ++i) {
+ nsCOMPtr<nsISupports> item;
+ rv = properties -> GetElementAt(i, getter_AddRefs(item));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsCOMPtr<nsIAbDirectoryQueryPropertyValue> property(do_QueryInterface(item,
+&rv));
+
+ char *name;
+ rv = property -> GetName(&name);
+ if ( !strcmp(name,"card:nsIAbCard") ) {
+ nsCOMPtr<nsISupports> cardSupports;
+ property->GetValueISupports (getter_AddRefs (cardSupports));
+ nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
+
+ PRBool bIsMailList = PR_FALSE;
+ card->GetIsMailList( &bIsMailList );
+ if ( bIsMailList ) {
+ // No just skip, ie. return without inserting.
+ nsMemory::Free(name);
+ return(NS_OK);
+ }
+ else {
+ break;
+ }
+ }
+ nsMemory::Free(name);
+ }
+ MQueryHelperResultEntry *resEntry = new MQueryHelperResultEntry();
+ for (i = 0; i < count; ++i) {
+ nsCOMPtr<nsISupports> item;
+ rv = properties -> GetElementAt(i, getter_AddRefs(item));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsCOMPtr<nsIAbDirectoryQueryPropertyValue> property(do_QueryInterface(item, &rv));
+
+ // TODO (1line)
+ char *name;
+ rv = property -> GetName(&name);
+ ::rtl::OUString sValue;
+ ::rtl::OUString sName = ::rtl::OUString::createFromAscii( name );
+ OSL_TRACE("IN OMozabQueryHelper::OnQueryItem --> name = %s\n", name);
+ if ( !strcmp(name,"card:nsIAbCard") ) {
+ // Do Nothing, property is useless outside here
+ }
+ else {
+
+ unsigned short *value;
+ rv = property -> GetValue(&value);
+ // Default value for PerferMailFormat is mime type text/plain.
+ // Mapping for PreferMailFormat values to Mime-types.
+ if (strcmp(name, "PreferMailFormat") == 0) {
+ nsCAutoString val_c;
+ val_c.AssignWithConversion(value);
+ if (strcmp((char *) val_c.get(), mozPreferMailFormatTypes[0]) == 0) {
+ // unknown, insert plain/text mime type
+ sValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
+ } else if (strcmp((char *) val_c.get(), mozPreferMailFormatTypes[1]) == 0) {
+ // plaintext
+ sValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
+ } else if (strcmp((char *) val_c.get(), mozPreferMailFormatTypes[2]) == 0) {
+ // html
+ sValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[1]);
+ } else {
+ // undefined value passed back from mozilla, insert text/plain
+ sValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
+ }
+ } else {
+ // All other fields but PreferMailFormat.
+ nsAutoString v (value);
+ MTypeConverter::nsStringToOUString( v, sValue );
+ }
+ nsMemory::Free(value);
+ }
+ nsMemory::Free(name);
+ resEntry->insert( sName, sValue );
+ }
+ append( resEntry );
+ }
+
+ OSL_TRACE( "\tOUT MQueryHelper::OnQueryItem()\n" );
+
+ notifyResultOrComplete();
+
+ return(NS_OK);
+}
+
+void MQueryHelper::notifyQueryError()
+{
+ m_bQueryComplete = sal_True ;
+ notifyResultOrComplete() ;
+}
+
+// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
new file mode 100644
index 000000000000..d31bbaf9903d
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * $RCSfile: MQueryHelper.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MAB_QUERYHELPER_HXX_
+#define _CONNECTIVITY_MAB_QUERYHELPER_HXX_
+
+#include <MNSInclude.hxx>
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _OSL_CONDITN_HXX_
+#include <osl/conditn.hxx>
+#endif
+#ifndef _COMPHELPER_STLTYPES_HXX_
+#include <comphelper/stl_types.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_
+#include <com/sun/star/sdbc/SQLException.hpp>
+#endif
+
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class MQueryHelperResultEntry
+ {
+ private:
+ mutable ::osl::Mutex m_aMutex;
+
+ DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,fieldMap);
+
+ fieldMap m_Fields;
+
+ public:
+ MQueryHelperResultEntry();
+ ~MQueryHelperResultEntry();
+
+ void insert( rtl::OUString &key, rtl::OUString &value );
+ rtl::OUString getValue( const rtl::OUString &key ) const;
+ };
+
+ class MQueryHelper : public nsIAbDirectoryQueryResultListener
+ {
+ private:
+ typedef std::vector< MQueryHelperResultEntry* > resultsArray;
+
+ mutable ::osl::Mutex m_aMutex;
+ ::osl::Condition m_aCondition;
+ resultsArray m_aResults;
+ sal_Int32 m_nIndex;
+ sal_Bool m_bHasMore;
+ sal_Bool m_bAtEnd;
+ sal_Bool m_bErrorCondition;
+ sal_Bool m_bQueryComplete;
+
+ void append(MQueryHelperResultEntry* resEnt );
+
+ void clear_results();
+
+ void clearResultOrComplete();
+ void notifyResultOrComplete();
+ void waitForResultOrComplete()
+ throw( ::com::sun::star::sdbc::SQLException );
+
+
+ public:
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER
+
+ MQueryHelper();
+
+ ~MQueryHelper();
+
+ void reset();
+
+ void rewind();
+
+ MQueryHelperResultEntry* next() throw( ::com::sun::star::sdbc::SQLException );
+
+ MQueryHelperResultEntry* getByIndex( sal_Int32 nRow ) throw( ::com::sun::star::sdbc::SQLException );
+
+ sal_Bool isError() const;
+
+ sal_Bool hasMore() const;
+
+ sal_Bool atEnd() const;
+
+ sal_Bool queryComplete() const;
+
+ void waitForQueryComplete() throw( ::com::sun::star::sdbc::SQLException );
+
+ void waitForRow( sal_Int32 rowNum ) throw( ::com::sun::star::sdbc::SQLException );
+
+ sal_Int32 getResultCount() const;
+
+ sal_uInt32 getRealCount() const;
+
+ void notifyQueryError() ;
+
+ };
+ }
+}
+#endif // _CONNECTIVITY_MAB_QUERYHELPER_HXX_
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
new file mode 100644
index 000000000000..604820d9f1fa
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTypeConverter.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp, Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+#include <MNSInclude.hxx>
+
+#ifndef _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
+#include "MTypeConverter.hxx"
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+
+using namespace connectivity::mozab;
+
+// -------------------------------------------------------------------------
+void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss)
+{
+ OSL_TRACE( "IN MTypeConverter::OUStringToNsString()\n" );
+
+ // Convert to ::rtl::OString (utf-8 encoding).
+ ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8);
+
+ const char *cs = os.getStr();
+ PRUint32 csLen = os.getLength();
+
+ NS_ConvertUTF8toUCS2 mozString(cs, csLen);
+ //const PRUnichar* uniMozString = (const PRUnichar*) mozString;
+ nss = mozString; // temp.
+
+ OSL_TRACE( "\tOUT MTypeConverter::OUStringToNsString()\n" );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
+{
+ OSL_TRACE( "IN MTypeConverter::nsStringToOUString()\n" );
+
+ // Get clone of buffer.
+ PRUnichar *uc = nss.ToNewUnicode();
+ sal_Int32 nssLen = nss.Length();
+
+ // TODO check if this is ok.
+ ::rtl::OUString _ous(uc, nssLen);
+ ous = _ous;
+
+ nsMemory::Free(uc);
+
+ OSL_TRACE( "\tOUT MTypeConverter::nsStringToOUString()\n" );
+}
+// -------------------------------------------------------------------------
+void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString &ous)
+{
+ OSL_TRACE( "IN MTypeConverter::prUniCharToOUString()\n" );
+
+ // TODO, specify length.
+ ::rtl::OUString _ous(pru);
+ ous = _ous;
+
+ OSL_TRACE( "\tOUT MTypeConverter::prUniCharToOUString()\n" );
+}
+// -------------------------------------------------------------------------
+char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous)
+{
+ OSL_TRACE( "IN MTypeConverter::OUStringToCCharStringUtf8()\n" );
+
+ // Convert to ::rtl::OString,
+ ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8);
+
+ const char *cs = os.getStr();
+
+ OSL_TRACE( "\tOUT MTypeConverter::OUStringToCCharStringUtf8()\n" );
+ return(strdup(cs));
+}
+// -------------------------------------------------------------------------
+char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous)
+{
+ OSL_TRACE( "IN MTypeConverter::OUStringToCCharStringAscii()\n" );
+
+ // Convert ::rtl::OUString to ::rtl::OString,
+ ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_ASCII_US);
+
+ OSL_TRACE( "\tOUT MTypeConverter::OUStringToCCharStringAscii()\n" );
+ return(strdup(os.getStr()));
+}
+// -------------------------------------------------------------------------
+char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss)
+{
+ OSL_TRACE( "IN MTypeConverter::nsStringToCCharStringAscii()\n" );
+
+ char cs[1024];
+ nss.ToCString(cs, 1024);
+
+ OSL_TRACE( "\tOUT MTypeConverter::nsStringToCCharStringAscii()\n" );
+ return(strdup(cs));
+}
+// -------------------------------------------------------------------------
+::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous)
+{
+ OSL_TRACE( "IN MTypeConverter::ouStringToStlString()\n" );
+
+ // Convert ::rtl::OUString to ::rtl::OString.
+ ::rtl::OString os(ous,ous.getLength(),RTL_TEXTENCODING_ASCII_US);
+
+ OSL_TRACE( "\tOUT MTypeConverter::ouStringToStlString()\n" );
+ return( ::std::string(os.getStr()));
+}
+// -------------------------------------------------------------------------
+::std::string MTypeConverter::nsStringToStlString(nsString const &nss)
+{
+ OSL_TRACE( "IN MTypeConverter::nsStringToStlString()\n" );
+
+ OSL_TRACE( "\tOUT MTypeConverter::nsStringToStlString()\n" );
+ return( ::std::string(nss.GetBuffer()));
+}
+// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
new file mode 100644
index 000000000000..d018443deed0
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * $RCSfile: MTypeConverter.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Willem van Dorp, Darren Kenny
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
+#define _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
+
+#ifndef _CONNECTIVITY_FILE_TYPECONVERTER_HXX_
+#include "file/FTable.hxx"
+#endif
+
+#include<string>
+
+namespace connectivity
+{
+ namespace mozab
+ {
+ class MTypeConverter
+ {
+ public:
+ static void ouStringToNsString(const ::rtl::OUString&, nsString&);
+ static void nsStringToOUString(const nsString&, ::rtl::OUString&);
+ static void prUnicharToOUString(const PRUnichar*, ::rtl::OUString&);
+ // Use free() for the following 3 calls.
+ static char *ouStringToCCharStringAscii(const ::rtl::OUString&);
+ static char *nsStringToCCharStringAscii(const nsString&);
+ static char *ouStringToCCharStringUtf8(const ::rtl::OUString&);
+ // Convert to stl-string.
+ static ::std::string ouStringToStlString(const ::rtl::OUString&);
+ static ::std::string nsStringToStlString(const nsString&);
+
+ private:
+ MTypeConverter() {};
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_MAB_TYPECONVERTER_HXX_
+
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
new file mode 100644
index 000000000000..5d9a6986d582
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
@@ -0,0 +1,155 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+CALL_CDECL=TRUE
+
+#mozilla specific stuff.
+MOZ_LIB=$(SOLARVERSION)$/$(INPATH)$/lib$(UPDMINOREXT)
+MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)/$/mozilla
+#End of mozilla specific stuff.
+
+PRJ=..$/..$/..$/..
+PRJINC=..$/..$/..
+PRJNAME=connectivity
+TARGET=mozab
+
+USE_LDUMP2=TRUE
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+LDUMP=ldump2.exe
+
+# --- Settings ----------------------------------
+.IF "$(DBGUTIL_OJ)"!=""
+ENVCFLAGS+=/FR$(SLO)$/
+.ENDIF
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/version.mk
+
+.IF "$(BUILD_SOSL)"!=""
+all:
+ echo " Not building the addressbook driver in OpenOffice.org build"
+ echo " dependency to Mozilla developer snapshots not feasable at the moment"
+.ENDIF
+
+#mozilla specific stuff.
+# --- Files -------------------------------------
+
+SLOFILES = \
+ $(SLO)$/MNSInit.obj \
+ $(SLO)$/MQueryHelper.obj \
+ $(SLO)$/MDatabaseMetaDataHelper.obj \
+ $(SLO)$/MQuery.obj \
+ $(SLO)$/MTypeConverter.obj \
+ $(SLO)$/MNameMapper.obj
+
+
+
+.IF "$(GUI)" == "WNT"
+.IF "$(DEBUG)" == ""
+INCPRE += . -I.. -I$(MOZ_INC) -I$(MOZ_INC)$/nspr
+CDEFS += -DWINVER=0x400 -DMOZILLA_CLIENT \
+ -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \
+ -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \
+ -DDMSVC4 -DNS_MT_SUPPORTED -DNETLIB_THREAD \
+ -DOJI -DWIN32 -D_X86_ -D_WINDOWS \
+ -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \
+ -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \
+ -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL
+CFLAGS += -GR- -W3 -Gy -MD -UDEBUG
+.ELSE
+INCPRE += . -I.. -I$(MOZ_INC) -I$(MOZ_INC)$/nspr
+CDEFS += -DDEBUG -DWINVER=0x400 -DMOZILLA_CLIENT \
+ -DNS_NET_FILE -DCookieManagement -DSingleSignon -DClientWallet \
+ -DTRACING -DXP_PC -DXP_WIN -DXP_WIN32 -DHW_THREADS \
+ -DDMSVC4 -DDEVELOPER_DEBUG -DNS_MT_SUPPORTED -DNETLIB_THREAD \
+ -DOJI -D_DEBUG -DWIN32 -D_X86_ -D_WINDOWS \
+ -DMOZ_XUL -DMOZ_REFLOW_PERF -DMOZ_REFLOW_PERF_DSP \
+ -DDEBUG_Administrator -DNSPR20 -DOS_HAS_DLL -DNO_JNI_STUBS \
+ -DNETSCAPE -DMOZILLA_CLIENT -DJS_THREADSAFE -DNECKO -DINCLUDE_XUL
+CFLAGS += -Zi -GR- -W3 -Gy -MDd -UNDEBUG
+.ENDIF
+.ENDIF
+.IF "$(GUI)" == "UNX"
+INCPRE += . -I.. -I$(MOZ_INC) -I$(MOZ_INC)$/nspr -DMOZILLA_CLIENT \
+ -DOSTYPE=\"Linux2.2.14-5\" -DOJI
+.IF "$(OS)" == "LINUX"
+# INCPRE += -I.. -I$(MOZ_INC) -DDEBUG -DMOZILLA_CLIENT
+INCPRE += -fPIC \
+ -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith \
+ -Wbad-function-cast -Wcast-align -Woverloaded-virtual -Wsynth \
+ -Wno-long-long -pthread -DTRACING -g
+.ENDIF
+.ENDIF
+
+SHL1TARGET_NAME=$(TARGET)$(MOZAB_MAJOR)
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+
+killdpc:
+ -+$(RM) $(DPCTARGET)
+ -+$(RM) $(DEPFILES)
+ @+echo Dependency files removed
+
diff --git a/connectivity/version.mk b/connectivity/version.mk
index 25fad5d77a0a..c9db9e9ccdf0 100644
--- a/connectivity/version.mk
+++ b/connectivity/version.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: version.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.7 $
#
-# last change: $Author: oj $ $Date: 2001-05-14 11:55:19 $
+# last change: $Author: mmaher $ $Date: 2001-10-11 10:05:47 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -206,3 +206,21 @@ DBASE=$(DBASE_TARGET_TARGET)_$(CMPEXT)
+# ----------------------------MOZAB settings-----------------------------------#
+# target
+MOZAB_TARGET=mozab
+
+# the major
+MOZAB_MAJOR=2
+# the minor
+MOZAB_MINOR=0
+# the micro
+MOZAB_MICRO=0
+
+# this is a c++ compatible library
+MOZAB_CPP=1
+
+MOZAB=$(MOZAB_TARGET_TARGET)_$(CMPEXT)
+
+
+