summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-10-15 11:59:14 +0000
committerOcke Janssen <oj@openoffice.org>2001-10-15 11:59:14 +0000
commit40fd9214e1b577933ce7715d9b8f3799f127a903 (patch)
treea691789444fd3932beecade808cea046678c5016 /connectivity/source/drivers
parent3443bcfbe69a5d52871f01bd9372ab2ac78e783b (diff)
#92124# split driver
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx124
-rw-r--r--connectivity/source/drivers/mozab/MConnection.hxx17
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.cxx26
-rw-r--r--connectivity/source/drivers/mozab/MDatabaseMetaData.hxx5
-rw-r--r--connectivity/source/drivers/mozab/MDriver.cxx131
-rw-r--r--connectivity/source/drivers/mozab/MDriver.hxx21
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.cxx7
-rw-r--r--connectivity/source/drivers/mozab/MPreparedStatement.hxx10
-rw-r--r--connectivity/source/drivers/mozab/MTables.cxx7
-rw-r--r--connectivity/source/drivers/mozab/makefile.mk75
-rw-r--r--connectivity/source/drivers/mozab/mozab.map6
-rw-r--r--connectivity/source/drivers/mozab/mozab.xml2
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx6
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx51
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx5
-rw-r--r--connectivity/source/drivers/mozab/mozillasrc/makefile.mk6
16 files changed, 281 insertions, 218 deletions
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
index ad943e3d453f..23c78e40ba4d 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MConnection.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,6 +98,11 @@
# define OUtoCStr( x ) ("dummy")
#endif /* DEBUG */
+extern "C" void* SAL_CALL OMozabConnection_CreateInstance(void* _pDriver)
+{
+ return (new connectivity::mozab::OConnection( reinterpret_cast<connectivity::mozab::MozabDriver*>(_pDriver) ));
+}
+
using namespace connectivity::mozab;
// using namespace connectivity;
@@ -111,28 +116,28 @@ 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_Bool USES_FACTORY_OUTLOOK_MAPI = sal_True ;
static sal_Char* MOZ_SCHEME_OUTLOOK_EXPRESS = "moz-aboutlookdirectory://oe/";
static sal_Bool USES_FACTORY_OUTLOOK_EXPRESS= sal_True ;
}
}
+// -----------------------------------------------------------------------------
OConnection::OConnection(MozabDriver* _pDriver)
@@ -170,11 +175,9 @@ void SAL_CALL OConnection::release() throw(RuntimeException)
//-----------------------------------------------------------------------------
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
-
+ m_sURL = url;
//
// Skip 'sdbc:mozab: part of URL
//
@@ -219,11 +222,11 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
// "sdbc:address:outlookexp:" -> aboutlookdirectory://oe/
//
m_IsLDAP = sal_False ;
- if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_MOZILLA ) == 0 ) {
+ if ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_MOZILLA() ) == 0 ) {
m_sMozillaURI = rtl::OUString::createFromAscii( MOZ_SCHEME_MOZILLA );
m_UsesFactory = USES_FACTORY_MOZILLA ;
}
- else if ( aAddrbookScheme.compareToAscii( SDBC_SCHEME_LDAP ) == 0 ) {
+ else if ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_LDAP() ) == 0 ) {
rtl::OUString sHostName;
rtl::OUString sBaseDN;
sal_Int32 nPortNumber = -1;
@@ -277,15 +280,15 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
::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))");
+ // 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 ) {
+ else if ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_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 ) {
+ else if ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_OUTLOOK_EXPRESS() ) == 0 ) {
m_sMozillaURI = rtl::OUString::createFromAscii( MOZ_SCHEME_OUTLOOK_EXPRESS );
m_UsesFactory = USES_FACTORY_OUTLOOK_EXPRESS ;
m_bOutlookExpress = sal_True;
@@ -307,7 +310,6 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
_aDbHelper.getTableStrings( this, sal_True ); // Will throw an exception on failure
- osl_decrementInterlockedCount( &m_refCount );
}
// XServiceInfo
// --------------------------------------------------------------------------------
@@ -333,21 +335,15 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
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);
+ Reference< XPreparedStatement > xReturn = new OPreparedStatement(this,_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;
@@ -364,15 +360,11 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::
// --------------------------------------------------------------------------------
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
@@ -381,18 +373,11 @@ sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeExce
// --------------------------------------------------------------------------------
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
}
// --------------------------------------------------------------------------------
@@ -423,65 +408,41 @@ Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLEx
// --------------------------------------------------------------------------------
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;
}
// --------------------------------------------------------------------------------
@@ -513,51 +474,6 @@ void SAL_CALL OConnection::clearWarnings( ) throw(SQLException, RuntimeExceptio
{
// 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()
{
diff --git a/connectivity/source/drivers/mozab/MConnection.hxx b/connectivity/source/drivers/mozab/MConnection.hxx
index 0c1b600e65d3..69b00fbcd701 100644
--- a/connectivity/source/drivers/mozab/MConnection.hxx
+++ b/connectivity/source/drivers/mozab/MConnection.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MConnection.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,9 +120,6 @@ namespace connectivity
//====================================================================
// 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
@@ -131,7 +128,7 @@ namespace connectivity
::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by
// an operation
- ::rtl::OUString m_aURL; // URL of connection
+ ::rtl::OUString m_sURL; // contains the real url set by construct
::rtl::OUString m_sUser; // the user name
MozabDriver* m_pDriver; // Pointer to the owning
// driver object
@@ -152,8 +149,6 @@ namespace connectivity
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);
@@ -204,10 +199,10 @@ namespace connectivity
// 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 getConnectionURL() const { return m_sURL; }
+
+ // Additions from the land of mozilla
rtl::OUString getMozURI() const
{ return m_sMozillaURI; }
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
index 30a0c3213465..46a3617ed9a6 100644
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MDatabaseMetaData.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,17 +118,9 @@ namespace connectivity
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()
@@ -148,10 +140,10 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
aRows.clear();
- const ::std::vector< ::rtl::OUString > colNames = m_pConnection->getColumnAlias().getAlias();
+ 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 );
+ ::std::vector< ::rtl::OUString >& tables = m_pDbMetaDataHelper->getTableStrings( m_pConnection );
// ****************************************************
// Some entries in a row never change, so set them now
@@ -215,10 +207,6 @@ ODatabaseMetaDataResultSet::ORows& SAL_CALL ODatabaseMetaData::getColumnRows(
::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogSeparator( ) throw(SQLException, RuntimeException)
{
::rtl::OUString aVal;
- if(m_bUseCatalog)
- { // do some special here for you database
- }
-
return aVal;
}
// -------------------------------------------------------------------------
@@ -354,9 +342,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLExc
::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException)
{
::rtl::OUString aVal;
- if(m_bUseCatalog)
- {
- }
return aVal;
}
// -------------------------------------------------------------------------
@@ -381,9 +366,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( )
sal_Bool SAL_CALL ODatabaseMetaData::isCatalogAtStart( ) throw(SQLException, RuntimeException)
{
sal_Bool bValue = sal_False;
- if(m_bUseCatalog)
- {
- }
return bValue;
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
index 2e455962be52..f0097e97dcb7 100644
--- a/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
+++ b/connectivity/source/drivers/mozab/MDatabaseMetaData.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MDatabaseMetaData.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,7 +78,6 @@ namespace connectivity
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 );
diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx
index 9e446e997e2e..f89232d2f5c6 100644
--- a/connectivity/source/drivers/mozab/MDriver.cxx
+++ b/connectivity/source/drivers/mozab/MDriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MDriver.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,8 +58,15 @@
*
*
************************************************************************/
+#ifndef CONNECTIVITY_SDRIVER_HXX
#include "MDriver.hxx"
+#endif
+#ifndef CONNECTIVITY_SCONNECTION_HXX
#include "MConnection.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -82,6 +89,13 @@ namespace connectivity
MozabDriver::MozabDriver(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory)
: ODriver_BASE(m_aMutex), m_xMSFactory( _rxFactory )
+ ,s_hModule(NULL)
+ ,s_pCreationFunc(NULL)
+{
+ registerClient();
+}
+// -----------------------------------------------------------------------------
+MozabDriver::~MozabDriver()
{
}
// --------------------------------------------------------------------------------
@@ -97,8 +111,15 @@ void MozabDriver::disposing()
xComp->dispose();
}
m_xConnections.clear();
+ connectivity::OWeakRefArray().swap(m_xConnections); // this really clears
ODriver_BASE::disposing();
+ if(s_hModule)
+ {
+ s_pCreationFunc = NULL;
+ osl_unloadModule(s_hModule);
+ s_hModule = NULL;
+ }
}
// static ServiceInfo
@@ -147,10 +168,20 @@ Sequence< ::rtl::OUString > SAL_CALL MozabDriver::getSupportedServiceNames( ) t
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));
+ Reference< XConnection > xCon;
+ if (s_pCreationFunc)
+ {
+ OConnection* pCon = reinterpret_cast<OConnection*>((*s_pCreationFunc)(this));
+ 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));
+ }
+ else
+ {
+ ::rtl::OUString sMsg = ::rtl::OUString::createFromAscii("Could not load the library ");
+ sMsg += ::rtl::OUString::createFromAscii(SAL_MODULENAME( "mozabdrv2" ));
+ ::dbtools::throwGenericSQLException(sMsg,*this);
+ }
return xCon;
}
@@ -159,7 +190,7 @@ 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));
+ return acceptsURL_Stat(url);
}
// --------------------------------------------------------------------------------
Sequence< DriverPropertyInfo > SAL_CALL MozabDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
@@ -178,6 +209,92 @@ sal_Int32 SAL_CALL MozabDriver::getMinorVersion( ) throw(RuntimeException)
return 0; // depends on you
}
// --------------------------------------------------------------------------------
+sal_Bool MozabDriver::acceptsURL_Stat( const ::rtl::OUString& url )
+{
+ // 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 if(url == ::rtl::OUString::createFromAscii("sdbc:address:") )
+ return sal_True; // special case here
+ else
+ return sal_False;
+ }
+ else
+ aAddrbookScheme = aAddrbookURI.copy(0, nLen);
+
+
+
+ return ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_MOZILLA() ) == 0 ) ||
+ ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_LDAP() ) == 0 )
+#if defined(WNT) || defined(WIN)
+ ||
+ ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_OUTLOOK_MAPI() ) == 0 ) ||
+ ( aAddrbookScheme.compareToAscii( MozabDriver::getSDBC_SCHEME_OUTLOOK_EXPRESS() ) == 0 )
+#endif
+ ;
+}
+// -----------------------------------------------------------------------------
+const sal_Char* MozabDriver::getSDBC_SCHEME_MOZILLA()
+{
+ static sal_Char* SDBC_SCHEME_MOZILLA = "mozilla";
+ return SDBC_SCHEME_MOZILLA;
+}
+// -----------------------------------------------------------------------------
+const sal_Char* MozabDriver::getSDBC_SCHEME_LDAP()
+{
+ static sal_Char* SDBC_SCHEME_LDAP = "ldap";
+ return SDBC_SCHEME_LDAP;
+}
+// -----------------------------------------------------------------------------
+const sal_Char* MozabDriver::getSDBC_SCHEME_OUTLOOK_MAPI()
+{
+ static sal_Char* SDBC_SCHEME_OUTLOOK_MAPI = "outlook";
+ return SDBC_SCHEME_OUTLOOK_MAPI;
+}
+// -----------------------------------------------------------------------------
+const sal_Char* MozabDriver::getSDBC_SCHEME_OUTLOOK_EXPRESS()
+{
+ static sal_Char* SDBC_SCHEME_OUTLOOK_EXPRESS = "outlookexp";
+ return SDBC_SCHEME_OUTLOOK_EXPRESS;
+}
+// -----------------------------------------------------------------------------
+void MozabDriver::registerClient()
+{
+ if (!s_hModule)
+ {
+ OSL_ENSURE(NULL == s_pCreationFunc, "MozabDriver::registerClient: inconsistence: already have a factory function!");
+
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SAL_MODULENAME( "mozabdrv2" ));
+
+ // load the dbtools library
+ s_hModule = osl_loadModule(sModuleName.pData, 0);
+ OSL_ENSURE(NULL != s_hModule, "MozabDriver::registerClient: could not load the dbtools library!");
+ if (NULL != s_hModule)
+ {
+ // get the symbol for the method creating the factory
+ const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString::createFromAscii("OMozabConnection_CreateInstance");
+ s_pCreationFunc = reinterpret_cast<OMozabConnection_CreateInstanceFunction>(osl_getSymbol(s_hModule, sFactoryCreationFunc.pData));
+
+ if (NULL == s_pCreationFunc)
+ { // did not find the symbol
+ OSL_ENSURE(sal_False, "MozabDriver::registerClient: could not find the symbol for creating the factory!");
+ osl_unloadModule(s_hModule);
+ s_hModule = NULL;
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/mozab/MDriver.hxx b/connectivity/source/drivers/mozab/MDriver.hxx
index 0dedf08b6715..f121a57adb4a 100644
--- a/connectivity/source/drivers/mozab/MDriver.hxx
+++ b/connectivity/source/drivers/mozab/MDriver.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MDriver.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,14 +73,21 @@
#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include "connectivity/CommonTools.hxx"
#endif
+#ifndef _OSL_MODULE_H_
+#include <osl/module.h>
+#endif
+extern "C" void* SAL_CALL OMozabConnection_CreateInstance(void* _pDriver);
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 void* (SAL_CALL * OMozabConnection_CreateInstanceFunction)(void* _pDriver );
+
+
typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver,
::com::sun::star::lang::XServiceInfo > ODriver_BASE;
@@ -93,6 +100,10 @@ namespace connectivity
connectivity::OWeakRefArray m_xConnections; // vector containing a list
// of all the Connection objects
// for this Driver
+ oslModule s_hModule;
+ OMozabConnection_CreateInstanceFunction s_pCreationFunc;
+ void registerClient();
+ virtual ~MozabDriver();
public:
MozabDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
@@ -118,6 +129,12 @@ namespace connectivity
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
& getMSFactory(void) const { return m_xMSFactory; }
+ static sal_Bool acceptsURL_Stat( const ::rtl::OUString& url );
+ // static methods to return the names of the uri
+ static const sal_Char* getSDBC_SCHEME_MOZILLA();
+ static const sal_Char* getSDBC_SCHEME_LDAP();
+ static const sal_Char* getSDBC_SCHEME_OUTLOOK_MAPI();
+ static const sal_Char* getSDBC_SCHEME_OUTLOOK_EXPRESS();
};
}
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
index 4024ad89ca21..1cfe87b1408b 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MPreparedStatement.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,9 +112,8 @@ 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)
+OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
:OStatement_BASE2(_pConnection)
- ,m_aTypeInfo(_TypeInfo)
,m_bPrepared(sal_False)
,m_sSqlStatement(sql)
,m_nNumParams(0)
diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.hxx b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
index bd911c0ce208..6d6b36f26a91 100644
--- a/connectivity/source/drivers/mozab/MPreparedStatement.hxx
+++ b/connectivity/source/drivers/mozab/MPreparedStatement.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MPreparedStatement.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,10 +111,6 @@ namespace connectivity
//====================================================================
// 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
@@ -156,7 +152,7 @@ namespace connectivity
public:
DECLARE_SERVICE_INFO();
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql);
+ OPreparedStatement( OConnection* _pConnection,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);
diff --git a/connectivity/source/drivers/mozab/MTables.cxx b/connectivity/source/drivers/mozab/MTables.cxx
index 401843557264..c5d2bbdcbef1 100644
--- a/connectivity/source/drivers/mozab/MTables.cxx
+++ b/connectivity/source/drivers/mozab/MTables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MTables.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-10-12 11:48:41 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,6 +128,7 @@ Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
aTypes[0] = ::rtl::OUString::createFromAscii("%");
// aTypes[0] = ::rtl::OUString::createFromAscii("TABLE");
// aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE");
+ ::rtl::OUString sEmpty;
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
@@ -138,7 +139,7 @@ Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
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);
+ aName,xRow->getString(4),xRow->getString(5),sEmpty);
xRet = pRet;
}
}
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
index e7851fa214f7..453e90a9c80f 100644
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: mmaher $ $Date: 2001-10-11 10:07:54 $
+# last change: $Author: oj $ $Date: 2001-10-15 12:57:28 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -64,6 +64,7 @@ PRJ=..$/..$/..
PRJINC=..$/..
PRJNAME=connectivity
TARGET=mozab
+TARGET2=mozabdrv
.IF "$(BUILD_SOSL)"!=""
all:
@@ -103,6 +104,40 @@ ENVCFLAGS+=/FR$(SLO)$/
RC_SUBDIRS = mozillasrc
# --- Files -------------------------------------
+SLOFILES=\
+ $(SLO)$/MDriver.obj \
+ $(SLO)$/MServices.obj
+
+
+
+# --- MOZAB BASE Library -----------------------------------
+
+SHL1VERSIONMAP= $(TARGET).map
+SHL1TARGET= $(MOZAB_TARGET)$(MOZAB_MAJOR)
+SHL1OBJS=$(SLOFILES)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(OSLLIB) \
+ $(SALLIB) \
+ $(DBTOOLSLIB) \
+ $(COMPHELPERLIB)
+
+
+SHL1DEPN=
+SHL1IMPLIB= i$(MOZAB_TARGET)$(MOZAB_MAJOR)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
+ $(SLB)$/$(TARGET).lib
+DEFLIB1NAME=$(TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+# --- Files -------------------------------------
MOZSLOFILES=\
$(SLO)$/MNSInit.obj \
$(SLO)$/MQueryHelper.obj \
@@ -111,7 +146,7 @@ MOZSLOFILES=\
$(SLO)$/MTypeConverter.obj \
$(SLO)$/MNameMapper.obj
-SLOFILES=\
+SLO2FILES=\
$(SLO)$/MCatalog.obj \
$(SLO)$/MColumns.obj \
$(SLO)$/MTable.obj \
@@ -122,19 +157,15 @@ SLOFILES=\
$(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=\
+SHL2VERSIONMAP= $(TARGET2).map
+SHL2TARGET= $(TARGET2)$(MOZAB_MAJOR)
+SHL2OBJS=$(SLO2FILES)
+SHL2STDLIBS=\
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(VOSLIB) \
@@ -144,16 +175,13 @@ SHL1STDLIBS=\
$(COMPHELPERLIB) \
$(MOZ_LIB_XPCOM)
-SHL1DEPN=
-SHL1IMPLIB= i$(MOZAB_TARGET)
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL2STDLIBS+= i$(MOZAB_TARGET)$(MOZAB_MAJOR).lib
-DEF1NAME= $(SHL1TARGET)
-DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
- $(SLB)$/$(TARGET).lib
-DEFLIB1NAME=$(TARGET)
+SHL2DEPN=
+SHL2IMPLIB= i$(TARGET2)
+SHL2DEF= $(MISC)$/$(SHL2TARGET).def
+DEF2NAME= $(SHL2TARGET)
# --- Targets ----------------------------------
@@ -170,6 +198,15 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk
@echo _real >>$@
.ENDIF
+.IF "$(depend)"==""
+
+$(MISC)$/$(SHL2TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo CLEAR_THE_FILE > $@
+ @echo _TI >>$@
+ @echo _real >>$@
+.ENDIF
+
killdpc:
-+$(RM) $(DPCTARGET)
-+$(RM) $(DEPFILES)
diff --git a/connectivity/source/drivers/mozab/mozab.map b/connectivity/source/drivers/mozab/mozab.map
index 9f3a1f27d0f5..9cd5f63be343 100644
--- a/connectivity/source/drivers/mozab/mozab.map
+++ b/connectivity/source/drivers/mozab/mozab.map
@@ -1,8 +1,8 @@
MOZAB_1_0 {
global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
+ component_getImplementationEnvironment
+ component_writeInfo
+ component_getFactory
local:
*;
};
diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml
index 8b45122d71a3..3220dd6d5333 100644
--- a/connectivity/source/drivers/mozab/mozab.xml
+++ b/connectivity/source/drivers/mozab/mozab.xml
@@ -1,7 +1,7 @@
<?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>
+ <module-name> mozab </module-name>
<component-description>
<Author>Your name</Author>
<Name>com.sun.star.comp.sdbc.MozabDriver</Name>
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
index 6bfe2ccf1961..36c4dede03bf 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MDatabaseMetaDataHelper.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:59:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -424,7 +424,7 @@ ODatabaseMetaDataResultSet::ORows& MDatabaseMetaDataHelper::getTables(
// will not be detected (for now).
::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
- ::std::vector< ::rtl::OUString > tables = getTableStrings( _pCon );
+ ::std::vector< ::rtl::OUString >& tables = getTableStrings( _pCon );
for ( sal_Int32 i = 0; i < tables.size(); i++ ) {
ODatabaseMetaDataResultSet::ORow aRow(3);
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
index f777696c5e1a..e0f84fbba751 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MQuery.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:59:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,16 +110,7 @@ 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);
+ construct();
OSL_TRACE( "\tOUT MQuery::MQuery()\n" );
}
@@ -128,7 +119,7 @@ MQuery::MQuery(const ::std::map< ::rtl::OUString, ::rtl::OUString> & ca)
{
OSL_TRACE( "IN MQuery::MQuery( ca )\n" );
- MQuery::MQuery();
+ construct();
m_aColumnAliasMap = ca;
@@ -153,6 +144,20 @@ MQuery::~MQuery()
OSL_TRACE("\tOUT MQuery::~MQuery()\n");
}
+// -----------------------------------------------------------------------------
+void MQuery::construct()
+{
+ // 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);
+}
// -------------------------------------------------------------------------
void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
{
@@ -160,10 +165,12 @@ void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
::osl::MutexGuard aGuard( m_aMutex );
m_aAttributes.clear();
+ m_aAttributes.reserve(attrs.size());
::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
- ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
- for(aIterAttr; aIterAttr != attrs.end();++aIterAttr) {
- aIterMap = m_aColumnAliasMap.find(*aIterAttr);
+ ::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);
@@ -173,8 +180,6 @@ void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
}
OSL_TRACE("\tOUT MQuery::setAttributes()\n");
-
- return;
}
// -------------------------------------------------------------------------
const ::std::vector< ::rtl::OUString> &MQuery::getAttributes() const
@@ -216,7 +221,9 @@ void MQuery::setMatchItems(::std::vector< ::rtl::OUString> &mi)
::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
m_aMatchItems.clear();
- for(aIter; aIter != mi.end();++aIter) {
+ m_aMatchItems.reserve(mi.size());
+ for(aIter; aIter != mi.end();++aIter)
+ {
aIterMap = m_aColumnAliasMap.find(*aIter);
if (aIterMap == m_aColumnAliasMap.end()) {
// Not found.
@@ -244,12 +251,8 @@ 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);
- }
+ m_aMatchValues = mv;
OSL_TRACE("\tOUT MQuery::setMatchValues()\n");
return;
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
index 8bcbc18a4d9d..a9c749b9f23f 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
+++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: MQuery.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+ * last change: $Author: oj $ $Date: 2001-10-15 12:59:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -152,6 +152,7 @@ namespace connectivity
::std::vector<eSqlOppr> m_aSqlOppr;
::std::map< ::rtl::OUString,
::rtl::OUString> m_aColumnAliasMap;
+ void construct();
protected:
::osl::Mutex m_aMutex;
public:
diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
index 5d9a6986d582..40dcabb132f7 100644
--- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
+++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: mmaher $ $Date: 2001-10-11 10:07:55 $
+# last change: $Author: oj $ $Date: 2001-10-15 12:59:14 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -69,7 +69,7 @@ MOZ_INC=$(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)/$/mozilla
PRJ=..$/..$/..$/..
PRJINC=..$/..$/..
PRJNAME=connectivity
-TARGET=mozab
+TARGET=mozabsrc
USE_LDUMP2=TRUE
USE_DEFFILE=TRUE