Tag: cws_src680_evo2fixes
User: mmeeks  
Date: 06/02/15 04:15:40

Added:
 /dba/connectivity/source/drivers/evoab2/
  NColumns.cxx, NColumns.hxx, NTable.cxx, NTable.hxx

Modified:
 /dba/connectivity/source/drivers/evoab2/
  EApi.cxx, EApi.h, NCatalog.cxx, NCatalog.hxx, NDatabaseMetaData.cxx,
  NDatabaseMetaData.hxx, NPreparedStatement.cxx, NResultSet.cxx,
  NResultSetMetaData.cxx, NResultSetMetaData.hxx, NStatement.cxx, NTables.cxx,
  makefile.mk

Log:
 Issue numbers: i#50913#, i#62042#, i#55893#, i#62043#
 Submitted by: misc, Tor, Jayant, me 
 Reviewed by:   mmeeks
 
 Fix a number of bugs, make it work with evo 2.4 & 2.6.
 
 

File Changes:

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

File [changed]: EApi.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/EApi.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +24 -23
---------------------
--- EApi.cxx    8 Sep 2005 05:48:53 -0000       1.3
+++ EApi.cxx    15 Feb 2006 12:15:24 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: EApi.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:48:53 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:24 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -36,17 +36,14 @@
 #include <rtl/ustring.hxx>
 #include <osl/module.h>
 #include <stdio.h>
-#define _EVOLUTION_ALREADY_DEFINED_ 1
+#define  DECLARE_FN_POINTERS 1
 #ifndef _CONNECTIVITY_EVOAB_EVOLUTION_API_HXX_
 #include "EApi.h"
 #endif
 static char *eBookLibNames[] = {
        "libebook.so.8",        // evolution-2.0
-       "libebook-1.2.so.3"     // evolution-2.2
-       // FIXME: ask JPR about ABI compatibility going forwards
-       // "libebook-1.3.so.0",
-       // "libebook-1.4.so.0",
-       // "libebook-1.5.so.0"
+       "libebook-1.2.so.3", // evolution-2.2
+       "libebook-1.2.so.5"      // evolution-2.4 and 2.6+
 };
 
 typedef void (*SymbolFunc) (void);
@@ -56,6 +53,8 @@
        const char *sym_name;
        SymbolFunc *ref_value;
     } aApiMap[] = {
+       SYM_MAP( e_contact_field_name ),
+       SYM_MAP( e_contact_get ),
        SYM_MAP( e_contact_get_type ),
        SYM_MAP( e_contact_field_id ),
        SYM_MAP( e_source_peek_name ),
@@ -74,6 +73,7 @@
        SYM_MAP( e_book_query_or ),
        SYM_MAP( e_book_query_not ),
        SYM_MAP( e_book_query_unref ),
+       SYM_MAP( e_book_query_from_string ),
        SYM_MAP( e_book_query_to_string ),
        SYM_MAP( e_book_query_field_exists ),
        SYM_MAP( e_source_group_peek_base_uri)
@@ -121,13 +121,14 @@
 
 #if 0
 
-  Test code - enable & 
+/*
+ * Test code - enable & 
  *
  * Compile with ( after source LinuxIntelEnv.Set.sh )
-   gcc $SOLARDEF -I $SOLARSRC/sal/inc -I $SOLARSRC/sal/unxlngi4.pro/inc \
+   gcc $SOLARDEF -I $SOLARVER/$UPD/$INPATH/inc \
      -I. `pkg-config --cflags --libs gobject-2.0` \
-     -L $SOLARSRC/sal/unxlngi4.pro/lib -luno_sal -lstdc++ EApi.cxx
- 
+     -L $SOLARVER/$UPD/$INPATH/lib -luno_sal -lstdc++ EApi.cxx
+ */ 
 
 int main( int argc, char **argv)
 {

File [changed]: EApi.h
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/EApi.h?r1=1.3&r2=1.3.74.1
Delta lines:  +67 -100
----------------------
--- EApi.h      8 Sep 2005 05:49:08 -0000       1.3
+++ EApi.h      15 Feb 2006 12:15:25 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: EApi.h,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:49:08 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:25 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -51,52 +51,41 @@
 // We attempt to define a minimum API that we use:
 
 // e-contact.h
+#ifdef DECLARE_FN_POINTERS
+#define EAPI_EXTERN
+#else
+#define EAPI_EXTERN extern
+#endif
+
+
 typedef void EContact;
 #define E_CONTACT(a) ((EContact *)(a))
 #define E_TYPE_CONTACT (e_contact_get_type())
 typedef int EContactField;
 
+EAPI_EXTERN const char      *(*e_contact_field_name)   ( EContactField 
field_id);
+EAPI_EXTERN gpointer           (*e_contact_get)   (EContact *contact, 
EContactField field_id);
+EAPI_EXTERN const gpointer  (*e_contact_get_const)   (EContact *contact, 
EContactField field_id);
 // e-source.h
 typedef void ESource;
 #define E_SOURCE(a) ((ESource *)(a))
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-const char  *(*e_source_peek_name)    (ESource *source);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-const gchar *(*e_source_get_property) (ESource *source,
+EAPI_EXTERN const char  *(*e_source_peek_name)    (ESource *source);
+EAPI_EXTERN const gchar *(*e_source_get_property) (ESource *source,
                                       const gchar *property);
 
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-GType         (*e_contact_get_type) (void);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EContactField (*e_contact_field_id) (const char *field_name);
+EAPI_EXTERN GType         (*e_contact_get_type) (void);
+EAPI_EXTERN EContactField (*e_contact_field_id) (const char *field_name);
 
 // e-source-list.h
 typedef void ESourceList;
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-GSList *(*e_source_list_peek_groups) (ESourceList *list);
+EAPI_EXTERN GSList *(*e_source_list_peek_groups) (ESourceList *list);
 
 // e-source-group.h
 typedef void ESourceGroup;
 #define E_SOURCE_GROUP(a) ((ESourceGroup *)(a))
 
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-GSList  *(*e_source_group_peek_sources) (ESourceGroup *group);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-const char *(*e_source_group_peek_base_uri)  (ESourceGroup *group);
+EAPI_EXTERN GSList  *(*e_source_group_peek_sources) (ESourceGroup *group);
+EAPI_EXTERN const char *(*e_source_group_peek_base_uri)  (ESourceGroup *group);
 // e-book.h
 typedef enum {
   E_BOOK_QUERY_IS,
@@ -108,76 +97,54 @@
 typedef void EBook;
 typedef void EBookQuery;
 
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBook      *(*e_book_new)                     (ESource      *source,
+EAPI_EXTERN EBook      *(*e_book_new)          (ESource      *source,
                                               GError      **error);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-gboolean    (*e_book_open)                    (EBook       *book,
+
+EAPI_EXTERN gboolean    (*e_book_open)         (EBook       *book,
                                               gboolean     only_if_exists,
                                               GError     **error);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-const char *(*e_book_get_uri)                 (EBook        *book);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-ESource    *(*e_book_get_source)              (EBook        *book);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-gboolean    (*e_book_get_addressbooks)        (ESourceList 
**addressbook_sources,
+
+EAPI_EXTERN const char *(*e_book_get_uri)      (EBook        *book);
+EAPI_EXTERN ESource    *(*e_book_get_source)(EBook        *book);
+
+EAPI_EXTERN gboolean    (*e_book_get_addressbooks)        (ESourceList 
**addressbook_sources,
                                               GError      **error);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-gboolean    (*e_book_get_contacts)            (EBook        *book,
+
+EAPI_EXTERN gboolean    (*e_book_get_contacts)            (EBook        *book,
                                               EBookQuery   *query,
                                               GList       **contacts,
                                               GError      **error);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-gboolean    (*e_book_authenticate_user)       (EBook        *book,
+
+EAPI_EXTERN gboolean    (*e_book_authenticate_user)       (EBook        *book,
                                               const char   *user,
                                               const char   *passwd,
                                               const char   *auth_method,
                                               GError      **error);
 
 // e-book-query.h
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBookQuery* (*e_book_query_field_exists) (EContactField   field);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBookQuery* (*e_book_query_field_test)   (EContactField   field,
+EAPI_EXTERN EBookQuery* (*e_book_query_field_exists) (EContactField   field);
+EAPI_EXTERN EBookQuery* (*e_book_query_field_test)   (EContactField   field,
                                          EBookQueryTest     test,
                                          const char        *value);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBookQuery* (*e_book_query_and)          (int nqs, EBookQuery **qs, gboolean 
unref);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBookQuery* (*e_book_query_or)           (int nqs, EBookQuery **qs, gboolean 
unref);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-EBookQuery* (*e_book_query_not)          (EBookQuery *q, gboolean unref);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-void        (*e_book_query_unref)        (EBookQuery *q);
-#ifndef _EVOLUTION_ALREADY_DEFINED_
-extern
-#endif
-char*       (*e_book_query_to_string)    (EBookQuery *q);
+EAPI_EXTERN EBookQuery* (*e_book_query_and)          (int nqs, EBookQuery 
**qs, gboolean unref);
+EAPI_EXTERN EBookQuery* (*e_book_query_or)           (int nqs, EBookQuery 
**qs, gboolean unref);
+EAPI_EXTERN EBookQuery* (*e_book_query_not)          (EBookQuery *q, gboolean 
unref);
+EAPI_EXTERN void        (*e_book_query_unref)        (EBookQuery *q);
+EAPI_EXTERN char*       (*e_book_query_to_string)    (EBookQuery *q);
+EAPI_EXTERN EBookQuery* (*e_book_query_from_string)   (const char 
*query_string);
+
+typedef struct {
+        char *address_format; /* the two letter country code that
+                                 determines the format/meaning of the
+                                 following fields */
+        char *po;
+        char *ext;
+        char *street;
+        char *locality;
+        char *region;
+        char *code;
+        char *country;
+} EContactAddress;
 G_END_DECLS
 #endif
+

File [changed]: NCatalog.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NCatalog.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +28 -4
--------------------
--- NCatalog.cxx        8 Sep 2005 05:49:21 -0000       1.3
+++ NCatalog.cxx        15 Feb 2006 12:15:26 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NCatalog.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:49:21 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:26 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -72,7 +72,7 @@
 {
        TStringVector aVector;
        Sequence< ::rtl::OUString > aTypes(1);
-       aTypes[0] = ::rtl::OUString::createFromAscii("%");
+       aTypes[0] = ::rtl::OUString::createFromAscii("TABLE");
        Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),
                
::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes);
 
@@ -92,3 +92,27 @@
        else
                m_pTables = new 
OEvoabTables(m_xMetaData,*this,m_aMutex,aVector);
 }
+// XTablesSupplier
+Reference< XNameAccess > SAL_CALL  OEvoabCatalog::getTables(  ) 
throw(RuntimeException)
+{
+        ::osl::MutexGuard aGuard(m_aMutex);
+
+        try
+        {
+                if (!m_pTables) {
+                        refreshTables();
+                        }
+        }
+        catch( const RuntimeException& )
+        {
+                // allowed to leave this method
+                throw;
+        }
+        catch( const Exception& )
+        {
+                // allowed
+        }
+
+        return m_pTables;
+}
+

File [changed]: NCatalog.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NCatalog.hxx?r1=1.3&r2=1.3.74.1
Delta lines:  +7 -4
-------------------
--- NCatalog.hxx        8 Sep 2005 05:49:37 -0000       1.3
+++ NCatalog.hxx        15 Feb 2006 12:15:26 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NCatalog.hxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:49:37 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:26 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -51,11 +51,14 @@
             ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
                public:
                        OEvoabCatalog(OEvoabConnection *_pCon);
-
+                       inline OEvoabConnection* getConnection() const { return 
m_pConnection; }
                        virtual void refreshTables();
                        virtual void refreshViews() {}
                        virtual void refreshGroups() {}
                        virtual void refreshUsers() {}
+ // XTablesSupplier
+                        virtual ::com::sun::star::uno::Reference< 
::com::sun::star::container::XNameAccess > SAL_CALL getTables(
+                                        ) 
throw(::com::sun::star::uno::RuntimeException);
                };
        }
 }

File [added]: NColumns.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NColumns.cxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [added]: NColumns.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NColumns.hxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [changed]: NDatabaseMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +177 -115
-----------------------
--- NDatabaseMetaData.cxx       8 Sep 2005 05:50:17 -0000       1.3
+++ NDatabaseMetaData.cxx       15 Feb 2006 12:15:29 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NDatabaseMetaData.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:50:17 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:29 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -89,30 +89,46 @@
                static sal_Int32    const s_nNULLABLE = 1;
                static sal_Int32 const s_nCHAR_OCTET_LENGTH = 65535;
 
-static GParamSpec **pFields = NULL;
-static guint        nFields = 0;
+               static ColumnProperty **pFields=NULL;
+               static guint        nFields = 0;
 
-static const char *pBlackList[] = {
+        static const char *pBlackList[] = 
+        {
                "id",
-               "list-show-addresses"
-};
+            "list-show-addresses",
+            "address-label-home",
+            "address-label-work",
+            "address-label-other"
+        };
+
+    static void 
+    splitColumn (ColumnProperty **pToBeFields)
+    {
+        for (int i = 0; i < OTHER_ZIP; i++) 
+        {
+            pToBeFields[nFields] = g_new0(ColumnProperty,1);
+            pToBeFields[nFields]->bIsSplittedValue = true;
+            pToBeFields[nFields]->pField = 
g_param_spec_ref(g_param_spec_string 
(evo_addr[i].pColumnName,evo_addr[i].pColumnName,"",NULL,G_PARAM_WRITABLE));
+            nFields++;
+        }
+    }
 
-static void
-initFields()
-{
+    static void
+    initFields()
+    {
        if( !pFields )
        {
                ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
                if( !pFields )
                {
                        guint        nProps;
+                ColumnProperty **pToBeFields;
                        GParamSpec **pProps;
-                       GParamSpec **pToBeFields;
+                nFields = 0;
                        pProps = g_object_class_list_properties
                                        ( (GObjectClass *) g_type_class_ref( 
E_TYPE_CONTACT ),
                                          &nProps );
-                       pToBeFields = g_new0( GParamSpec *, nProps );
-
+                pToBeFields = g_new0(ColumnProperty  *, (nProps + OTHER_ZIP)/* 
new column(s)*/ );
                        for ( guint i = 0; i < nProps; i++ )
                        {
                                switch (pProps[i]->value_type)
@@ -131,53 +147,77 @@
                                                }
                                        }
                                        if( bAdd )
-                                               pToBeFields[ nFields++ ] = 
g_param_spec_ref( pProps[i] );
+                            {
+                                pToBeFields[nFields]= g_new0(ColumnProperty,1);
+                                pToBeFields[nFields]->bIsSplittedValue=false;
+                                pToBeFields[ nFields++ ]->pField = 
g_param_spec_ref( pProps[i] );
+                            }
                                        break;
                                }
                                default:
                                        break;
                                }
                        }
+                       
+                splitColumn(pToBeFields);
                        pFields = pToBeFields;
                }
        }
-}
+    }
 
-guint
-getFieldCount()
-{
+
+    guint
+    getFieldCount()
+    {
        initFields();
        return nFields;
-}
+    }
 
-const GParamSpec *
-getField(guint n)
-{
+    const ColumnProperty *
+    getField(guint n)
+    {
        initFields();
        if( n < nFields )
                return pFields[n];
        else
                return NULL;
-}
+    }
 
-sal_Int32
-getFieldType( sal_Int32 nCol )
-{
+    sal_Int32
+    getFieldType( sal_Int32 nCol )
+    {
        sal_Int32 nType = DataType::VARCHAR;
        initFields();
        if (nCol >= 0 && nCol < nFields )
        {
-               if( pFields[nCol]->value_type == G_TYPE_STRING )
+            if( ((GParamSpec *)pFields[nCol]->pField)->value_type == 
G_TYPE_STRING )
                        nType = DataType::VARCHAR;
                else 
                        nType = DataType::BIT;
        }
        return nType;
-}
+    }
 
-rtl::OUString
-getFieldTypeName( sal_Int32 nCol )
-{
+    sal_Int32 findEvoabField(const rtl::OUString& aColName)
+    {
+        sal_Int32 nRet = -1;   
+        sal_Bool bFound = sal_False;
+        initFields();
+        for (int i=0;(i < nFields) && !bFound;i++)
+        {
+            rtl::OUString aName = getFieldName(i);
+            if (aName == aColName)
+            {
+                nRet = i;
+                bFound = sal_True;
+            }
+        }
+        return nRet;
+    }
+
+    rtl::OUString
+    getFieldTypeName( sal_Int32 nCol )
+    {
        switch( getFieldType( nCol ) )
        {
        case DataType::BIT:
@@ -188,30 +228,52 @@
                        break;
        }
        return ::rtl::OUString();
-}
+    }
 
-rtl::OUString
-getFieldName( sal_Int32 nCol )
-{
-       const GParamSpec *pSpec = getField( nCol );
+    rtl::OUString
+    getFieldName( sal_Int32 nCol )
+    {
+        const GParamSpec *pSpec = getField( nCol )->pField;
        rtl::OUString aName;
+        initFields();
 
        if( pSpec )
                        aName = rtl::OStringToOUString( g_param_spec_get_name( 
( GParamSpec * )pSpec ),
                                                                                
        RTL_TEXTENCODING_UTF8 );
        aName = aName.replace( '-', '_' );
        return aName;
-}
+    }
+
+    void  
+    free_column_resources()
+    {
+        for (int i=nFields-1;i > 0;i--) 
+        {
+            if (pFields && pFields[i] ) 
+            {
+                if (pFields[i]->pField) 
+                    g_param_spec_unref(pFields[i]->pField);
+                g_free(pFields[i]);
+            }
+        }
+       if(pFields) 
+        {
+            g_free(pFields);
+            pFields=NULL;
+        }
+       
+    }
+
 
        }
 }
 
+
 OEvoabDatabaseMetaData::OEvoabDatabaseMetaData(OEvoabConnection* _pCon)
        : ::connectivity::ODatabaseMetaDataBase(_pCon)
        ,m_pConnection(_pCon)
 {
        
OSL_ENSURE(m_pConnection,"OEvoabDatabaseMetaData::OEvoabDatabaseMetaData: No 
connection set!");
-       //construct();
 }
 void OEvoabDatabaseMetaData::construct()
 {
@@ -272,7 +334,7 @@
                        aRow[5] = new ORowSetValueDecorator( 
static_cast<sal_Int16>( getFieldType( i ) ) );
                        aRow[6] = new ORowSetValueDecorator( getFieldTypeName( 
i ) );
 
-                       OSL_TRACE( "   ColumnName = '%s'", 
g_param_spec_get_name( pFields[i] ) );
+                       OSL_TRACE( "   ColumnName = '%s'", 
g_param_spec_get_name( pFields[i]->pField ) );
                        // COLUMN_NAME
                        aRow[4] = new ORowSetValueDecorator( getFieldName( i ) 
);
                        // ORDINAL_POSITION

File [changed]: NDatabaseMetaData.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NDatabaseMetaData.hxx?r1=1.5&r2=1.5.24.1
Delta lines:  +35 -9
--------------------
--- NDatabaseMetaData.hxx       19 Jan 2006 17:18:17 -0000      1.5
+++ NDatabaseMetaData.hxx       15 Feb 2006 12:15:30 -0000      1.5.24.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NDatabaseMetaData.hxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.5.24.1 $
  *
- *  last change: $Author: obo $ $Date: 2006/01/19 17:18:17 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:30 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -60,12 +60,38 @@
                //**************************************************************
                //************ Class: OEvoabDatabaseMetaData
                //**************************************************************
+               typedef struct{
+                       gboolean bIsSplittedValue;
+                       GParamSpec *pField;
+               }ColumnProperty;
+
+               typedef enum {
+                       
DEFAULT_ADDR_LINE1=1,DEFAULT_ADDR_LINE2,DEFAULT_CITY,DEFAULT_STATE,DEFAULT_COUNTRY,DEFAULT_ZIP,
+                       
WORK_ADDR_LINE1,WORK_ADDR_LINE2,WORK_CITY,WORK_STATE,WORK_COUNTRY,WORK_ZIP,
+                       
HOME_ADDR_LINE1,HOME_ADDR_LINE2,HOME_CITY,HOME_STATE,HOME_COUNTRY,HOME_ZIP,
+                       
OTHER_ADDR_LINE1,OTHER_ADDR_LINE2,OTHER_CITY,OTHER_STATE,OTHER_COUNTRY,OTHER_ZIP
+               }ColumnNumber;
+
+               typedef struct {
+                       const gchar *pColumnName;
+                       ColumnNumber value;
+               }SplitEvoColumns;
+
+               static SplitEvoColumns evo_addr[] = {
+                       
{"addr-line1",DEFAULT_ADDR_LINE1},{"addr-line2",DEFAULT_ADDR_LINE2},{"city",DEFAULT_CITY},{"state",DEFAULT_STATE},{"country",DEFAULT_COUNTRY},{"zip",DEFAULT_ZIP},
+                       
{"work-addr-line1",WORK_ADDR_LINE1},{"work-addr-line2",WORK_ADDR_LINE2},{"work-city",WORK_CITY},{"work-state",WORK_STATE},{"work-country",WORK_COUNTRY},{"work-zip",WORK_ZIP},
+                       
{"home-addr-line1",HOME_ADDR_LINE1},{"home-addr-line2",HOME_ADDR_LINE2},{"home-addr-City",HOME_CITY},{"home-state",HOME_STATE},{"home-country",HOME_COUNTRY},{"home-zip",HOME_ZIP},
+                       
{"other-addr-line1",OTHER_ADDR_LINE1},{"other-addr-line2",OTHER_ADDR_LINE2},{"other-addr-city",OTHER_CITY},{"other-addr-state",OTHER_STATE},{"other-addr-country",OTHER_COUNTRY},{"other-addr-zip",OTHER_ZIP}
+               };
+
+               const ColumnProperty *getField(guint n);
+               guint                 getFieldCount() ;
+               sal_Int32             getFieldType(sal_Int32 nCol) ;
+               rtl::OUString         getFieldTypeName(sal_Int32 nCol) ;
+               rtl::OUString         getFieldName(sal_Int32 nCol) ;
+               sal_Int32             findEvoabField(const rtl::OUString& 
aColName);
 
-               const GParamSpec *getField(guint n);
-               guint             getFieldCount();
-               sal_Int32                getFieldType(sal_Int32 nCol);
-               rtl::OUString    getFieldTypeName(sal_Int32 nCol);
-               rtl::OUString     getFieldName(sal_Int32 nCol);
+               void free_column_resources();
                
                class OEvoabDatabaseMetaData : public ODatabaseMetaDataBase
                {

File [changed]: NPreparedStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NPreparedStatement.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +4 -7
-------------------
--- NPreparedStatement.cxx      8 Sep 2005 05:51:42 -0000       1.3
+++ NPreparedStatement.cxx      15 Feb 2006 12:15:31 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NPreparedStatement.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:51:42 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:31 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -121,9 +121,8 @@
        ::osl::MutexGuard aGuard( m_aMutex );
        checkDisposed(OStatement_BASE::rBHelper.bDisposed);
                
-
+       free_column_resources();
        // Reset last warning message
-
        try {
                clearWarnings ();
                OStatement_BASE2::close();
@@ -132,8 +131,6 @@
                // If we get an error, ignore
        }
 
-       // Remove this Statement object from the Connection object's
-       // list
 }
 // -------------------------------------------------------------------------
 

File [changed]: NResultSet.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NResultSet.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +205 -37
----------------------
--- NResultSet.cxx      8 Sep 2005 05:52:10 -0000       1.3
+++ NResultSet.cxx      15 Feb 2006 12:15:32 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NResultSet.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:52:10 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -110,7 +110,6 @@
 using namespace ::com::sun::star::util;
 
 
//------------------------------------------------------------------------------
-//     
IMPLEMENT_SERVICE_INFO(OEvoabResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
 ::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName(  ) throw ( 
RuntimeException)  \
 {
        return 
::rtl::OUString::createFromAscii("com.sun.star.sdbcx.evoab.ResultSet");
@@ -276,6 +275,7 @@
                        m_pConnection->setPassword( aPassword );
                }
                m_nLength = g_list_length( m_pContacts );
+
                OSL_TRACE( "Query return %d records", m_nLength );
                m_nIndex = -1;
        }
@@ -300,7 +300,7 @@
        return aRet;
 }
 // -------------------------------------------------------------------------
- Sequence<  Type > SAL_CALL OEvoabResultSet::getTypes(  ) throw( 
RuntimeException)
+Sequence< Type > SAL_CALL OEvoabResultSet::getTypes(  ) throw( 
RuntimeException)
 {
        OTypeCollection aTypes( ::getCppuType( (const  Reference< 
::com::sun::star::beans::XMultiPropertySet > *)0 ),
                                                                                
                ::getCppuType( (const  Reference< 
::com::sun::star::beans::XFastPropertySet > *)0 ),
@@ -310,35 +310,195 @@
        return 
::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
 }
 
+static int 
+whichAddress(int value)
+{
+       int fieldEnum;
+       switch (value) 
+       {
+               case HOME_ADDR_LINE1:
+               case HOME_ADDR_LINE2:
+               case HOME_CITY:
+               case HOME_STATE:
+               case HOME_COUNTRY:
+               case HOME_ZIP: 
+                       fieldEnum = e_contact_field_id("address_home");
+                       break;
+
+               case WORK_ADDR_LINE1:
+               case WORK_ADDR_LINE2:
+               case WORK_CITY:
+               case WORK_STATE:
+               case WORK_COUNTRY:
+               case WORK_ZIP: 
+                       fieldEnum = e_contact_field_id("address_work");
+                       break;
+
+               case OTHER_ADDR_LINE1:
+               case OTHER_ADDR_LINE2:
+               case OTHER_CITY:
+               case OTHER_STATE:
+               case OTHER_COUNTRY:
+               case OTHER_ZIP: 
+                       fieldEnum = e_contact_field_id("address_other");
+                       break;
+
+               default: fieldEnum = e_contact_field_id("address_home");
+         }
+       return fieldEnum;
+}
+
+/*
+* This function decides the default column values based on the first field of 
EContactAddress.
+* The search order is Work->Home->other(defaults).
+*/
+static EContactAddress * 
+getDefaultContactAddress(EContact *pContact,int *value) 
+{
+       EContactAddress *ec = (EContactAddress 
*)e_contact_get(pContact,whichAddress(WORK_ADDR_LINE1));
+       if ( ec && (strlen(ec->street)>0) ) 
+       {
+               *value= *value +WORK_ADDR_LINE1 -1;
+               return ec;      
+       }
+       else  
+               {
+                       ec = (EContactAddress 
*)e_contact_get(pContact,whichAddress(HOME_ADDR_LINE1));
+                       if ( ec && (strlen(ec->street)>0) ) 
+                       { 
+                               *value=*value+HOME_ADDR_LINE1-1;
+                               return ec;
+                       }
+               }
+
+       *value=*value+OTHER_ADDR_LINE1-1;
+       return (EContactAddress 
*)e_contact_get(pContact,whichAddress(OTHER_ADDR_LINE1));
+}
+
+static EContactAddress* 
+getContactAddress(EContact *pContact, int * address_enum) 
+{ 
+       EContactAddress *ec = NULL;
+    switch (*address_enum) {
+       
+        case DEFAULT_ADDR_LINE1:
+        case DEFAULT_ADDR_LINE2:
+        case DEFAULT_CITY:
+        case DEFAULT_STATE:
+        case DEFAULT_COUNTRY:
+        case DEFAULT_ZIP:
+                       ec = 
getDefaultContactAddress(pContact,address_enum);break;
+               default:
+                       ec = (EContactAddress 
*)e_contact_get(pContact,whichAddress(*address_enum));
+    }
+       return ec;
+}
+
+static bool 
+handleSplitAddress(EContact *pContact,GValue *pStackValue,int value) 
+{
+
+       EContactAddress *ec = getContactAddress(pContact,&value) ;
+
+       if (ec==NULL)
+               return true;
+
+       switch (value) {
+       case WORK_ADDR_LINE1:
+                   g_value_set_string(pStackValue,ec->street ); break;
+           case WORK_ADDR_LINE2:
+                   g_value_set_string(pStackValue,ec->po ); break;
+       case WORK_CITY: 
+               g_value_set_string(pStackValue,ec->locality ); break;
+       case WORK_STATE:
+               g_value_set_string(pStackValue,ec->region ); break;
+       case WORK_COUNTRY:
+               g_value_set_string(pStackValue,ec->country ); break;
+       case WORK_ZIP:
+               g_value_set_string(pStackValue,ec->code ); break;
+
+        case HOME_ADDR_LINE1:
+                       g_value_set_string(pStackValue,ec->street ); break;
+        case HOME_ADDR_LINE2:
+                       g_value_set_string(pStackValue,ec->po ); break;
+        case HOME_CITY:
+                       g_value_set_string(pStackValue,ec->locality ); break;
+        case HOME_STATE:
+                       g_value_set_string(pStackValue,ec->region ); break;
+        case HOME_COUNTRY:
+                       g_value_set_string(pStackValue,ec->country ); break;
+        case HOME_ZIP:
+                       g_value_set_string(pStackValue,ec->code ); break;
+
+        case OTHER_ADDR_LINE1:
+                       g_value_set_string(pStackValue,ec->street ); break;
+        case OTHER_ADDR_LINE2:
+                       g_value_set_string(pStackValue,ec->po ); break;
+        case OTHER_CITY:
+                       g_value_set_string(pStackValue,ec->locality ); break;
+        case OTHER_STATE:
+                       g_value_set_string(pStackValue,ec->region ); break;
+        case OTHER_COUNTRY:
+                       g_value_set_string(pStackValue,ec->country ); break;
+        case OTHER_ZIP:
+                       g_value_set_string(pStackValue,ec->code ); break;
+
+       }
+
+return false;
+}
 // -------------------------------------------------------------------------
 // XRow Interface 
 
 bool
 OEvoabResultSet::getValue( sal_Int32 nColumnNum, GType nType, GValue 
*pStackValue)
 {
-       const GParamSpec *pSpec = evoab::getField (nColumnNum - 1);
+       const ColumnProperty * pSpecs = evoab::getField (nColumnNum );
+       if (!pSpecs) 
+               return sal_False;
+       GParamSpec *pSpec = pSpecs->pField;
+       gboolean bIsSplittedColumn=pSpecs->bIsSplittedValue;
        EContact *pContact = getCur();
        
        m_bWasNull = true;
-       if (!pSpec || !pContact)
+       if (!pSpec || !pContact) {
                return false;
-
+       }
        if (G_PARAM_SPEC_VALUE_TYPE (pSpec) != nType)
        {
-               g_warning ("Wrong type");
+#ifdef DEBUG
+               g_warning ("Wrong type (0x%x) (0x%x) '%s'",
+                                  (int)G_PARAM_SPEC_VALUE_TYPE (pSpec), (int) 
nType,
+                                  pSpec->name ? pSpec->name : "<noname>");
+#endif
                return false;
        }
        g_value_init (pStackValue, nType);
+       if (bIsSplittedColumn)
+       {
+               for (int i=0;i<OTHER_ZIP;i++)
+               {
+                       if (0 == strcmp (g_param_spec_get_name ((GParamSpec 
*)pSpec), evo_addr[i].pColumnName))
+                       {
+                               m_bWasNull = handleSplitAddress (pContact, 
pStackValue, evo_addr[i].value);
+                               return true;
+                       }
+               }
+       }
+       else
+       {
        g_object_get_property (G_OBJECT (pContact),
                                                   g_param_spec_get_name 
((GParamSpec *) pSpec),
                                                   pStackValue);
        if (G_VALUE_TYPE (pStackValue) != nType)
        {
+#ifdef DEBUG
                g_warning ("Fetched type mismatch");
+#endif
                g_value_unset (pStackValue);
                return false;
        }
-
+       }
        m_bWasNull = false;
        return true;
 }
@@ -355,15 +515,19 @@
        ::osl::MutexGuard aGuard( m_aMutex );
        checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
        rtl::OUString aResult;
-
+       if ( m_xMetaData.is())
+        {
+                OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) 
m_xMetaData.get();
+                sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
        GValue aValue = { 0, };
-       if (getValue (nColumnNum, G_TYPE_STRING, &aValue))
+               if (getValue (nFieldNumber, G_TYPE_STRING, &aValue))
        {
                const char *pStr = g_value_get_string (&aValue);
                rtl::OString aStr (pStr ? pStr : "");
                aResult = rtl::OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 );
                g_value_unset (&aValue);
        }
+       }
        return aResult;
 }
 // -------------------------------------------------------------------------
@@ -373,12 +537,17 @@
        checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
        sal_Bool bResult = sal_False;
 
+       if ( m_xMetaData.is())
+        {
+                OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) 
m_xMetaData.get();
+                sal_Int32 nFieldNumber = pMeta->fieldAtColumn(nColumnNum);
        GValue aValue = { 0, };
-       if (getValue (nColumnNum, G_TYPE_BOOLEAN, &aValue))
+               if (getValue (nFieldNumber, G_TYPE_BOOLEAN, &aValue))
        {
                bResult = g_value_get_boolean (&aValue);
                g_value_unset (&aValue);
        }
+       }
        return bResult ? sal_True : sal_False;
 }
 // -------------------------------------------------------------------------
@@ -606,6 +775,7 @@
        checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
        m_nIndex = 0;
+       return true;
 }
 // -------------------------------------------------------------------------
 
@@ -615,6 +785,7 @@
        checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
        m_nIndex = m_nLength - 1;
+       return true;
 }
 // -------------------------------------------------------------------------
 sal_Bool SAL_CALL OEvoabResultSet::absolute( sal_Int32 row ) 
throw(SQLException, RuntimeException)
@@ -711,7 +882,6 @@
        {
                ::osl::MutexGuard aGuard( m_aMutex );
                checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
        }
        OSL_TRACE("In/Out: OEvoabResultSet::close" );
        dispose();
@@ -795,9 +965,7 @@
 // -------------------------------------------------------------------------
 void OEvoabResultSet::setFastPropertyValue_NoBroadcast(
                                                                sal_Int32 
nHandle,
-                                                               const Any& 
rValue
-                                                                               
                 )
-                                                                               
                 throw (Exception)
+                                                               const Any& 
rValue) throw (Exception)
 {
        switch(nHandle)
        {

File [changed]: NResultSetMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +38 -9
--------------------
--- NResultSetMetaData.cxx      8 Sep 2005 05:52:42 -0000       1.3
+++ NResultSetMetaData.cxx      15 Feb 2006 12:15:32 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NResultSetMetaData.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:52:42 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -45,6 +45,7 @@
 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
 #include <com/sun/star/sdbc/DataType.hpp>
 #endif
+#include "NDebug.hxx"
 
 using namespace connectivity::evoab;
 using namespace com::sun::star::uno;
@@ -52,7 +53,8 @@
 using namespace com::sun::star::sdbc;
 
 OEvoabResultSetMetaData::OEvoabResultSetMetaData(const ::rtl::OUString& 
_aTableName) 
-       : m_aTableName(_aTableName)
+       : m_aTableName(_aTableName),
+         m_aEvoabFields()
 {
 
 }
@@ -61,6 +63,27 @@
 {
 }
 // -------------------------------------------------------------------------
+void OEvoabResultSetMetaData::setEvoabFields(const 
::vos::ORef<connectivity::OSQLColumns> &xColumns) throw(SQLException)
+{
+        OSQLColumns::const_iterator aIter;
+        static const ::rtl::OUString 
aName(::rtl::OUString::createFromAscii("Name"));
+
+        for (aIter = xColumns->begin(); aIter != xColumns->end(); ++aIter)
+        {
+                ::rtl::OUString aFieldName;
+                sal_uInt32 nFieldNumber;
+
+                (*aIter)->getPropertyValue(aName) >>= aFieldName;
+                nFieldNumber = findEvoabField(aFieldName);
+               if (nFieldNumber == -1)
+               ::dbtools::throwGenericSQLException(
+                       ::rtl::OUString::createFromAscii("Invalid column name: 
") + aFieldName,
+                       NULL);
+                m_aEvoabFields.push_back(nFieldNumber);
+        }
+}
+
+// -------------------------------------------------------------------------
 void OEvoabResultSetMetaData::checkColumnIndex(sal_Int32 nColumnNum)  
throw(SQLException, RuntimeException)
 {
        if( nColumnNum <= 0 || nColumnNum > getColumnCount() )
@@ -74,12 +97,13 @@
 // -------------------------------------------------------------------------
 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnType( sal_Int32 
nColumnNum ) throw(SQLException, RuntimeException)
 {
-       return evoab::getFieldType (nColumnNum - 1);
+        sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
+       return evoab::getFieldType (nField);
 }
 // -------------------------------------------------------------------------
 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnCount(  ) 
throw(SQLException, RuntimeException)
 {
-       return evoab::getFieldCount();
+       return m_aEvoabFields.size();
 }
 // -------------------------------------------------------------------------
 sal_Bool SAL_CALL OEvoabResultSetMetaData::isCaseSensitive( sal_Int32 
nColumnNum ) throw(SQLException, RuntimeException)
@@ -94,17 +118,22 @@
 // -------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnName( sal_Int32 
nColumnNum ) throw(SQLException, RuntimeException)
 {
-       return evoab::getFieldName( nColumnNum - 1 );
+        sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
+        return evoab::getFieldName( nField );
 }
 // -------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnTypeName( sal_Int32 
nColumnNum ) throw(SQLException, RuntimeException)
 {
-       return evoab::getFieldTypeName( nColumnNum - 1 );
+        sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
+       return evoab::getFieldTypeName( nField );
 }
 // -------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 
nColumnNum ) throw(SQLException, RuntimeException)
 {
-       const GParamSpec *pSpec = getField( nColumnNum - 1 );
+       
+        sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
+       const ColumnProperty *pSpecs = getField(nField); 
+       GParamSpec *pSpec = pSpecs->pField;
        rtl::OUString aLabel;
 
        if( pSpec )

File [changed]: NResultSetMetaData.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NResultSetMetaData.hxx?r1=1.3&r2=1.3.74.1
Delta lines:  +13 -4
--------------------
--- NResultSetMetaData.hxx      8 Sep 2005 05:52:57 -0000       1.3
+++ NResultSetMetaData.hxx      15 Feb 2006 12:15:33 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NResultSetMetaData.hxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:52:57 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:33 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -46,6 +46,9 @@
 #ifndef _CONNECTIVITY_EVOAB_CONNECTION_HXX_
 #include "NConnection.hxx"
 #endif 
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
 #include <com/sun/star/connection/XConnection.hpp>
 namespace connectivity
 {
@@ -59,11 +62,17 @@
                class OEvoabResultSetMetaData : public  OResultSetMetaData_BASE
                {
                  ::rtl::OUString       m_aTableName;
+                  ::std::vector<sal_Int32>        m_aEvoabFields;
+
                protected:
                        virtual ~OEvoabResultSetMetaData();
                public:
                  OEvoabResultSetMetaData(const ::rtl::OUString& _aTableName);
-
+                 void setEvoabFields(const 
::vos::ORef<connectivity::OSQLColumns> &xColumns) 
throw(::com::sun::star::sdbc::SQLException);
+                 inline sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const
+                        { return m_aEvoabFields[columnIndex - 1]; }
+                 inline sal_Int32 getFieldSize() const 
+                       {return m_aEvoabFields.size();}
                  /// Avoid ambigous cast error from the compiler.
                  inline operator ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSetMetaData > () throw()
                  { return this; }

File [changed]: NStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NStatement.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +28 -11
---------------------
--- NStatement.cxx      8 Sep 2005 05:53:24 -0000       1.3
+++ NStatement.cxx      15 Feb 2006 12:15:33 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NStatement.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:53:24 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:33 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -195,8 +195,7 @@
 EBookQuery *
 OStatement_Base::createTrue()
 { // Not the world's most efficient unconditional true but ...
-//FIXME: make enum hack to make it gud integer (E_CONTACT_FULL_NAME);
-return  e_book_query_field_exists (3);
+       return e_book_query_from_string("(exists \"full_name\")");
 }
 
 EBookQuery *
@@ -380,19 +379,28 @@
                        else if( (aMatchString.indexOf ( WILDCARD ) == 
aMatchString.lastIndexOf ( WILDCARD ) ) )
                        {   // One occurance of '%'  matches...
                 if ( aMatchString.indexOf ( WILDCARD ) == 0 )
-                                       pResult = createTest( aColumnName, 
E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 1 ) );
+                                       pResult = createTest( aColumnName, 
E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) );
 
                 else if ( aMatchString.indexOf ( WILDCARD ) == 
aMatchString.getLength() - 1 )
-                                       pResult = createTest( aColumnName, 
E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) );
+                                       pResult = createTest( aColumnName, 
E_BOOK_QUERY_BEGINS_WITH, aMatchString.copy( 0, aMatchString.getLength() - 1 ) 
);
 
                                else
-                               {
                                        ::dbtools::throwGenericSQLException(
-                                               
::rtl::OUString::createFromAscii( "like statement contains too many wildcards" 
), NULL );
-                               }
+                                               
::rtl::OUString::createFromAscii( "like statement contains wildcard in the 
middle" ), NULL );
+                                       
+
                                if( pResult && bNotLike )
                                        pResult = e_book_query_not( pResult, 
TRUE );
             }
+                       else if( aMatchString.getLength() >= 3 &&
+                                        aMatchString.indexOf ( WILDCARD ) == 0 
&&
+                                        aMatchString.indexOf ( WILDCARD, 1) == 
aMatchString.getLength() - 1 ) {
+                               // one '%' at the start and another at the end
+                               pResult = createTest( aColumnName, 
E_BOOK_QUERY_CONTAINS, aMatchString.copy (1, aMatchString.getLength() - 2) );
+                       }
+                       else
+                               ::dbtools::throwGenericSQLException(
+                                       ::rtl::OUString::createFromAscii( "like 
statement contains too many wildcards" ), NULL );
                }
                else
                                OSL_ASSERT( "Serious internal error" );
@@ -485,11 +493,20 @@
        g_message( "Parsed SQL to sexpr '%s'\n", pSexpr );
        g_free( pSexpr );
 #endif
-
+       ::vos::ORef<connectivity::OSQLColumns> xColumns;
        if (pQuery)
        {
                pResult->construct( pQuery, aTable, bIsWithoutWhere );
                e_book_query_unref( pQuery );
+               xColumns = m_aSQLIterator.getSelectColumns();
+               if (!xColumns.isValid())
+               {
+                       ::dbtools::throwGenericSQLException(
+                               ::rtl::OUString::createFromAscii("Invalid 
selection of columns"),
+                               NULL);
+               }
+               OEvoabResultSetMetaData *pMeta = (OEvoabResultSetMetaData *) 
pResult->getMetaData().get();
+               pMeta->setEvoabFields(xColumns);
        }
        m_xResultSet = xRS;
        

File [added]: NTable.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NTable.cxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [added]: NTable.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NTable.hxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup
Added lines: 0
--------------

File [changed]: NTables.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NTables.cxx?r1=1.3&r2=1.3.74.1
Delta lines:  +16 -9
--------------------
--- NTables.cxx 8 Sep 2005 05:53:50 -0000       1.3
+++ NTables.cxx 15 Feb 2006 12:15:37 -0000      1.3.74.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: NTables.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.74.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/09/08 05:53:50 $
+ *  last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:37 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -78,7 +78,9 @@
 #ifndef CONNECTIVITY_EVOAB_DEBUG_HELPER_HXX
 #include "NDebug.hxx"
 #endif
-
+#ifndef _CONNECTIVITY_EVOAB_TABLE_HXX_
+#include "NTable.hxx"
+#endif
 using namespace ::comphelper;
 
 using namespace ::cppu;
@@ -98,7 +100,7 @@
        ::rtl::OUString aSchema = ::rtl::OUString::createFromAscii("%");
 
     Sequence< ::rtl::OUString > aTypes(1);
-       aTypes[0] = ::rtl::OUString::createFromAscii("%");
+       aTypes[0] = ::rtl::OUString::createFromAscii("TABLE");
        ::rtl::OUString sEmpty;
 
     Reference< XResultSet > xResult = 
m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
@@ -109,12 +111,17 @@
         Reference< XRow > xRow(xResult,UNO_QUERY);
                if(xResult->next()) // there can be only one table with this 
name
                {
-                       OTable* pRet = new OTable( this, sal_True,
-                                                                          
aName, xRow->getString( 4 ),
-                                                                          
xRow->getString( 5 ), sEmpty );
+                       OEvoabTable* pRet = new OEvoabTable(
+                                       this,
+                                       (OEvoabConnection 
*)static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
+                                       aName,
+                                       xRow->getString(4),
+                                       xRow->getString(5),
+                                       sEmpty);
                        xRet = pRet;
                }
        }
+
        ::comphelper::disposeComponent(xResult);
 
        return xRet;

File [changed]: makefile.mk
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/makefile.mk?r1=1.3&r2=1.3.74.1
Delta lines:  +5 -3
-------------------
--- makefile.mk 8 Sep 2005 05:54:17 -0000       1.3
+++ makefile.mk 15 Feb 2006 12:15:37 -0000      1.3.74.1
@@ -4,9 +4,9 @@
 #
 #   $RCSfile: makefile.mk,v $
 #
-#   $Revision: 1.3 $
+#   $Revision: 1.3.74.1 $
 #
-#   last change: $Author: rt $ $Date: 2005/09/08 05:54:17 $
+#   last change: $Author: mmeeks $ $Date: 2006/02/15 12:15:37 $
 #
 #   The Contents of this file are made available subject to
 #   the terms of GNU Lesser General Public License Version 2.1.
@@ -58,6 +58,8 @@
 
 EXCEPTIONSFILES=\
        $(SLO)$/NDriver.obj \
+       $(SLO)$/NTable.obj \
+       $(SLO)$/NColumns.obj \
        $(SLO)$/NTables.obj \
        $(SLO)$/NCatalog.obj \
        $(SLO)$/NConnection.obj \




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

Reply via email to