User: kz      
Date: 06/02/28 02:34:41

Modified:
 /dba/connectivity/source/drivers/evoab2/
  NStatement.cxx

Log:
 INTEGRATION: CWS evo2fixes (1.3.74); FILE MERGED
 2006/02/15 12:15:33 mmeeks 1.3.74.1: 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]: NStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/evoab2/NStatement.cxx?r1=1.3&r2=1.4
Delta lines:  +25 -8
--------------------
--- NStatement.cxx      8 Sep 2005 05:53:24 -0000       1.3
+++ NStatement.cxx      28 Feb 2006 10:34:38 -0000      1.4
@@ -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;
        




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

Reply via email to