Tag: cws_src680_dba205c
User: fs      
Date: 2006/10/09 05:09:32

Modified:
   dba/connectivity/source/drivers/mozab/MColumnAlias.cxx
   dba/connectivity/source/drivers/mozab/MColumnAlias.hxx
   dba/connectivity/source/drivers/mozab/MColumns.cxx
   dba/connectivity/source/drivers/mozab/MConnection.cxx
   dba/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx
   dba/connectivity/source/drivers/mozab/MResultSet.cxx
   dba/connectivity/source/drivers/mozab/MResultSetMetaData.cxx
   dba/connectivity/source/drivers/mozab/MStatement.cxx
   dba/connectivity/source/drivers/mozab/MTable.cxx
   dba/connectivity/source/drivers/mozab/MTable.hxx
   dba/connectivity/source/drivers/mozab/MTables.cxx
   dba/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx
   dba/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx
   dba/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx
   dba/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx
   dba/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx

Log:
 moving changes from dba205b herein, in preparation of #i69327#

File Changes:

Directory: /dba/connectivity/source/drivers/mozab/
==================================================

File [changed]: MColumnAlias.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MColumnAlias.cxx?r1=1.8&r2=1.8.10.1
Delta lines:  +53 -65
---------------------
--- MColumnAlias.cxx    17 Sep 2006 02:55:23 -0000      1.8
+++ MColumnAlias.cxx    9 Oct 2006 12:09:27 -0000       1.8.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MColumnAlias.cxx,v $
  *
- *  $Revision: 1.8 $
+ *  $Revision: 1.8.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:55:23 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:27 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -101,30 +101,16 @@
        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
 };
 
//------------------------------------------------------------------------------
-OColumnAlias::OColumnAlias()
+OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
 {
-       // Initialise m_aAlias with the default values from sProgrammaticNames.
-       initialise();
+    for ( size_t i = 0; i < END - BEGIN; ++i )
+        m_aAliasMap[ sProgrammaticNames[i] ] = AliasDescription( 
sProgrammaticNames[i], static_cast< ProgrammaticName>( i ) );
 
-       // Initialise m_aAlias map with the default values from 
sProgrammaticNames.
-       setAliasMap();
+    initialize( _rxORB );
 }
-//------------------------------------------------------------------
-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;
-}
 //------------------------------------------------------------------
-void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference<
-                                       
::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
+void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
 {
                // open our driver settings config node
 
@@ -169,26 +155,33 @@
                                          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;
+            #if OSL_DEBUG_LEVEL > 0
+                bool bFound = false;
+            #endif
+                for (   AliasMap::iterator search = m_aAliasMap.begin();
+                        ( search != m_aAliasMap.end() );
+                        ++search
+                    )
+                {
+                    if ( search->second.sProgrammaticName == 
*pProgrammaticNames )
+                    {
+                        AliasDescription aDescription( search->second );
+
+                        // delete this old entry for this programmatic name
+                        m_aAliasMap.erase( search );
+
+                        // insert the same AliasDescription under a new name - 
its alias
+                        m_aAliasMap[ sAssignedAlias ] = aDescription;
+
+                    #if OSL_DEBUG_LEVEL > 0
+                        bFound = true;
+                    #endif
 
-                               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;
                                        }
                                }
+
+                OSL_ENSURE( bFound, "OColumnAlias::setAlias: did not find a 
programmatic name which exists in the configuration!" );
                        }
                }
                catch( const Exception& )
@@ -196,31 +189,26 @@
                        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()
+OColumnAlias::ProgrammaticName OColumnAlias::getProgrammaticNameIndex( const 
::rtl::OUString& _rAliasName ) const
 {
-       // 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];
+    AliasMap::const_iterator pos = m_aAliasMap.find( _rAliasName );
+    if ( pos == m_aAliasMap.end() )
+    {
+        OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameIndex: unknown 
column alias!" );
+        return END;
        }
 
-       return;
+    return pos->second.eProgrammaticNameIndex;
 }
+
 //------------------------------------------------------------------
+::rtl::OUString OColumnAlias::getProgrammaticNameOrFallbackToAlias( const 
::rtl::OUString& _rAlias ) const
+{
+    AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
+    if ( pos == m_aAliasMap.end() )
+        return _rAlias;
+    return pos->second.sProgrammaticName;
+}

File [changed]: MColumnAlias.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MColumnAlias.hxx?r1=1.2&r2=1.2.182.1
Delta lines:  +88 -73
---------------------
--- MColumnAlias.hxx    8 Sep 2005 06:16:17 -0000       1.2
+++ MColumnAlias.hxx    9 Oct 2006 12:09:27 -0000       1.2.182.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MColumnAlias.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.182.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 06:16:17 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:27 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -49,8 +49,13 @@
 {
        namespace mozab
        {
+               class OColumnAlias
+               {
+        public:
                typedef enum {
-                       FIRSTNAME = 0,
+                BEGIN = 0,
+
+                           FIRSTNAME = BEGIN,
                        LASTNAME,
                        DISPLAYNAME,
                        NICKNAME,
@@ -87,40 +92,50 @@
                        CUSTOM3,
                        CUSTOM4,
                        NOTES,
+
                        END
                } ProgrammaticName;
 
-               class OColumnAlias
+            struct AliasDescription
                {
-                       /**
-                        * 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.
-                        *
-                        */
+                ::rtl::OUString     sProgrammaticName;
+                ProgrammaticName    eProgrammaticNameIndex;
+
+                AliasDescription()
+                    :eProgrammaticNameIndex( END )
+                {
+                }
+
+                AliasDescription( const ::rtl::OUString& _rName, 
ProgrammaticName _eIndex )
+                    :sProgrammaticName( _rName ), eProgrammaticNameIndex( 
_eIndex )
+                {
+                }
+            };
+
+            typedef ::std::map< ::rtl::OUString, AliasDescription > AliasMap;
+
                        private:                                        
-                               ::std::vector< ::rtl::OUString> m_aAlias;
-                               ::std::map< ::rtl::OUString, ::rtl::OUString> 
m_aAliasMap; 
+                       AliasMap    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 > &);
+                       OColumnAlias(
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > & );
+
+            ProgrammaticName getProgrammaticNameIndex( const ::rtl::OUString& 
_rAliasName ) const;
+            inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
+            {
+                return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
+            }
+            ::rtl::OUString getProgrammaticNameOrFallbackToAlias( const 
::rtl::OUString& _rAlias ) const;
+
+            inline AliasMap::const_iterator begin() const { return 
m_aAliasMap.begin(); }
+            inline AliasMap::const_iterator end() const { return 
m_aAliasMap.end(); }
+
                        private:
-                               void setAliasMap(void);
-                       public:
-                               OColumnAlias(void);
-                               ~OColumnAlias(void);
+            void initialize( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
                };
        }
 }

File [changed]: MColumns.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MColumns.cxx?r1=1.5&r2=1.5.10.1
Delta lines:  +4 -4
-------------------
--- MColumns.cxx        17 Sep 2006 02:55:37 -0000      1.5
+++ MColumns.cxx        9 Oct 2006 12:09:27 -0000       1.5.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MColumns.cxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.5.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:55:37 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:27 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.

File [changed]: MConnection.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MConnection.cxx?r1=1.23&r2=1.23.10.1
Delta lines:  +4 -6
-------------------
--- MConnection.cxx     17 Sep 2006 02:56:09 -0000      1.23
+++ MConnection.cxx     9 Oct 2006 12:09:27 -0000       1.23.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MConnection.cxx,v $
  *
- *  $Revision: 1.23 $
+ *  $Revision: 1.23.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:56:09 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:27 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -143,6 +143,7 @@
     ,m_xMetaData(NULL)
     ,m_pDriver(_pDriver)
     ,m_pImplData( new ConnectionImplData )
+    ,m_aColumnAlias( _pDriver->getMSFactory() )
     ,m_nMaxResultRecords( -1 )
     ,m_aNameMapper(NULL)
     ,m_eSDBCAddressType(SDBCAddress::Unknown)
@@ -162,9 +163,6 @@
     {
         OSL_ENSURE( false, "OConnection::OConnection: could not obtain the 
component context!" );
     }
-
-    // Initialise m_aColumnAlias.
-    m_aColumnAlias.setAlias(_pDriver->getMSFactory());
 }
 //-----------------------------------------------------------------------------
 OConnection::~OConnection()

File [changed]: MDatabaseMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MDatabaseMetaData.cxx?r1=1.13&r2=1.13.10.1
Delta lines:  +15 -9
--------------------
--- MDatabaseMetaData.cxx       17 Sep 2006 02:56:24 -0000      1.13
+++ MDatabaseMetaData.cxx       9 Oct 2006 12:09:27 -0000       1.13.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MDatabaseMetaData.cxx,v $
  *
- *  $Revision: 1.13 $
+ *  $Revision: 1.13.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:56:24 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:27 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -115,7 +115,6 @@
     ODatabaseMetaDataResultSet::ORow  aRow(19);
        aRows.clear();
 
-    const ::std::vector< ::rtl::OUString >& colNames = 
m_pConnection->getColumnAlias().getAlias();
     ::osl::MutexGuard aGuard( m_aMutex );
 
     ::std::vector< ::rtl::OUString > tables;
@@ -159,6 +158,8 @@
     // IS_NULLABLE
     aRow[18] = new ORowSetValueDecorator(::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("YES")));
 
+    const OColumnAlias& colNames = m_pConnection->getColumnAlias();
+
     // Iterate over all tables
     for(size_t j = 0; j < tables.size(); j++ ) {
         if(match(tableNamePattern, tables[j],'\0')) {
@@ -168,13 +169,18 @@
             OSL_TRACE( "\t\tTableName = %s;\n",OUtoCStr( tables[j] ));
 
             // Iterate over all collumns in the table.
-            for ( size_t i = 0; i < colNames.size(); i++ ) {
-                if(match(columnNamePattern, colNames[i],'\0')) {
-                    OSL_TRACE( "\t\t\tColumnName = %s;\n",OUtoCStr( 
colNames[i] ));
+            for (   OColumnAlias::AliasMap::const_iterator compare = 
colNames.begin();
+                    compare != colNames.end();
+                    ++compare
+                )
+            {
+                if ( match( columnNamePattern, compare->first, '\0' ) )
+                {
+                    OSL_TRACE( "\t\t\tColumnName = %s;\n", OUtoCStr( 
compare->first ) );
                     // COLUMN_NAME
-                    aRow[4] = new ORowSetValueDecorator( colNames[i] );
+                    aRow[4] = new ORowSetValueDecorator( compare->first );
                     // ORDINAL_POSITION
-                    aRow[17] = new ORowSetValueDecorator(sal_Int32(i+1));
+                    aRow[17] = new ORowSetValueDecorator( static_cast< 
sal_Int32 >( compare->second.eProgrammaticNameIndex ) + 1 );
                     aRows.push_back(aRow);
                 }
             }

File [changed]: MResultSet.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MResultSet.cxx?r1=1.28&r2=1.28.10.1
Delta lines:  +4 -4
-------------------
--- MResultSet.cxx      17 Sep 2006 02:57:09 -0000      1.28
+++ MResultSet.cxx      9 Oct 2006 12:09:28 -0000       1.28.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MResultSet.cxx,v $
  *
- *  $Revision: 1.28 $
+ *  $Revision: 1.28.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:57:09 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -153,7 +153,7 @@
     ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
     ,m_pSQLIterator( _pSQLIterator )
     ,m_pParseTree( _pSQLIterator->getParseTree() )
-    ,m_aQuery(pStmt->getOwnConnection()->getColumnAlias().getAliasMap())
+    ,m_aQuery( pStmt->getOwnConnection()->getColumnAlias() )
     ,m_pTable(NULL)
     ,m_CurrentRowCount(0)
     ,m_nParamIndex(0)

File [changed]: MResultSetMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MResultSetMetaData.cxx?r1=1.6&r2=1.6.10.1
Delta lines:  +40 -8
--------------------
--- MResultSetMetaData.cxx      17 Sep 2006 02:57:25 -0000      1.6
+++ MResultSetMetaData.cxx      9 Oct 2006 12:09:28 -0000       1.6.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MResultSetMetaData.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.6.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:57:25 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -50,6 +50,9 @@
 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
 #include <cppuhelper/typeprovider.hxx>
 #endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
 #ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
 #include "MResultSetMetaData.hxx"
 #endif
@@ -61,6 +64,7 @@
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::sdbc;
+using namespace com::sun::star::beans;
 using namespace ::dbtools;
 using namespace ::comphelper;
 
@@ -111,8 +115,17 @@
 {
        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 sColumnName;
+    try
+    {
+        Reference< XPropertySet > xColumnProps( (*m_xColumns)[column-1], 
UNO_QUERY_THROW );
+        OSL_VERIFY( xColumnProps->getPropertyValue( 
OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= 
sColumnName );
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+    return sColumnName;
 }
 // -------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 
/*column*/ ) throw(SQLException, RuntimeException)
@@ -179,9 +192,28 @@
 }
 // -------------------------------------------------------------------------
 
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 /*column*/ ) 
throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) 
throw(SQLException, RuntimeException)
 {
-    OSL_TRACE("In/Out : OResultSetMetaData::isSearchable() : True");
+    ::rtl::OUString sColumnName( getColumnName( column ) );
+
+    if ( !m_pTable || !m_pTable->getConnection() )
+    {
+        OSL_ENSURE( false, "OResultSetMetaData::isSearchable: suspicious: 
called without table or connection!" );
+        return sal_False;
+    }
+
+    if ( m_pTable->getConnection()->isLDAP() )
+    {
+        const OColumnAlias& aAliases( 
m_pTable->getConnection()->getColumnAlias() );
+        OColumnAlias::ProgrammaticName eProgrammatic( 
aAliases.getProgrammaticNameIndex( sColumnName ) );
+        if  (   ( eProgrammatic == OColumnAlias::HOMECOUNTRY )
+            ||  ( eProgrammatic == OColumnAlias::WORKCOUNTRY )
+            )
+            // for those, we know that they're not searchable in the 
Mozilla/LDAP implementation.
+            // There might be more ...
+            return sal_False;
+    }
+
        return sal_True;
 }
 // -------------------------------------------------------------------------

File [changed]: MStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MStatement.cxx?r1=1.15&r2=1.15.10.1
Delta lines:  +8 -10
--------------------
--- MStatement.cxx      17 Sep 2006 02:57:57 -0000      1.15
+++ MStatement.cxx      9 Oct 2006 12:09:28 -0000       1.15.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MStatement.cxx,v $
  *
- *  $Revision: 1.15 $
+ *  $Revision: 1.15.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:57:57 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -245,10 +245,7 @@
             xCreateColumn     = m_pSQLIterator->getCreateColumns();
             OSL_ENSURE(xCreateColumn.isValid(), "Need the Columns!!");
 
-            const OColumnAlias & xColumnAlias = 
m_pConnection->getColumnAlias();
-            //OSL_ENSURE( !xColumnAlias.empty(), "Need Column Alias");
-            const ::std::map< ::rtl::OUString, ::rtl::OUString> & xAliasMap = 
xColumnAlias.getAliasMap();
-            //OSL_ENSURE( !xAliasMap.empty(), "Need Column Alias Map");
+            const OColumnAlias& aColumnAlias = m_pConnection->getColumnAlias();
  
             OSQLColumns::const_iterator aIter = xCreateColumn->begin();
             const ::rtl::OUString sProprtyName = 
OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
@@ -256,10 +253,11 @@
             for (sal_Int32 i = 1; aIter != xCreateColumn->end();++aIter, i++)
             {
                 (*aIter)->getPropertyValue(sProprtyName) >>= sName;
-                if (xAliasMap.find(sName) == xAliasMap.end())
+                if ( !aColumnAlias.hasAlias( sName ) )
                 {
-                    ::dbtools::throwGenericSQLException(::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("Driver does not support column name:")) 
-                                                        + sName ,NULL);
+                    ::dbtools::throwGenericSQLException(
+                        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Driver 
does not support column name: " ) ) + sName,
+                        NULL );
                 }
             }
                    MDatabaseMetaDataHelper     _aDbHelper;

File [changed]: MTable.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MTable.cxx?r1=1.8&r2=1.8.10.1
Delta lines:  +26 -57
---------------------
--- MTable.cxx  17 Sep 2006 02:58:12 -0000      1.8
+++ MTable.cxx  9 Oct 2006 12:09:28 -0000       1.8.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MTable.cxx,v $
  *
- *  $Revision: 1.8 $
+ *  $Revision: 1.8.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:58:12 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -78,6 +78,12 @@
 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
 #include "connectivity/dbtools.hxx"
 #endif
+#ifndef CONNECTIVITY_TKEYS_HXX
+#include "connectivity/TKeys.hxx"
+#endif
+#ifndef CONNECTIVITY_INDEXESHELPER_HXX
+#include "connectivity/TIndexes.hxx"
+#endif
 #ifndef _CONNECTIVITY_MOZAB_CATALOG_HXX_
 #include "MCatalog.hxx"
 #endif
@@ -94,75 +100,38 @@
 using namespace ::com::sun::star::lang;
 
 OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection)
-    : OTable_TYPEDEF(_pTables, sal_True)
-       ,m_pConnection(_pConnection)
+    :OTable_Base( _pTables, _pConnection, 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)
+OTable::OTable( sdbcx::OCollection* _pTables, OConnection* _pConnection,
+                const ::rtl::OUString& _Name, const ::rtl::OUString& _Type, 
const ::rtl::OUString& _Description )
+    :OTable_Base(_pTables, _pConnection, sal_True, _Name, _Type, _Description )
+    ,m_pConnection( _pConnection )
 {
     construct();
 }
-// -------------------------------------------------------------------------
-void OTable::refreshColumns()
+
+//--------------------------------------------------------------------------
+sdbcx::OCollection* OTable::createColumns( const TStringVector& _rNames )
 {
-    TStringVector aVector;
-    if(!isNew())
-    {
-        Reference< XResultSet > xResult = 
m_pConnection->getMetaData()->getColumns(Any(),
-                                                        
m_SchemaName,m_Name,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%")));
-
-        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);
+    return new OColumns( this, m_aMutex, _rNames );
 }
+
 //--------------------------------------------------------------------------
-Sequence< sal_Int8 > OTable::getUnoTunnelImplementationId()
+sdbcx::OCollection* OTable::createKeys(const TStringVector& _rNames)
 {
-    static ::cppu::OImplementationId * pId = 0;
-    if (! pId)
-    {
-        ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-        if (! pId)
-        {
-            static ::cppu::OImplementationId aId;
-            pId = &aId;
-        }
-    }
-    return pId->getImplementationId();
+    return new OKeysHelper( this, m_aMutex, _rNames );
 }
 
-// com::sun::star::lang::XUnoTunnel
-//------------------------------------------------------------------
-sal_Int64 OTable::getSomething( const Sequence< sal_Int8 > & rId ) throw 
(RuntimeException)
+//--------------------------------------------------------------------------
+sdbcx::OCollection* OTable::createIndexes(const TStringVector& _rNames)
 {
-    return (rId.getLength() == 16 && 0 == 
rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  
rId.getConstArray(), 16 ) )
-                ? reinterpret_cast< sal_Int64 >( this )
-                : OTable_TYPEDEF::getSomething(rId);
+    return new OIndexesHelper( this, m_aMutex, _rNames );
 }
+
 // 
-----------------------------------------------------------------------------
 
 

File [changed]: MTable.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MTable.hxx?r1=1.4&r2=1.4.182.1
Delta lines:  +16 -20
---------------------
--- MTable.hxx  8 Sep 2005 06:21:36 -0000       1.4
+++ MTable.hxx  9 Oct 2006 12:09:28 -0000       1.4.182.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MTable.hxx,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.4.182.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 06:21:36 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -36,8 +36,8 @@
 #ifndef _CONNECTIVITY_MOZAB_TABLE_HXX_
 #define _CONNECTIVITY_MOZAB_TABLE_HXX_
 
-#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
-#include "connectivity/sdbcx/VTable.hxx"
+#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#include "connectivity/TTableHelper.hxx"
 #endif
 #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -50,13 +50,10 @@
 {
        namespace mozab
        {
-               typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+        typedef ::connectivity::OTableHelper OTable_Base;
 
-        ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >& xColProp);
-
-               class OTable :  public OTable_TYPEDEF
+               class OTable :  public OTable_Base
                {
-            ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
                        OConnection* m_pConnection;
 
                public:
@@ -65,22 +62,21 @@
                     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()
-                               );
+                                       const ::rtl::OUString& _Description );
 
                        OConnection* getConnection() { return m_pConnection;}
 
             sal_Bool isReadOnly() const { return sal_False; }
-                       virtual void refreshColumns();
 
                        ::rtl::OUString getTableName() const { return m_Name; }
                        ::rtl::OUString getSchema() const { return 
m_SchemaName; }
 
-                       // 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();
+            // OTableHelper overridables
+            virtual sdbcx::OCollection* createColumns( const TStringVector& 
_rNames );
+                   virtual sdbcx::OCollection* createKeys(const TStringVector& 
_rNames);
+                   virtual sdbcx::OCollection* createIndexes(const 
TStringVector& _rNames);
+               private:
+                       using OTable_Base::getConnection;
                };
        }
 }

File [changed]: MTables.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MTables.cxx?r1=1.7&r2=1.7.10.1
Delta lines:  +4 -4
-------------------
--- MTables.cxx 17 Sep 2006 02:58:27 -0000      1.7
+++ MTables.cxx 9 Oct 2006 12:09:28 -0000       1.7.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MTables.cxx,v $
  *
- *  $Revision: 1.7 $
+ *  $Revision: 1.7.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:58:27 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:28 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -116,7 +116,7 @@
                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),sEmpty);
+                                                                               
aName,xRow->getString(4),xRow->getString(5));
                        xRet = pRet;
                }
        }

Directory: /dba/connectivity/source/drivers/mozab/bootstrap/
============================================================

File [changed]: MNSFolders.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx?r1=1.7&r2=1.7.10.1
Delta lines:  +120 -43
----------------------
--- MNSFolders.cxx      17 Sep 2006 02:58:58 -0000      1.7
+++ MNSFolders.cxx      9 Oct 2006 12:09:29 -0000       1.7.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MNSFolders.cxx,v $
  *
- *  $Revision: 1.7 $
+ *  $Revision: 1.7.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 02:58:58 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -42,6 +42,7 @@
 #ifdef UNIX
 #include <sys/types.h>
 #include <strings.h>
+#include <string.h>
 #endif // End UNIX
 
 #ifdef WNT
@@ -53,56 +54,132 @@
 #include "post_include_windows.h"
 #endif // End WNT
 
-static const char * DefaultProductDir[] =
-{
-#if defined(XP_WIN)
-       "Mozilla\\",
-       "Mozilla\\Firefox\\",
-       "Thunderbird\\"
-#else
-       ".mozilla/",
-       ".mozilla/firefox/",
-       ".thunderbird/"
+#ifndef _OSL_SECURITY_HXX_
+#include <osl/security.hxx>
 #endif
-};
-#if defined(XP_MAC) || defined(XP_MACOSX)
-#define APP_REGISTRY_NAME "Application Registry"
-#elif defined(XP_WIN) || defined(XP_OS2)
-#define APP_REGISTRY_NAME "registry.dat"
-#else
-#define APP_REGISTRY_NAME "appreg"
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
 #endif
-
-::rtl::OString getAppDir()
-{
-#if defined(WNT)
-       char szPath[MAX_PATH];
-    if (!SHGetSpecialFolderPath(NULL, szPath, CSIDL_APPDATA, 0))
-            return ::rtl::OString();
-       return ::rtl::OString(szPath) + ::rtl::OString("\\");
-#elif defined(UNIX)
-    const char* homeDir = getenv("HOME");
-       return ::rtl::OString(homeDir) + ::rtl::OString("/");
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
 #endif
-}
 
-::rtl::OString getRegistryDir(::com::sun::star::mozilla::MozillaProductType 
product)
+using namespace ::com::sun::star::mozilla;
+
+namespace
 {
-       if (product == ::com::sun::star::mozilla::MozillaProductType_Default)
+    #if defined(XP_MAC) || defined(XP_MACOSX)
+        #define APP_REGISTRY_NAME "Application Registry"
+    #elif defined(XP_WIN) || defined(XP_OS2)
+        #define APP_REGISTRY_NAME "registry.dat"
+    #else
+        #define APP_REGISTRY_NAME "appreg"
+    #endif
+
+    // -------------------------------------------------------------------
+    static ::rtl::OUString lcl_getUserDataDirectory()
        {
-               return ::rtl::OString();
+        ::osl::Security   aSecurity;
+        ::rtl::OUString   aConfigPath;
+
+        aSecurity.getConfigDir( aConfigPath );
+        return aConfigPath + ::rtl::OUString::createFromAscii( "/" );
        }
-       sal_Int32 type = product - 1;
-       return getAppDir() + ::rtl::OString(DefaultProductDir[type]);
-}
 
-::rtl::OString 
getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product)
-{
-       if (product == ::com::sun::star::mozilla::MozillaProductType_Default)
+    // -------------------------------------------------------------------
+    static const char* DefaultProductDir[3][3] =
+    {
+    #if defined(XP_WIN)
+        { "Mozilla/", NULL, NULL },
+        { "Mozilla/Firefox/", NULL, NULL },
+        { "Thunderbird/", "Mozilla/Thunderbird/", NULL }
+    #else
+        { ".mozilla/", NULL, NULL },
+        { ".mozilla/firefox/", NULL, NULL },
+        { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" }
+    #endif
+    };
+
+    static const char* ProductRootEnvironmentVariable[3] =
+    {
+        "MOZILLA_PROFILE_ROOT",
+        "MOZILLA_FIREFOX_PROFILE_ROOT",
+        "MOZILLA_THUNDERBIRD_PROFILE_ROOT",
+    };
+
+    // -------------------------------------------------------------------
+    static ::rtl::OUString lcl_guessProfileRoot( MozillaProductType _product )
+    {
+        size_t productIndex = _product - 1;
+
+        static ::rtl::OUString s_productDirectories[3];
+
+        if ( !s_productDirectories[ productIndex ].getLength() )
+        {
+            ::rtl::OUString sProductPath;
+
+            // check whether we have an anevironment variable which helps us
+            const char* pProfileByEnv = getenv( 
ProductRootEnvironmentVariable[ productIndex ] );
+            if ( pProfileByEnv )
+            {
+                sProductPath = ::rtl::OUString( pProfileByEnv, strlen( 
pProfileByEnv ), osl_getThreadTextEncoding() );
+                // asume that this is fine, no further checks
+            }
+            else
+            {
+                ::rtl::OUString sProductDirCandidate;
+                const char* pProfileRegistry = ( _product == 
MozillaProductType_Mozilla ) ? APP_REGISTRY_NAME : "profiles.ini";
+
+                // check all possible candidates
+                for ( size_t i=0; i<3; ++i )
+                {
+                    if ( NULL == DefaultProductDir[ productIndex ][ i ] )
+                        break;
+
+                    sProductDirCandidate = lcl_getUserDataDirectory() +
+                        ::rtl::OUString::createFromAscii( DefaultProductDir[ 
productIndex ][ i ] );
+
+                    // check existence
+                    ::osl::DirectoryItem aRegistryItem;
+                    ::osl::FileBase::RC result = ::osl::DirectoryItem::get( 
sProductDirCandidate + ::rtl::OUString::createFromAscii( pProfileRegistry ), 
aRegistryItem );
+                    if ( result == ::osl::FileBase::E_None  )
+                    {
+                        ::osl::FileStatus aStatus( FileStatusMask_Validate );
+                        result = aRegistryItem.getFileStatus( aStatus );
+                        if ( result == ::osl::FileBase::E_None  )
        {
-               return ::rtl::OString();
+                            // the registry file exists
+                            break;
+                        }
+                    }
+                }
+
+                ::osl::FileBase::getSystemPathFromFileURL( 
sProductDirCandidate, sProductPath );
+            }
+
+            s_productDirectories[ productIndex ] = sProductPath;
        }
-       return getRegistryDir(product) + ::rtl::OString(APP_REGISTRY_NAME);
+
+        return s_productDirectories[ productIndex ];
+    }
+}
+
+// -----------------------------------------------------------------------
+::rtl::OUString getRegistryDir(MozillaProductType product)
+{
+       if (product == MozillaProductType_Default)
+               return ::rtl::OUString();
+
+    return lcl_guessProfileRoot( product );
+}
+
+// -----------------------------------------------------------------------
+::rtl::OUString getRegistryFileName(MozillaProductType product)
+{
+       if (product == MozillaProductType_Default)
+               return ::rtl::OUString();
+
+       return getRegistryDir(product) + 
::rtl::OUString::createFromAscii(APP_REGISTRY_NAME);
 }
 
 

File [changed]: MNSFolders.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx?r1=1.3&r2=1.3.182.1
Delta lines:  +5 -6
-------------------
--- MNSFolders.hxx      8 Sep 2005 06:23:18 -0000       1.3
+++ MNSFolders.hxx      9 Oct 2006 12:09:29 -0000       1.3.182.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MNSFolders.hxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.182.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 06:23:18 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -47,9 +47,8 @@
 
 #include <rtl/ustring.hxx>
 
-::rtl::OString getAppDir();
-::rtl::OString getRegistryDir(::com::sun::star::mozilla::MozillaProductType 
product);
-::rtl::OString 
getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product);
+::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType 
product);
+::rtl::OUString 
getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product);
 
 #endif
 

File [changed]: MNSProfileDiscover.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx?r1=1.4&r2=1.4.10.1
Delta lines:  +12 -11
---------------------
--- MNSProfileDiscover.cxx      17 Sep 2006 03:00:21 -0000      1.4
+++ MNSProfileDiscover.cxx      9 Oct 2006 12:09:29 -0000       1.4.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MNSProfileDiscover.cxx,v $
  *
- *  $Revision: 1.4 $
+ *  $Revision: 1.4.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 03:00:21 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -161,9 +161,9 @@
 
                        //step 1 : get mozilla registry file
                        nsCOMPtr<nsILocalFile>  localFile;
-                       ::rtl::OString regDir = 
getRegistryFileName(MozillaProductType_Mozilla);
-                       nsCAutoString registryDir(regDir.getStr());
-                       rv = NS_NewNativeLocalFile(registryDir, PR_TRUE,
+                       ::rtl::OUString regDir( getRegistryFileName( 
MozillaProductType_Mozilla ) );
+                       nsAutoString registryDir(regDir.getStr());
+                       rv = NS_NewLocalFile(registryDir, PR_TRUE,
                                 getter_AddRefs(localFile));
                        NS_ENSURE_SUCCESS(rv,rv);
                        PRBool bExist;
@@ -263,9 +263,10 @@
                        ProductStruct &m_Product = m_ProductProfileList[index];
 
                        nsresult rv;
-                       ::rtl::OString regDir = getRegistryDir(product);
-                       ::rtl::OUString regDirU = 
::rtl::OUString::createFromAscii(regDir) + 
::rtl::OUString::createFromAscii("profiles.ini");
-                       IniParser parser(regDirU);
+                       ::rtl::OUString regDir = getRegistryDir(product);
+            ::rtl::OUString profilesIni( regDir );
+            profilesIni += ::rtl::OUString::createFromAscii( "profiles.ini" );
+                       IniParser parser( profilesIni );
                        IniSectionMap &mAllSection = *(parser.getAllSection());
 
                        IniSectionMap::iterator iBegin = mAllSection.begin();
@@ -317,9 +318,9 @@
                                        nsCAutoString filePath(sPath.getStr());
        
                                        if (isRelative) {
-                                               nsCAutoString 
registryDir(regDir.getStr());
+                                               nsAutoString registryDir( 
regDir.getStr() );
                                                nsCOMPtr<nsILocalFile>     
mAppData;
-                                               rv = 
NS_NewNativeLocalFile(registryDir, PR_TRUE,
+                                               rv = 
NS_NewLocalFile(registryDir, PR_TRUE,
                                                                                
getter_AddRefs(mAppData));
                                                if (NS_FAILED(rv)) continue;
                                                rv = 
rootDir->SetRelativeDescriptor(mAppData, filePath);

Directory: /dba/connectivity/source/drivers/mozab/mozillasrc/
=============================================================

File [changed]: MQuery.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx?r1=1.18&r2=1.18.10.1
Delta lines:  +13 -36
---------------------
--- MQuery.cxx  17 Sep 2006 03:02:15 -0000      1.18
+++ MQuery.cxx  9 Oct 2006 12:09:29 -0000       1.18.10.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MQuery.cxx,v $
  *
- *  $Revision: 1.18 $
+ *  $Revision: 1.18.10.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/09/17 03:02:15 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -94,6 +94,7 @@
 }
 
 // -------------------------------------------------------------------------
+/*
 MQuery::MQuery()
 {
     OSL_TRACE( "IN MQuery::MQuery()\n" );
@@ -105,14 +106,15 @@
 
     OSL_TRACE( "\tOUT MQuery::MQuery()\n" );
 }
+*/
 // -------------------------------------------------------------------------
-MQuery::MQuery(const ::std::map< ::rtl::OUString, ::rtl::OUString>  & ca)
+MQuery::MQuery( const OColumnAlias& _ca )
+    :m_rColumnAlias( _ca )
 {
     OSL_TRACE( "IN MQuery::MQuery( ca )\n" );
 
     construct();
 
-    m_aColumnAliasMap = ca;
 #if OSL_DEBUG_LEVEL > 0
     m_oThreadID = osl_getThreadIdentifier(NULL);
 #endif
@@ -164,16 +166,8 @@
     ::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
     ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
 
-       for(aIterAttr = attrs.begin(); 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);
-        }
-    }
+       for ( aIterAttr = attrs.begin(); aIterAttr != attrs.end();++aIterAttr )
+        m_aAttributes.push_back( 
m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( *aIterAttr ) );
 
     OSL_TRACE("\tOUT MQuery::setAttributes()\n");
 }
@@ -278,13 +272,7 @@
             // Check if it's an alias first...
             rtl::OUString attrName;
             ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator 
aIterMap;
-            aIterMap = _aQuery->getColumnAliasMap().find(evStr->getName());
-            if (aIterMap == _aQuery->getColumnAliasMap().end()) {
-                // Not found.
-                attrName = evStr->getName();
-            } else {
-                attrName = aIterMap->second;
-            }
+            attrName = 
_aQuery->getColumnAlias().getProgrammaticNameOrFallbackToAlias( 
evStr->getName() );
             string aMiName = MTypeConverter::ouStringToStlString(attrName);
             boolString->SetName(strdup(aMiName.c_str()));
             OSL_TRACE("Name = %s ;", aMiName.c_str() );
@@ -751,13 +739,7 @@
     switch ( nType )
        {
         case DataType::VARCHAR:
-                       {
-                               ::std::map< ::rtl::OUString, 
::rtl::OUString>::const_iterator aIterMap = 
m_aColumnAliasMap.find(aDBColumnName);
-                               if (aIterMap != m_aColumnAliasMap.end())
-                                       xResEntry->setValue(aIterMap->second, 
rValue.getString());
-                               else
-                                       xResEntry->setValue( aDBColumnName, 
rValue.getString());
-                       }
+                       xResEntry->setValue( 
m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ), 
rValue.getString() );
             break;
         default:
                        OSL_ENSURE( sal_False, "invalid data type!" );
@@ -784,14 +766,9 @@
     switch ( nType )
        {
         case DataType::VARCHAR:
-                       {
-                               ::std::map< ::rtl::OUString, 
::rtl::OUString>::const_iterator aIterMap = 
m_aColumnAliasMap.find(aDBColumnName);
-                               if (aIterMap != m_aColumnAliasMap.end())
-                                       rValue = 
xResEntry->getValue(aIterMap->second);
-                               else
-                                       rValue = xResEntry->getValue( 
aDBColumnName );
-                       }
+                       rValue = xResEntry->getValue( 
m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ) );
             break;
+
         default:
             rValue.setNull();
             break;

File [changed]: MQuery.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx?r1=1.14&r2=1.14.114.1
Delta lines:  +65 -67
---------------------
--- MQuery.hxx  29 Mar 2006 12:19:19 -0000      1.14
+++ MQuery.hxx  9 Oct 2006 12:09:30 -0000       1.14.114.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MQuery.hxx,v $
  *
- *  $Revision: 1.14 $
+ *  $Revision: 1.14.114.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/03/29 12:19:19 $
+ *  last change: $Author: fs $ $Date: 2006/10/09 12:09:30 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -168,7 +168,7 @@
 
         };
 
-               //
+
         class MQuery : public ErrorResourceAccess
                {
                        /*
@@ -223,8 +223,7 @@
                        sal_Int32                       m_nMaxNrOfReturns;
                        sal_Bool                        m_bQuerySubDirs;
                        MQueryExpression                m_aExpr;
-                       ::std::map< ::rtl::OUString,
-                        ::rtl::OUString>    m_aColumnAliasMap;
+            const OColumnAlias&             m_rColumnAlias;
             mutable sal_Bool                m_aErrorOccurred;
                        ::com::sun::star::mozilla::MozillaProductType m_Product;
                        ::rtl::OUString                                         
                  m_Profile;
@@ -240,60 +239,59 @@
                         * - Contains accessors to the members of this class.
                         * - executeQuery() initiates a non-blocking query.
                         */
-                       sal_Int32                       
executeQuery(OConnection* _pCon);    // 
+                       sal_Int32                       
executeQuery(OConnection* _pCon);
                        sal_Int32                       
executeQueryProxied(OConnection* _pCon); //Used only by MNSMozabProxy
 
                        sal_Int32                                               
createNewCard(); //return Row count number  
-                       sal_Int32                                               
deleteRow(const sal_Int32 rowIndex); // 
-                       sal_Int32                                               
commitRow(const sal_Int32 rowIndex); // 
-                       sal_Bool                                                
resyncRow(sal_Int32     nDBRow);                 //
+                       sal_Int32                                               
deleteRow(const sal_Int32 rowIndex);
+                       sal_Int32                                               
commitRow(const sal_Int32 rowIndex);
+                       sal_Bool                                                
resyncRow(sal_Int32     nDBRow);
                        
-                       sal_Bool                                                
isWritable(OConnection* _pCon);                                          // 
+                       sal_Bool                                                
isWritable(OConnection* _pCon);
 
-                       sal_uInt32                                              
InsertLoginInfo(OConnection* _pCon); // 
+                       sal_uInt32                                              
InsertLoginInfo(OConnection* _pCon);
 
-                       void                            setAttributes( 
::std::vector< ::rtl::OUString>&);                       //
-                       const                                                   
::std::vector< ::rtl::OUString> &getAttributes(void) const; //
+                       void                            setAttributes( 
::std::vector< ::rtl::OUString>&);
+                       const                                                   
::std::vector< ::rtl::OUString> &getAttributes(void) const;
 
-                       void                            setAddressbook( 
::rtl::OUString&);  //
-                       ::rtl::OUString                 getAddressbook(void) 
const;                 //
+                       void                            setAddressbook( 
::rtl::OUString&);
+                       ::rtl::OUString                 getAddressbook(void) 
const;
 
-                       const ::std::map< ::rtl::OUString,::rtl::OUString>&   
-                                                                               
        getColumnAliasMap() const { return m_aColumnAliasMap; }
+                       const OColumnAlias&             getColumnAlias() const 
{ return m_rColumnAlias; }
 
                        void                            setExpression( 
MQueryExpression &_expr );
 
-                       void                            setMaxNrOfReturns( 
const sal_Int32); //
-                       sal_Int32                       getMaxNrOfReturns(void) 
const;           //
+                       void                            setMaxNrOfReturns( 
const sal_Int32);
+                       sal_Int32                       getMaxNrOfReturns(void) 
const;
 
-                       void                            setQuerySubDirs( 
sal_Bool&);         //
-                       sal_Bool                        getQuerySubDirs(void) 
const;             //
+                       void                            setQuerySubDirs( 
sal_Bool&);
+                       sal_Bool                        getQuerySubDirs(void) 
const;
 
-                       sal_Int32                       getRowCount( void );    
                         //
-            sal_uInt32                      getRealRowCount( void );           
         //
-            sal_Bool                        queryComplete( void );             
                 //
-            sal_Bool                        waitForQueryComplete( void );      
         //
-            sal_Bool                        checkRowAvailable( sal_Int32 
nDBRow );//
+                       sal_Int32                       getRowCount( void );
+            sal_uInt32                      getRealRowCount( void );
+            sal_Bool                        queryComplete( void );
+            sal_Bool                        waitForQueryComplete( void );
+            sal_Bool                        checkRowAvailable( sal_Int32 
nDBRow );
             sal_Bool                        getRowValue( 
connectivity::ORowSetValue& rValue, 
                                                                             
sal_Int32 nDBRow, 
                                                                                
                                 const rtl::OUString& aDBColumnName, 
-                                                         sal_Int32 nType ) 
const;//
+                                                         sal_Int32 nType ) 
const;
             sal_Bool                        setRowValue( 
connectivity::ORowSetValue& rValue, 
                                                                             
sal_Int32 nDBRow, 
                                                                                
                                 const rtl::OUString& aDBColumnName, 
-                                                         sal_Int32 nType ) 
const;//
-                       sal_Int32                                               
getRowStates(sal_Int32 nDBRow);          //
-                       sal_Bool                                                
setRowStates(sal_Int32 nDBRow,sal_Int32 aState); //
+                                                         sal_Int32 nType ) 
const;
+                       sal_Int32                                               
getRowStates(sal_Int32 nDBRow);
+                       sal_Bool                                                
setRowStates(sal_Int32 nDBRow,sal_Int32 aState);
                        
-            sal_Bool                        errorOccurred() const      //
+            sal_Bool                        errorOccurred() const
                                             { return m_aErrorOccurred; };
 
         public:
-                       MQuery();                                               
                                                                //
-                       MQuery(const ::std::map< ::rtl::OUString, 
::rtl::OUString> &);  //
-                       virtual ~MQuery();                                      
                                                        //
-                       static MNameMapper* CreateNameMapper(); // 
-                       static void FreeNameMapper( MNameMapper* _ptr ); // 
+//                     MQuery();
+                       MQuery( const OColumnAlias& _ca );
+                       virtual ~MQuery();
+                       static MNameMapper* CreateNameMapper();
+                       static void FreeNameMapper( MNameMapper* _ptr );
                };
        }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to