LCOV - code coverage report
Current view: top level - connectivity/source/drivers/mork - MResultSet.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 781 0.0 %
Date: 2014-04-14 Functions: 0 118 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/sdbc/DataType.hpp>
      21             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      22             : #include <comphelper/property.hxx>
      23             : #include <comphelper/sequence.hxx>
      24             : #include <cppuhelper/typeprovider.hxx>
      25             : #include <cppuhelper/supportsservice.hxx>
      26             : #include <comphelper/extract.hxx>
      27             : #include <com/sun/star/lang/DisposedException.hpp>
      28             : #include <com/sun/star/sdbc/ResultSetType.hpp>
      29             : #include <com/sun/star/sdbc/FetchDirection.hpp>
      30             : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
      31             : #include <comphelper/types.hxx>
      32             : #include <connectivity/dbexception.hxx>
      33             : #include <connectivity/dbtools.hxx>
      34             : 
      35             : #include <TSortIndex.hxx>
      36             : #include <rtl/string.hxx>
      37             : #include <vector>
      38             : #include <algorithm>
      39             : #include "MResultSet.hxx"
      40             : #include "MResultSetMetaData.hxx"
      41             : #include "FDatabaseMetaDataResultSet.hxx"
      42             : 
      43             : #include "resource/mork_res.hrc"
      44             : #include "resource/common_res.hrc"
      45             : 
      46             : #if OSL_DEBUG_LEVEL > 0
      47             : # define OUtoCStr( x ) ( OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
      48             : #else /* OSL_DEBUG_LEVEL */
      49             : # define OUtoCStr( x ) ("dummy")
      50             : #endif /* OSL_DEBUG_LEVEL */
      51             : 
      52             : using namespace ::comphelper;
      53             : using namespace connectivity;
      54             : using namespace connectivity::mork;
      55             : using namespace ::cppu;
      56             : using namespace com::sun::star::uno;
      57             : using namespace com::sun::star::lang;
      58             : using namespace com::sun::star::beans;
      59             : using namespace com::sun::star::sdbc;
      60             : using namespace com::sun::star::container;
      61             : using namespace com::sun::star::io;
      62             : using namespace com::sun::star::util;
      63             : 
      64             : 
      65             : //  IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet");
      66           0 : OUString SAL_CALL OResultSet::getImplementationName(  ) throw ( RuntimeException, std::exception)    \
      67             : {
      68           0 :     return OUString("com.sun.star.sdbcx.mork.ResultSet");
      69             : }
      70             : 
      71           0 :  Sequence< OUString > SAL_CALL OResultSet::getSupportedServiceNames(  ) throw( RuntimeException, std::exception)
      72             : {
      73           0 :     ::com::sun::star::uno::Sequence< OUString > aSupported(2);
      74           0 :     aSupported[0] = "com.sun.star.sdbc.ResultSet";
      75           0 :     aSupported[1] = "com.sun.star.sdbcx.ResultSet";
      76           0 :     return aSupported;
      77             : }
      78             : 
      79           0 : sal_Bool SAL_CALL OResultSet::supportsService( const OUString& _rServiceName ) throw( RuntimeException, std::exception)
      80             : {
      81           0 :     return cppu::supportsService(this, _rServiceName);
      82             : }
      83             : 
      84             : 
      85           0 : OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
      86             :     : OResultSet_BASE(m_aMutex)
      87             :     ,OPropertySetHelper(OResultSet_BASE::rBHelper)
      88             :     ,m_pStatement(pStmt)
      89             :     ,m_xStatement(*pStmt)
      90             :     ,m_xMetaData(NULL)
      91             :     ,m_nRowPos(0)
      92             :     ,m_nOldRowPos(0)
      93             :     ,m_bWasNull(false)
      94             :     ,m_nFetchSize(0)
      95             :     ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
      96             :     ,m_nFetchDirection(FetchDirection::FORWARD)
      97             :     ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
      98             :     ,m_pSQLIterator( _pSQLIterator )
      99           0 :     ,m_pParseTree( _pSQLIterator->getParseTree() )
     100           0 :     ,m_aQueryHelper(pStmt->getOwnConnection()->getColumnAlias())
     101             :     ,m_pTable(NULL)
     102             :     ,m_CurrentRowCount(0)
     103             :     ,m_nParamIndex(0)
     104             :     ,m_bIsAlwaysFalseQuery(sal_False)
     105             :     ,m_pKeySet(NULL)
     106             :     ,m_pSortIndex(NULL)
     107             :     ,m_nNewRow(0)
     108             :     ,m_nUpdatedRow(0)
     109             :     ,m_RowStates(0)
     110           0 :     ,m_bIsReadOnly(-1)
     111             : {
     112             :     //m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords());
     113           0 : }
     114             : 
     115           0 : OResultSet::~OResultSet()
     116             : {
     117           0 : }
     118             : 
     119             : 
     120           0 : void OResultSet::disposing(void)
     121             : {
     122           0 :     OPropertySetHelper::disposing();
     123             : 
     124           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     125             : 
     126           0 :     m_xStatement.clear();
     127           0 :     m_xMetaData.clear();
     128           0 :     m_pParseTree    = NULL;
     129           0 :     m_xColumns = NULL;
     130           0 :     m_xParamColumns = NULL;
     131           0 :     m_pKeySet       = NULL;
     132           0 :     if(m_pTable)
     133             :     {
     134           0 :         m_pTable->release();
     135           0 :         m_pTable = NULL;
     136           0 :     }
     137           0 : }
     138             : 
     139           0 : Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     140             : {
     141           0 :     Any aRet = OPropertySetHelper::queryInterface(rType);
     142           0 :     if(!aRet.hasValue())
     143           0 :         aRet = OResultSet_BASE::queryInterface(rType);
     144           0 :     return aRet;
     145             : }
     146             : 
     147           0 :  Sequence<  Type > SAL_CALL OResultSet::getTypes(  ) throw( RuntimeException, std::exception)
     148             : {
     149           0 :     OTypeCollection aTypes( ::getCppuType( (const  Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
     150           0 :                                                 ::getCppuType( (const  Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
     151           0 :                                                 ::getCppuType( (const  Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
     152             : 
     153           0 :     return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
     154             : }
     155             : 
     156           0 : void OResultSet::methodEntry()
     157             : {
     158           0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     159           0 :     if ( !m_pTable )
     160             :     {
     161             :         OSL_FAIL( "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" );
     162           0 :         throw DisposedException( OUString(), *this );
     163             :     }
     164           0 : }
     165             : 
     166             : 
     167           0 : sal_Int32 SAL_CALL OResultSet::findColumn( const OUString& columnName ) throw(SQLException, RuntimeException, std::exception)
     168             : {
     169           0 :     ResultSetEntryGuard aGuard( *this );
     170             : 
     171             :     // find the first column with the name columnName
     172           0 :     Reference< XResultSetMetaData > xMeta = getMetaData();
     173           0 :     sal_Int32 nLen = xMeta->getColumnCount();
     174           0 :     sal_Int32 i = 1;
     175           0 :     for(;i<=nLen;++i)
     176             :     {
     177           0 :         if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
     178           0 :                 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
     179           0 :             return i;
     180             :     }
     181             : 
     182           0 :     ::dbtools::throwInvalidColumnException( columnName, *this );
     183             :     assert(false);
     184           0 :     return 0; // Never reached
     185             : }
     186             : 
     187           0 : Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     188             : {
     189           0 :     return NULL;
     190             : }
     191             : 
     192           0 : Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     193             : {
     194           0 :     return NULL;
     195             : }
     196             : 
     197             : 
     198           0 : sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     199             : {
     200           0 :     ResultSetEntryGuard aGuard( *this );
     201           0 :     m_bWasNull = sal_True;
     202           0 :     return sal_False;
     203             : }
     204             : 
     205             : 
     206           0 : sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     207             : {
     208           0 :     ResultSetEntryGuard aGuard( *this );
     209           0 :     return 0;
     210             : }
     211             : 
     212             : 
     213           0 : Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     214             : {
     215           0 :     ResultSetEntryGuard aGuard( *this );
     216           0 :     return Sequence< sal_Int8 >();
     217             : }
     218             : 
     219             : 
     220           0 : Date SAL_CALL OResultSet::getDate( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     221             : {
     222           0 :     ResultSetEntryGuard aGuard( *this );
     223           0 :     return Date();
     224             : }
     225             : 
     226             : 
     227           0 : double SAL_CALL OResultSet::getDouble( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     228             : {
     229           0 :     ResultSetEntryGuard aGuard( *this );
     230           0 :     return 0.0;
     231             : }
     232             : 
     233             : 
     234           0 : float SAL_CALL OResultSet::getFloat( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     235             : {
     236           0 :     ResultSetEntryGuard aGuard( *this );
     237           0 :     return 0;
     238             : }
     239             : 
     240             : 
     241           0 : sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     242             : {
     243           0 :     ResultSetEntryGuard aGuard( *this );
     244           0 :     return 0;
     245             : }
     246             : 
     247             : 
     248           0 : sal_Int32 SAL_CALL OResultSet::getRow(  ) throw(SQLException, RuntimeException, std::exception)
     249             : {
     250           0 :     ResultSetEntryGuard aGuard( *this );
     251             : 
     252             :     OSL_TRACE("In/Out: OResultSet::getRow, return = %u", m_nRowPos );
     253           0 :     return m_nRowPos;
     254             : }
     255             : 
     256             : 
     257           0 : sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     258             : {
     259           0 :     ResultSetEntryGuard aGuard( *this );
     260           0 :     return sal_Int64();
     261             : }
     262             : 
     263             : 
     264           0 : Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData(  ) throw(SQLException, RuntimeException, std::exception)
     265             : {
     266           0 :     ResultSetEntryGuard aGuard( *this );
     267             : 
     268           0 :     if(!m_xMetaData.is())
     269           0 :         m_xMetaData = new OResultSetMetaData(
     270           0 :         m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,determineReadOnly());
     271           0 :     return m_xMetaData;
     272             : }
     273             : 
     274           0 : Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     275             : {
     276           0 :     return NULL;
     277             : }
     278             : 
     279             : 
     280             : 
     281           0 : Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     282             : {
     283           0 :     return NULL;
     284             : }
     285             : 
     286           0 : Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     287             : {
     288           0 :     return NULL;
     289             : }
     290             : 
     291             : 
     292           0 : Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     293             : {
     294           0 :     return NULL;
     295             : }
     296             : 
     297             : 
     298           0 : Any SAL_CALL OResultSet::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException, std::exception)
     299             : {
     300           0 :     return Any();
     301             : }
     302             : 
     303             : 
     304           0 : sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     305             : {
     306           0 :     return 0;
     307             : }
     308             : 
     309             : 
     310           0 : void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
     311             : {
     312           0 :     if(columnIndex <= 0 || columnIndex > (sal_Int32)m_xColumns->get().size())
     313           0 :         ::dbtools::throwInvalidIndexException(*this);
     314           0 : }
     315             : 
     316           0 : sal_uInt32 OResultSet::currentRowCount()
     317             : {
     318           0 :     if ( m_bIsAlwaysFalseQuery )
     319           0 :         return 0;
     320             :     //return 0;//m_aQuery.getRealRowCount() - deletedCount();
     321             :     // new implementation
     322           0 :     return m_aQueryHelper.getResultCount();
     323             : }
     324             : 
     325             : 
     326             : 
     327           0 : sal_Bool OResultSet::fetchCurrentRow( ) throw(SQLException, RuntimeException)
     328             : {
     329             :     OSL_TRACE("fetchCurrentRow, m_nRowPos = %u", m_nRowPos );
     330           0 :     return fetchRow(getCurrentCardNumber());
     331             : }
     332             : 
     333             : 
     334           0 : sal_Bool OResultSet::pushCard(sal_uInt32 /*cardNumber*/) throw(SQLException, RuntimeException)
     335             : {
     336             :     SAL_INFO("connectivity.mork", "=> OResultSet::pushCard()" );
     337           0 :     return sal_True;
     338             : /*
     339             :     if (cardNumber == 0)
     340             :         return sal_True;
     341             :     // Check whether we are storing the updated row
     342             :     if ( (m_aRow->get())[0].isNull() || (sal_Int32)(m_aRow->get())[0] != (sal_Int32)cardNumber )
     343             :         return sal_False;
     344             : 
     345             :     sal_Int32 nCount = m_aColumnNames.getLength();
     346             :     m_aQuery.setRowStates(cardNumber,m_RowStates);
     347             :     for( sal_Int32 i = 1; i <= nCount; i++ )
     348             :     {
     349             :         if ( (m_aRow->get())[i].isBound() )
     350             :         {
     351             : 
     352             :             // Everything in the addressbook is a string!
     353             : 
     354             :             if ( !m_aQuery.setRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
     355             :             {
     356             :                 m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this );
     357             :             }
     358             :         }
     359             :     }
     360             :     return sal_True;
     361             : */
     362             : }
     363             : 
     364           0 : sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(SQLException, RuntimeException)
     365             : {
     366             :     SAL_INFO("connectivity.mork", "=> OResultSet::fetchRow()" );
     367             : 
     368             :     OSL_TRACE("fetchRow, cardNumber = %u", cardNumber );
     369           0 :     if (!bForceReload)
     370             :     {
     371             :         // Check whether we've already fetched the row...
     372           0 :         if ( !(m_aRow->get())[0].isNull() && (sal_Int32)(m_aRow->get())[0] == (sal_Int32)cardNumber )
     373           0 :             return sal_True;
     374             :         //Check whether the old row has been changed
     375           0 :         if (cardNumber == m_nUpdatedRow)
     376             :         {
     377             :             //write back the changes first
     378           0 :             if (!pushCard(cardNumber))  //error write back the changes
     379           0 :                 throw SQLException();
     380             :         }
     381             :     }
     382             : //    else
     383             : //        m_aQuery.resyncRow(cardNumber);
     384             : 
     385           0 :     if ( validRow( cardNumber ) == sal_False )
     386           0 :         return sal_False;
     387             : 
     388           0 :     (m_aRow->get())[0] = (sal_Int32)cardNumber;
     389           0 :     sal_Int32 nCount = m_aColumnNames.getLength();
     390             :     //m_RowStates = m_aQuery.getRowStates(cardNumber);
     391           0 :     for( sal_Int32 i = 1; i <= nCount; i++ )
     392             :     {
     393           0 :         if ( (m_aRow->get())[i].isBound() )
     394             :         {
     395             : 
     396             :             // Everything in the addressbook is a string!
     397             : 
     398           0 :             if ( !m_aQueryHelper.getRowValue( (m_aRow->get())[i], cardNumber, m_aColumnNames[i-1], DataType::VARCHAR ))
     399             :             {
     400           0 :                 m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
     401             :             }
     402             :         }
     403             :     }
     404           0 :     return sal_True;
     405             : 
     406             : }
     407             : 
     408             : 
     409           0 : const ORowSetValue& OResultSet::getValue(sal_Int32 cardNumber, sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     410             : {
     411           0 :     if ( fetchRow( cardNumber ) == sal_False )
     412             :     {
     413             :         OSL_FAIL("fetchRow() returned False" );
     414           0 :         m_bWasNull = sal_True;
     415           0 :         return *ODatabaseMetaDataResultSet::getEmptyValue();
     416             :     }
     417             : 
     418           0 :     m_bWasNull = (m_aRow->get())[columnIndex].isNull();
     419           0 :     return (m_aRow->get())[columnIndex];
     420             : 
     421             : }
     422             : 
     423             : 
     424             : 
     425           0 : OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
     426             : {
     427           0 :     ResultSetEntryGuard aGuard( *this );
     428             : 
     429             :     OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
     430             :     OSL_ENSURE(columnIndex <= (sal_Int32)m_xColumns->get().size(), "Trying to access invalid columns number");
     431           0 :     checkIndex( columnIndex );
     432             : 
     433             :     // If this query was sorted then we should have a valid KeySet, so use it
     434           0 :     return getValue(getCurrentCardNumber(), mapColumn( columnIndex ) );
     435             : 
     436             : }
     437             : 
     438             : 
     439           0 : Time SAL_CALL OResultSet::getTime( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     440             : {
     441           0 :     ResultSetEntryGuard aGuard( *this );
     442           0 :     return Time();
     443             : }
     444             : 
     445             : 
     446             : 
     447           0 : DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException, std::exception)
     448             : {
     449           0 :     ResultSetEntryGuard aGuard( *this );
     450           0 :     return DateTime();
     451             : }
     452             : 
     453             : 
     454           0 : sal_Bool SAL_CALL OResultSet::isBeforeFirst(  ) throw(SQLException, RuntimeException, std::exception)
     455             : {
     456           0 :     ResultSetEntryGuard aGuard( *this );
     457             : 
     458             :     // here you have to implement your movements
     459             :     // return true means there is no data
     460             :     OSL_TRACE("In/Out: OResultSet::isBeforeFirst" );
     461           0 :     return( m_nRowPos < 1 );
     462             : }
     463             : 
     464           0 : sal_Bool SAL_CALL OResultSet::isAfterLast(  ) throw(SQLException, RuntimeException, std::exception)
     465             : {
     466             :     SAL_WARN("connectivity.mork", "OResultSet::isAfterLast() NOT IMPLEMENTED!");
     467           0 :     ResultSetEntryGuard aGuard( *this );
     468             : 
     469             :     OSL_TRACE("In/Out: OResultSet::isAfterLast" );
     470             : //    return sal_True;
     471           0 :     return m_nRowPos > currentRowCount() && m_aQueryHelper.queryComplete();
     472             : }
     473             : 
     474           0 : sal_Bool SAL_CALL OResultSet::isFirst(  ) throw(SQLException, RuntimeException, std::exception)
     475             : {
     476           0 :     ResultSetEntryGuard aGuard( *this );
     477             : 
     478             :     OSL_TRACE("In/Out: OResultSet::isFirst" );
     479           0 :     return m_nRowPos == 1;
     480             : }
     481             : 
     482           0 : sal_Bool SAL_CALL OResultSet::isLast(  ) throw(SQLException, RuntimeException, std::exception)
     483             : {
     484             :     SAL_WARN("connectivity.mork", "OResultSet::isLast() NOT IMPLEMENTED!");
     485           0 :     ResultSetEntryGuard aGuard( *this );
     486             : 
     487             :     OSL_TRACE("In/Out: OResultSet::isLast" );
     488             : //    return sal_True;
     489           0 :     return m_nRowPos == currentRowCount() && m_aQueryHelper.queryComplete();
     490             : }
     491             : 
     492           0 : void SAL_CALL OResultSet::beforeFirst(  ) throw(SQLException, RuntimeException, std::exception)
     493             : {
     494           0 :     ResultSetEntryGuard aGuard( *this );
     495             : 
     496             :     // move before the first row so that isBeforeFirst returns false
     497             :     OSL_TRACE("In/Out: OResultSet::beforeFirst" );
     498           0 :     if ( first() )
     499           0 :         previous();
     500           0 : }
     501             : 
     502           0 : void SAL_CALL OResultSet::afterLast(  ) throw(SQLException, RuntimeException, std::exception)
     503             : {
     504           0 :     ResultSetEntryGuard aGuard( *this );
     505             :     OSL_TRACE("In/Out: OResultSet::afterLast" );
     506             : 
     507           0 :     if(last())
     508           0 :         next();
     509           0 : }
     510             : 
     511             : 
     512           0 : void SAL_CALL OResultSet::close() throw(SQLException, RuntimeException, std::exception)
     513             : {
     514             :     OSL_TRACE("In/Out: OResultSet::close" );
     515           0 :     dispose();
     516           0 : }
     517             : 
     518             : 
     519           0 : sal_Bool SAL_CALL OResultSet::first(  ) throw(SQLException, RuntimeException, std::exception)
     520             : {
     521             :     OSL_TRACE("In/Out: OResultSet::first" );
     522           0 :     return seekRow( FIRST_POS );
     523             : }
     524             : 
     525             : 
     526           0 : sal_Bool SAL_CALL OResultSet::last(  ) throw(SQLException, RuntimeException, std::exception)
     527             : {
     528             :     OSL_TRACE("In/Out: OResultSet::last" );
     529           0 :     return seekRow( LAST_POS );
     530             : }
     531             : 
     532           0 : sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
     533             : {
     534             :     OSL_TRACE("In/Out: OResultSet::absolute" );
     535           0 :     return seekRow( ABSOLUTE_POS, row );
     536             : }
     537             : 
     538           0 : sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException, std::exception)
     539             : {
     540             :     OSL_TRACE("In/Out: OResultSet::relative" );
     541           0 :     return seekRow( RELATIVE_POS, row );
     542             : }
     543             : 
     544           0 : sal_Bool SAL_CALL OResultSet::previous(  ) throw(SQLException, RuntimeException, std::exception)
     545             : {
     546           0 :     ResultSetEntryGuard aGuard( *this );
     547             :     OSL_TRACE("In/Out: OResultSet::previous" );
     548           0 :     return seekRow( PRIOR_POS );
     549             : }
     550             : 
     551           0 : Reference< XInterface > SAL_CALL OResultSet::getStatement(  ) throw(SQLException, RuntimeException, std::exception)
     552             : {
     553           0 :     ResultSetEntryGuard aGuard( *this );
     554             : 
     555             :     OSL_TRACE("In/Out: OResultSet::getStatement" );
     556           0 :     return m_xStatement;
     557             : }
     558             : 
     559             : 
     560           0 : sal_Bool SAL_CALL OResultSet::rowDeleted(  ) throw(SQLException, RuntimeException, std::exception)
     561             : {
     562             :     SAL_WARN("connectivity.mork", "OResultSet::rowDeleted() NOT IMPLEMENTED!");
     563           0 :     ResultSetEntryGuard aGuard( *this );
     564             :     OSL_TRACE("In/Out: OResultSet::rowDeleted, m_RowStates=%u",m_RowStates );
     565           0 :     return sal_True;//return ((m_RowStates & RowStates_Deleted) == RowStates_Deleted) ;
     566             : }
     567             : 
     568           0 : sal_Bool SAL_CALL OResultSet::rowInserted(  ) throw(SQLException, RuntimeException, std::exception)
     569             : {
     570             :     SAL_WARN("connectivity.mork", "OResultSet::rowInserted() NOT IMPLEMENTED!");
     571           0 :     ResultSetEntryGuard aGuard( *this );
     572             :     OSL_TRACE("In/Out: OResultSet::rowInserted,m_RowStates=%u",m_RowStates );
     573           0 :     return sal_True;//return ((m_RowStates & RowStates_Inserted) == RowStates_Inserted);
     574             : }
     575             : 
     576           0 : sal_Bool SAL_CALL OResultSet::rowUpdated(  ) throw(SQLException, RuntimeException, std::exception)
     577             : {
     578             :     SAL_WARN("connectivity.mork", "OResultSet::rowUpdated() NOT IMPLEMENTED!");
     579           0 :     ResultSetEntryGuard aGuard( *this );
     580             :     OSL_TRACE("In/Out: OResultSet::rowUpdated,m_RowStates=%u",m_RowStates );
     581           0 :     return sal_True;// return ((m_RowStates & RowStates_Updated) == RowStates_Updated) ;
     582             : }
     583             : 
     584             : 
     585           0 : sal_Bool SAL_CALL OResultSet::next(  ) throw(SQLException, RuntimeException, std::exception)
     586             : {
     587           0 :     return seekRow( NEXT_POS );
     588             : }
     589             : 
     590             : 
     591           0 : sal_Bool SAL_CALL OResultSet::wasNull(  ) throw(SQLException, RuntimeException, std::exception)
     592             : {
     593           0 :     ResultSetEntryGuard aGuard( *this );
     594             : 
     595           0 :     return m_bWasNull;
     596             : }
     597             : 
     598             : 
     599           0 : void SAL_CALL OResultSet::cancel(  ) throw(RuntimeException, std::exception)
     600             : {
     601           0 :     ResultSetEntryGuard aGuard( *this );
     602           0 :     OSL_TRACE("In/Out: OResultSet::cancel" );
     603             : 
     604           0 : }
     605             : 
     606           0 : void SAL_CALL OResultSet::clearWarnings(  ) throw(SQLException, RuntimeException, std::exception)
     607             : {
     608             :     OSL_TRACE("In/Out: OResultSet::clearWarnings" );
     609           0 : }
     610             : 
     611           0 : Any SAL_CALL OResultSet::getWarnings(  ) throw(SQLException, RuntimeException, std::exception)
     612             : {
     613             :     OSL_TRACE("In/Out: OResultSet::getWarnings" );
     614           0 :     return Any();
     615             : }
     616             : 
     617           0 : void SAL_CALL OResultSet::refreshRow(  ) throw(SQLException, RuntimeException, std::exception)
     618             : {
     619             :     OSL_TRACE("In/Out: OResultSet::refreshRow" );
     620           0 :     if (fetchRow(getCurrentCardNumber(),sal_True)) {
     621             :         //force fetch current row will cause we lose all change to the current row
     622           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_REFRESH_ROW, *this );
     623             :     }
     624           0 : }
     625             : 
     626           0 : IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
     627             : {
     628           0 :     Sequence< Property > aProps(5);
     629           0 :     Property* pProperties = aProps.getArray();
     630           0 :     sal_Int32 nPos = 0;
     631           0 :     DECL_PROP0(FETCHDIRECTION,          sal_Int32);
     632           0 :     DECL_PROP0(FETCHSIZE,               sal_Int32);
     633           0 :      DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
     634           0 :     DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
     635           0 :     DECL_PROP1IMPL(RESULTSETTYPE,       sal_Int32) PropertyAttribute::READONLY);
     636             : 
     637           0 :     return new OPropertyArrayHelper(aProps);
     638             : }
     639             : 
     640           0 : IPropertyArrayHelper & OResultSet::getInfoHelper()
     641             : {
     642           0 :     return *const_cast<OResultSet*>(this)->getArrayHelper();
     643             : }
     644             : 
     645           0 : sal_Bool OResultSet::convertFastPropertyValue(
     646             :                             Any & /*rConvertedValue*/,
     647             :                             Any & /*rOldValue*/,
     648             :                             sal_Int32 nHandle,
     649             :                             const Any& /*rValue*/ )
     650             :                                 throw (::com::sun::star::lang::IllegalArgumentException)
     651             : {
     652             :     OSL_FAIL( "OResultSet::convertFastPropertyValue: not implemented!" );
     653           0 :     switch(nHandle)
     654             :     {
     655             :         case PROPERTY_ID_ISBOOKMARKABLE:
     656             :         case PROPERTY_ID_RESULTSETCONCURRENCY:
     657             :         case PROPERTY_ID_RESULTSETTYPE:
     658           0 :             throw ::com::sun::star::lang::IllegalArgumentException();
     659             :         case PROPERTY_ID_FETCHDIRECTION:
     660             :         case PROPERTY_ID_FETCHSIZE:
     661             :         default:
     662             :             ;
     663             :     }
     664           0 :     return sal_False;
     665             : }
     666             : 
     667           0 : void OResultSet::setFastPropertyValue_NoBroadcast(
     668             :                                 sal_Int32 nHandle,
     669             :                                 const Any& /*rValue*/
     670             :                                                  )
     671             :                                                  throw (Exception, std::exception)
     672             : {
     673             :     OSL_FAIL( "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" );
     674           0 :     switch(nHandle)
     675             :     {
     676             :         case PROPERTY_ID_ISBOOKMARKABLE:
     677             :         case PROPERTY_ID_RESULTSETCONCURRENCY:
     678             :         case PROPERTY_ID_RESULTSETTYPE:
     679           0 :             throw Exception();
     680             :         case PROPERTY_ID_FETCHDIRECTION:
     681           0 :             break;
     682             :         case PROPERTY_ID_FETCHSIZE:
     683           0 :             break;
     684             :         default:
     685             :             ;
     686             :     }
     687           0 : }
     688             : 
     689           0 : void OResultSet::getFastPropertyValue(
     690             :                                 Any& rValue,
     691             :                                 sal_Int32 nHandle
     692             :                                      ) const
     693             : {
     694           0 :     switch(nHandle)
     695             :     {
     696             :         case PROPERTY_ID_RESULTSETCONCURRENCY:
     697           0 :             rValue <<= (sal_Int32)m_nResultSetConcurrency;
     698           0 :             break;
     699             :         case PROPERTY_ID_RESULTSETTYPE:
     700           0 :             rValue <<= m_nResultSetType;
     701           0 :             break;
     702             :         case PROPERTY_ID_FETCHDIRECTION:
     703           0 :             rValue <<= m_nFetchDirection;
     704           0 :             break;
     705             :         case PROPERTY_ID_FETCHSIZE:
     706           0 :             rValue <<= m_nFetchSize;
     707           0 :             break;
     708             :         case PROPERTY_ID_ISBOOKMARKABLE:
     709           0 :             const_cast< OResultSet* >( this )->determineReadOnly();
     710           0 :             rValue <<= !m_bIsReadOnly;
     711           0 :          break;
     712             :     }
     713           0 : }
     714             : 
     715           0 : void SAL_CALL OResultSet::acquire() throw()
     716             : {
     717           0 :     OResultSet_BASE::acquire();
     718           0 : }
     719             : 
     720           0 : void SAL_CALL OResultSet::release() throw()
     721             : {
     722           0 :     OResultSet_BASE::release();
     723           0 : }
     724             : 
     725           0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     726             : {
     727           0 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     728             : }
     729             : 
     730             : 
     731           0 : void OResultSet::parseParameter( const OSQLParseNode* pNode, OUString& rMatchString )
     732             : {
     733             :     OSL_ENSURE(pNode->count() > 0,"Error parsing parameter in Parse Tree");
     734           0 :     OSQLParseNode *pMark = pNode->getChild(0);
     735             : 
     736             :     // Initialize to empty string
     737           0 :     rMatchString = "";
     738             : 
     739           0 :     OUString aParameterName;
     740           0 :     if (SQL_ISPUNCTUATION(pMark,"?")) {
     741           0 :         aParameterName = "?";
     742             :     }
     743           0 :     else if (SQL_ISPUNCTUATION(pMark,":")) {
     744           0 :         aParameterName = pNode->getChild(1)->getTokenValue();
     745             :     }
     746             :     // XXX - Now we know name, what's value????
     747           0 :     m_nParamIndex ++;
     748             :     OSL_TRACE("Parameter name [%d]: %s", m_nParamIndex,OUtoCStr(aParameterName) );
     749             : 
     750           0 :     if ( m_aParameterRow.is() ) {
     751             :         OSL_ENSURE( m_nParamIndex < (sal_Int32)m_aParameterRow->get().size() + 1, "More parameters than values found" );
     752           0 :         rMatchString = (m_aParameterRow->get())[(sal_uInt16)m_nParamIndex];
     753             : #if OSL_DEBUG_LEVEL > 0
     754             :         OSL_TRACE("Prop Value       : %s", OUtoCStr( rMatchString ) );
     755             : #endif
     756           0 :     }
     757             : #if OSL_DEBUG_LEVEL > 0
     758             :     else {
     759             :         OSL_TRACE("Prop Value       : Invalid ParameterRow!" );
     760             :     }
     761             : #endif
     762           0 : }
     763             : 
     764             : #define WILDCARD "%"
     765             : #define ALT_WILDCARD "*"
     766             : static const sal_Unicode MATCHCHAR = '_';
     767             : 
     768           0 : void OResultSet::analyseWhereClause( const OSQLParseNode*                 parseTree,
     769             :                                      MQueryExpression                     &queryExpression)
     770             : {
     771           0 :     OUString         columnName;
     772           0 :     MQueryOp::cond_type     op( MQueryOp::Is );
     773           0 :     OUString         matchString;
     774             : 
     775           0 :     if ( parseTree == NULL )
     776           0 :         return;
     777             : 
     778           0 :     if ( m_pSQLIterator->getParseTree() != NULL ) {
     779           0 :         ::rtl::Reference<OSQLColumns> xColumns = m_pSQLIterator->getParameters();
     780           0 :         if(xColumns.is())
     781             :         {
     782           0 :             OUString aColName, aParameterValue;
     783           0 :             OSQLColumns::Vector::iterator aIter = xColumns->get().begin();
     784           0 :             sal_Int32 i = 1;
     785           0 :             for(;aIter != xColumns->get().end();++aIter)
     786             :             {
     787           0 :                 (*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= aColName;
     788             :                 OSL_TRACE("Prop Column Name : %s", OUtoCStr( aColName ) );
     789           0 :                 if ( m_aParameterRow.is() ) {
     790           0 :                     aParameterValue = (m_aParameterRow->get())[(sal_uInt16)i];
     791             : #if OSL_DEBUG_LEVEL > 0
     792             :                     OSL_TRACE("Prop Value       : %s", OUtoCStr( aParameterValue ) );
     793             : #endif
     794             :                 }
     795             : #if OSL_DEBUG_LEVEL > 0
     796             :                 else {
     797             :                     OSL_TRACE("Prop Value       : Invalid ParameterRow!" );
     798             :                 }
     799             : #endif
     800           0 :                 i++;
     801           0 :             }
     802           0 :         }
     803             : 
     804             :     }
     805             : 
     806           0 :     if ( SQL_ISRULE(parseTree,where_clause) )
     807             :     {
     808             :         OSL_TRACE("analyseSQL : Got WHERE clause");
     809             :         // Reset Parameter Counter
     810           0 :         resetParameters();
     811           0 :         analyseWhereClause( parseTree->getChild( 1 ), queryExpression );
     812             :     }
     813           0 :     else if ( parseTree->count() == 3 &&                         // Handle ()'s
     814           0 :         SQL_ISPUNCTUATION(parseTree->getChild(0),"(") &&
     815           0 :         SQL_ISPUNCTUATION(parseTree->getChild(2),")"))
     816             :     {
     817             : 
     818             :         OSL_TRACE("analyseSQL : Got Punctuation ()");
     819           0 :         MQueryExpression *subExpression = new MQueryExpression();
     820           0 :         analyseWhereClause( parseTree->getChild( 1 ), *subExpression );
     821           0 :         queryExpression.getExpressions().push_back( subExpression );
     822             :     }
     823           0 :     else if ((SQL_ISRULE(parseTree,search_condition) || (SQL_ISRULE(parseTree,boolean_term)))
     824           0 :              && parseTree->count() == 3)                   // Handle AND/OR
     825             :     {
     826             : 
     827             :         OSL_TRACE("analyseSQL : Got AND/OR clause");
     828             : 
     829             :         // TODO - Need to take care or AND, for now match is always OR
     830           0 :         analyseWhereClause( parseTree->getChild( 0 ), queryExpression );
     831           0 :         analyseWhereClause( parseTree->getChild( 2 ), queryExpression );
     832             : 
     833           0 :         if (SQL_ISTOKEN(parseTree->getChild(1),OR)) {         // OR-Operator
     834           0 :             queryExpression.setExpressionCondition( MQueryExpression::OR );
     835             :         }
     836           0 :         else if (SQL_ISTOKEN(parseTree->getChild(1),AND)) {  // AND-Operator
     837           0 :             queryExpression.setExpressionCondition( MQueryExpression::AND );
     838             :         }
     839             :         else {
     840             :             OSL_FAIL("analyseSQL: Error in Parse Tree");
     841             :         }
     842             :     }
     843           0 :     else if (SQL_ISRULE(parseTree,comparison_predicate))
     844             :     {
     845             :         OSL_ENSURE(parseTree->count() == 3, "Error parsing COMPARE predicate");
     846           0 :         if (!(SQL_ISRULE(parseTree->getChild(0),column_ref) ||
     847           0 :           parseTree->getChild(2)->getNodeType() == SQL_NODE_STRING ||
     848           0 :           parseTree->getChild(2)->getNodeType() == SQL_NODE_INTNUM ||
     849           0 :           parseTree->getChild(2)->getNodeType() == SQL_NODE_APPROXNUM ||
     850           0 :           SQL_ISTOKEN(parseTree->getChild(2),TRUE) ||
     851           0 :           SQL_ISTOKEN(parseTree->getChild(2),FALSE) ||
     852           0 :           SQL_ISRULE(parseTree->getChild(2),parameter) ||
     853             :           // odbc date
     854           0 :           (SQL_ISRULE(parseTree->getChild(2),set_fct_spec) && SQL_ISPUNCTUATION(parseTree->getChild(2)->getChild(0),"{"))))
     855             :         {
     856           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
     857             :         }
     858             : 
     859           0 :         OSQLParseNode *pPrec = parseTree->getChild(1);
     860           0 :         if (pPrec->getNodeType() == SQL_NODE_EQUAL)
     861           0 :             op = MQueryOp::Is;
     862           0 :         else if (pPrec->getNodeType() == SQL_NODE_NOTEQUAL)
     863           0 :             op = MQueryOp::IsNot;
     864             : 
     865           0 :         OUString sTableRange;
     866           0 :         if(SQL_ISRULE(parseTree->getChild(0),column_ref))
     867           0 :             m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
     868           0 :         else if(parseTree->getChild(0)->isToken())
     869           0 :             columnName = parseTree->getChild(0)->getTokenValue();
     870             : 
     871           0 :         if ( SQL_ISRULE(parseTree->getChild(2),parameter) ) {
     872           0 :             parseParameter( parseTree->getChild(2), matchString );
     873             :         }
     874             :         else {
     875           0 :             matchString = parseTree->getChild(2)->getTokenValue();
     876             :         }
     877             : 
     878           0 :         if ( columnName.equalsAscii("0") && op == MQueryOp::Is &&
     879           0 :              matchString.equalsAscii("1") ) {
     880             :             OSL_TRACE("Query always evaluates to FALSE");
     881           0 :             m_bIsAlwaysFalseQuery = sal_True;
     882             :         }
     883           0 :         queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
     884             :     }
     885           0 :     else if (SQL_ISRULE(parseTree,like_predicate))
     886             :     {
     887             :         OSL_ENSURE(parseTree->count() == 2, "Error parsing LIKE predicate");
     888             : 
     889             :         OSL_TRACE("analyseSQL : Got LIKE rule");
     890             : 
     891           0 :         if ( !(SQL_ISRULE(parseTree->getChild(0), column_ref)) )
     892             :         {
     893           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_COLUMN, *this );
     894             :         }
     895             : 
     896             : 
     897             :         OSQLParseNode *pColumn;
     898             :         OSQLParseNode *pAtom;
     899             :         OSQLParseNode *pOptEscape;
     900           0 :         const OSQLParseNode* pPart2 = parseTree->getChild(1);
     901           0 :         pColumn     = parseTree->getChild(0);                        // Match Item
     902           0 :         pAtom       = pPart2->getChild(static_cast<sal_uInt32>(pPart2->count()-2));     // Match String
     903           0 :         pOptEscape  = pPart2->getChild(static_cast<sal_uInt32>(pPart2->count()-1));     // Opt Escape Rule
     904             :         (void)pOptEscape;
     905           0 :         const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT);
     906             : 
     907           0 :         if (!(pAtom->getNodeType() == SQL_NODE_STRING ||
     908           0 :               pAtom->getNodeType() == SQL_NODE_NAME ||
     909           0 :               SQL_ISRULE(pAtom,parameter) ||
     910           0 :               ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_NAME ) ||
     911           0 :               ( pAtom->getChild(0) && pAtom->getChild(0)->getNodeType() == SQL_NODE_STRING )
     912           0 :               ) )
     913             :         {
     914             :             OSL_TRACE("analyseSQL : pAtom->count() = %zu", pAtom->count() );
     915             : 
     916           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_LIKE_STRING, *this );
     917             :         }
     918             : 
     919           0 :         OUString sTableRange;
     920           0 :         if(SQL_ISRULE(pColumn,column_ref))
     921           0 :             m_pSQLIterator->getColumnRange(pColumn,columnName,sTableRange);
     922             : 
     923             :         OSL_TRACE("ColumnName = %s", OUtoCStr( columnName ) );
     924             : 
     925           0 :         if ( SQL_ISRULE(pAtom,parameter) ) {
     926           0 :             parseParameter( pAtom, matchString );
     927             :             // Replace all '*' with '%' : UI Usually does this but not with
     928             :             // Parameters for some reason.
     929           0 :             matchString = matchString.replaceAll( ALT_WILDCARD, WILDCARD );
     930             :         }
     931             :         else
     932             :         {
     933           0 :             matchString = pAtom->getTokenValue();
     934             :         }
     935             : 
     936             :         // Determine where '%' character is...
     937             : 
     938           0 :         if ( matchString == WILDCARD )
     939             :         {
     940             :             // String containing only a '%' and nothing else
     941           0 :             op = MQueryOp::Exists;
     942             :             // Will be ignored for Exists case, but clear anyway.
     943           0 :             matchString = "";
     944             :         }
     945           0 :         else if ( matchString.indexOf ( WILDCARD ) == -1 &&
     946           0 :              matchString.indexOf ( MATCHCHAR ) == -1 )
     947             :         {
     948             :             // Simple string , eg. "to match"
     949           0 :             if ( bNot )
     950           0 :                 op = MQueryOp::DoesNotContain;
     951             :             else
     952           0 :                 op = MQueryOp::Contains;
     953             :         }
     954           0 :         else if (  matchString.startsWith( WILDCARD )
     955           0 :                    && matchString.endsWith( WILDCARD )
     956           0 :                    && matchString.indexOf ( WILDCARD, 1 ) == matchString.lastIndexOf ( WILDCARD )
     957           0 :                    && matchString.indexOf( MATCHCHAR ) == -1
     958             :                  )
     959             :         {
     960             :             // Relatively simple "%string%" - ie, contains...
     961             :             // Cut '%'  from front and rear
     962           0 :             matchString = matchString.replaceAt( 0, 1, OUString() );
     963           0 :             matchString = matchString.replaceAt( matchString.getLength() -1 , 1, OUString() );
     964             : 
     965           0 :             if (bNot)
     966           0 :                 op = MQueryOp::DoesNotContain;
     967             :             else
     968           0 :                 op = MQueryOp::Contains;
     969             :         }
     970           0 :         else if ( bNot )
     971             :         {
     972             :             // We currently can't handle a 'NOT LIKE' when there are '%' or
     973             :             // '_' dispersed throughout
     974           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_NOT_LIKE_TOO_COMPLEX, *this );
     975             :         }
     976             :         else
     977             :         {
     978           0 :             if ( (matchString.indexOf ( WILDCARD ) == matchString.lastIndexOf ( WILDCARD ))
     979           0 :                   && matchString.indexOf( MATCHCHAR ) == -1
     980             :                 )
     981             :             {
     982             :                 // One occurrence of '%' - no '_' matches...
     983           0 :                 if ( matchString.startsWith( WILDCARD ) )
     984             :                 {
     985           0 :                     op = MQueryOp::EndsWith;
     986           0 :                     matchString = matchString.replaceAt( 0, 1, OUString());
     987             :                 }
     988           0 :                 else if ( matchString.indexOf ( WILDCARD ) == matchString.getLength() -1 )
     989             :                 {
     990           0 :                     op = MQueryOp::BeginsWith;
     991           0 :                     matchString = matchString.replaceAt( matchString.getLength() -1 , 1, OUString() );
     992             :                 }
     993             :                 else
     994             :                 {
     995           0 :                     sal_Int32 pos = matchString.indexOf ( WILDCARD );
     996           0 :                     matchString = matchString.replaceAt( pos, 1, ".*" );
     997           0 :                     op = MQueryOp::RegExp;
     998             :                 }
     999             : 
    1000             :             }
    1001             :             else
    1002             :             {
    1003             :                 // Most Complex, need to use an RE
    1004             :                 sal_Int32 pos;
    1005           0 :                 while ( (pos = matchString.indexOf ( WILDCARD )) != -1 )
    1006             :                 {
    1007           0 :                     matchString = matchString.replaceAt( pos, 1, OUString(".*") );
    1008             :                 }
    1009             : 
    1010           0 :                 while ( (pos = matchString.indexOf( MATCHCHAR )) != -1 )
    1011             :                 {
    1012           0 :                     matchString = matchString.replaceAt( pos, 1, OUString(".") );
    1013             :                 }
    1014             : 
    1015           0 :                 op = MQueryOp::RegExp;
    1016             :             }
    1017             :         }
    1018             : 
    1019           0 :         queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op, matchString ));
    1020             :     }
    1021           0 :     else if (SQL_ISRULE(parseTree,test_for_null))
    1022             :     {
    1023             :         OSL_ENSURE(parseTree->count() == 2,"Error in ParseTree");
    1024           0 :         const OSQLParseNode* pPart2 = parseTree->getChild(1);
    1025             :         OSL_ENSURE(SQL_ISTOKEN(pPart2->getChild(0),IS),"Error in ParseTree");
    1026             : 
    1027           0 :         if (!SQL_ISRULE(parseTree->getChild(0),column_ref))
    1028             :         {
    1029           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_INVALID_IS_NULL_COLUMN, *this );
    1030             :         }
    1031             : 
    1032           0 :         if (SQL_ISTOKEN(pPart2->getChild(1),NOT))
    1033             :         {
    1034           0 :             op = MQueryOp::Exists;
    1035             :         }
    1036             :         else
    1037             :         {
    1038           0 :             op = MQueryOp::DoesNotExist;
    1039             :         }
    1040             : 
    1041           0 :         OUString sTableRange;
    1042           0 :         m_pSQLIterator->getColumnRange(parseTree->getChild(0),columnName,sTableRange);
    1043             : 
    1044           0 :         queryExpression.getExpressions().push_back( new MQueryExpressionString( columnName, op ));
    1045             :     }
    1046             :     else
    1047             :     {
    1048             :         OSL_TRACE( "Unexpected statement!!!" );
    1049             : 
    1050           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
    1051           0 :     }
    1052             : }
    1053             : 
    1054             : 
    1055             : 
    1056           0 : void OResultSet::fillRowData()
    1057             :     throw( ::com::sun::star::sdbc::SQLException )
    1058             : {
    1059             :     OSL_ENSURE( m_pStatement, "Require a statement" );
    1060             : 
    1061           0 :     MQueryExpression queryExpression;
    1062             : 
    1063           0 :     OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
    1064           0 :     m_xColumns = m_pSQLIterator->getSelectColumns();
    1065             : 
    1066             :     OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
    1067             : 
    1068           0 :     OSQLColumns::Vector::const_iterator aIter = m_xColumns->get().begin();
    1069           0 :     const OUString sProprtyName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
    1070           0 :     OUString sName;
    1071           0 :     m_aAttributeStrings.clear();
    1072           0 :     m_aAttributeStrings.reserve(m_xColumns->get().size());
    1073           0 :     for (sal_Int32 i = 1; aIter != m_xColumns->get().end();++aIter, i++)
    1074             :     {
    1075           0 :         (*aIter)->getPropertyValue(sProprtyName) >>= sName;
    1076             : #if OSL_DEBUG_LEVEL > 0
    1077             :         OSL_TRACE("Query Columns : (%d) %s", i, OUtoCStr(sName) );
    1078             : #endif
    1079           0 :         m_aAttributeStrings.push_back( sName );
    1080             :     }
    1081             : 
    1082             :     // Generate Match Conditions for Query
    1083           0 :     const OSQLParseNode*  pParseTree = m_pSQLIterator->getWhereTree();
    1084             : 
    1085           0 :     m_bIsAlwaysFalseQuery = sal_False;
    1086           0 :     if ( pParseTree != NULL )
    1087             :     {
    1088             :         // Extract required info
    1089             : 
    1090             :         OSL_TRACE("\tHave a Where Clause");
    1091             : 
    1092           0 :         analyseWhereClause( pParseTree, queryExpression );
    1093             :     }
    1094             :     // If the query is a 0=1 then set Row count to 0 and return
    1095           0 :     if ( m_bIsAlwaysFalseQuery )
    1096             :     {
    1097           0 :         m_bIsReadOnly = 1;
    1098           0 :         return;
    1099             :     }
    1100             : 
    1101           0 :     m_aQueryHelper.setExpression( queryExpression );
    1102             : 
    1103           0 :     OUString aStr(  m_pTable->getName() );
    1104           0 :     m_aQueryHelper.setAddressbook( aStr );
    1105             : 
    1106           0 :     sal_Int32 rv = m_aQueryHelper.executeQuery(xConnection);
    1107           0 :     if ( rv == -1 ) {
    1108           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ERR_EXECUTING_QUERY, *this );
    1109             :     }
    1110             : 
    1111           0 :     if (m_aQueryHelper.hadError())
    1112             :     {
    1113           0 :         m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
    1114             :     }
    1115             : 
    1116             :     //determine whether the address book is readonly
    1117           0 :     determineReadOnly();
    1118             : 
    1119             : #if OSL_DEBUG_LEVEL > 0
    1120             :     OSL_TRACE( "executeQuery returned %d", rv );
    1121             : 
    1122             :     OSL_TRACE( "\tOUT OResultSet::fillRowData()" );
    1123             : #endif
    1124             : }
    1125             : 
    1126             : 
    1127           0 : static sal_Bool matchRow( OValueRow& row1, OValueRow& row2 )
    1128             : {
    1129           0 :     OValueVector::Vector::iterator row1Iter = row1->get().begin();
    1130           0 :     OValueVector::Vector::iterator row2Iter = row2->get().begin();
    1131           0 :     for ( ++row1Iter,++row2Iter; // the first column is the bookmark column
    1132           0 :           row1Iter != row1->get().end(); ++row1Iter,++row2Iter)
    1133             :     {
    1134           0 :         if ( row1Iter->isBound())
    1135             :         {
    1136             :             // Compare values, if at anytime there's a mismatch return false
    1137           0 :             if ( !( (*row1Iter) == (*row2Iter) ) )
    1138           0 :                 return sal_False;
    1139             :         }
    1140             :     }
    1141             : 
    1142             :     // If we get to here the rows match
    1143           0 :     return sal_True;
    1144             : }
    1145             : 
    1146           0 : sal_Int32 OResultSet::getRowForCardNumber(sal_Int32 nCardNum)
    1147             : {
    1148             :     OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, nCardNum = %u", nCardNum );
    1149             : 
    1150           0 :     if ( m_pKeySet.is() )
    1151             :     {
    1152             :         sal_Int32  nPos;
    1153           0 :         for(nPos=0;nPos < (sal_Int32)m_pKeySet->get().size();nPos++)
    1154             :         {
    1155           0 :             if (nCardNum == (m_pKeySet->get())[nPos])
    1156             :             {
    1157             :                 OSL_TRACE("In/Out: OResultSet::getRowForCardNumber, return = %u", nPos+1 );
    1158           0 :                 return nPos+1;
    1159             :             }
    1160             :         }
    1161             :     }
    1162             : 
    1163           0 :     m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
    1164             : 
    1165           0 :     return 0;
    1166             : }
    1167             : 
    1168             : 
    1169           0 : void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLException,
    1170             :                                                 ::com::sun::star::uno::RuntimeException)
    1171             : {
    1172           0 :     ResultSetEntryGuard aGuard( *this );
    1173             : 
    1174             :     OSL_ENSURE( m_pTable, "Need a Table object");
    1175           0 :     if(!m_pTable)
    1176             :     {
    1177           0 :         const OSQLTables& xTabs = m_pSQLIterator->getTables();
    1178           0 :         if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
    1179           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
    1180             : 
    1181           0 :         m_pTable = static_cast< OTable* > ((xTabs.begin()->second).get());
    1182             : 
    1183             :     }
    1184             : 
    1185           0 :     m_nRowPos = 0;
    1186             : 
    1187           0 :     fillRowData();
    1188             : 
    1189             :     OSL_ENSURE(m_xColumns.is(), "Need the Columns!!");
    1190             : 
    1191           0 :     switch( m_pSQLIterator->getStatementType() )
    1192             :     {
    1193             :         case SQL_STATEMENT_SELECT:
    1194             :         {
    1195           0 :             if(m_bIsAlwaysFalseQuery) {
    1196           0 :                 break;
    1197             :             }
    1198           0 :             else if(isCount())
    1199             :             {
    1200           0 :                 m_pStatement->getOwnConnection()->throwSQLException( STR_NO_COUNT_SUPPORT, *this );
    1201             :             }
    1202             :             else
    1203             :             {
    1204           0 :                 sal_Bool bDistinct = sal_False;
    1205           0 :                 OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
    1206           0 :                 if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT)
    1207             :                 {
    1208           0 :                     if(!IsSorted())
    1209             :                     {
    1210           0 :                         m_aOrderbyColumnNumber.push_back(m_aColMapping[1]);
    1211           0 :                         m_aOrderbyAscending.push_back(SQL_DESC);
    1212             :                     }
    1213           0 :                     bDistinct = sal_True;
    1214             :                 }
    1215             : 
    1216           0 :                 OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
    1217           0 :                 ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
    1218           0 :                 for ( ::std::vector<sal_Int16>::size_type i = 0; aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
    1219             :                 {
    1220             :                     OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
    1221           0 :                     switch ((m_aRow->get().begin()+*aOrderByIter)->getTypeKind())
    1222             :                     {
    1223             :                     case DataType::CHAR:
    1224             :                         case DataType::VARCHAR:
    1225           0 :                             eKeyType[i] = SQL_ORDERBYKEY_STRING;
    1226           0 :                             break;
    1227             : 
    1228             :                         case DataType::OTHER:
    1229             :                         case DataType::TINYINT:
    1230             :                         case DataType::SMALLINT:
    1231             :                         case DataType::INTEGER:
    1232             :                         case DataType::DECIMAL:
    1233             :                         case DataType::NUMERIC:
    1234             :                         case DataType::REAL:
    1235             :                         case DataType::DOUBLE:
    1236             :                         case DataType::DATE:
    1237             :                         case DataType::TIME:
    1238             :                         case DataType::TIMESTAMP:
    1239             :                         case DataType::BIT:
    1240           0 :                             eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
    1241           0 :                             break;
    1242             : 
    1243             :                     // Other types aren't implemented (so they are always FALSE)
    1244             :                         default:
    1245           0 :                             eKeyType[i] = SQL_ORDERBYKEY_NONE;
    1246             :                             OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented");
    1247           0 :                             break;
    1248             :                     }
    1249             :                 }
    1250             : 
    1251           0 :                 if (IsSorted())
    1252             :                 {
    1253             :                     // Implement Sorting
    1254             : 
    1255             :                     // So that we can sort we need to wait until the executed
    1256             :                     // query to the mozilla addressbooks has returned all
    1257             :                     // values.
    1258             : 
    1259             :                     OSL_TRACE("Query is to be sorted");
    1260             : 
    1261             :                     OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!");
    1262             : 
    1263           0 :                     m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
    1264             : 
    1265             :                     OSL_TRACE("OrderbyColumnNumber->size() = %zu",m_aOrderbyColumnNumber.size());
    1266             : #if OSL_DEBUG_LEVEL > 0
    1267             :                     for ( ::std::vector<sal_Int32>::size_type i = 0; i < m_aColMapping.size(); i++ )
    1268             :                         OSL_TRACE("Mapped: %d -> %d", i, m_aColMapping[i] );
    1269             : #endif
    1270           0 :                     for ( sal_Int32 nRow = 1; nRow <= m_aQueryHelper.getResultCount(); nRow++ ) {
    1271             : 
    1272           0 :                         OKeyValue* pKeyValue = OKeyValue::createKeyValue((nRow));
    1273             : 
    1274           0 :                         ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin();
    1275           0 :                         for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter)
    1276             :                         {
    1277           0 :                             const ORowSetValue& value = getValue(nRow, *aIter);
    1278             : 
    1279             :                             OSL_TRACE( "Adding Value: (%d,%d) : %s", nRow, *aIter,OUtoCStr( value ));
    1280             : 
    1281           0 :                             pKeyValue->pushKey(new ORowSetValueDecorator(value));
    1282             :                         }
    1283             : 
    1284           0 :                         m_pSortIndex->AddKeyValue( pKeyValue );
    1285             :                     }
    1286             : 
    1287           0 :                     m_pKeySet = m_pSortIndex->CreateKeySet();
    1288           0 :                     m_CurrentRowCount = static_cast<sal_Int32>(m_pKeySet->get().size());
    1289             : #if OSL_DEBUG_LEVEL > 0
    1290             :                     for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
    1291             :                         OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] );
    1292             : #endif
    1293             : 
    1294           0 :                     m_pSortIndex = NULL;
    1295           0 :                     beforeFirst(); // Go back to start
    1296             :                 }
    1297             :                 else  //we always need m_pKeySet now
    1298           0 :                     m_pKeySet = new OKeySet();
    1299             : 
    1300             :                 // Handle the DISTINCT case
    1301           0 :                 if ( bDistinct && m_pKeySet.is() )
    1302             :                 {
    1303           0 :                     OValueRow aSearchRow = new OValueVector( m_aRow->get().size() );
    1304             : 
    1305           0 :                     for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
    1306             :                     {
    1307           0 :                         fetchRow( (m_pKeySet->get())[i] );        // Fills m_aRow
    1308           0 :                         if ( matchRow( m_aRow, aSearchRow ) )
    1309             :                         {
    1310           0 :                             (m_pKeySet->get())[i] = 0;   // Marker for later to be removed
    1311             :                         }
    1312             :                         else
    1313             :                         {
    1314             :                             // They don't match, so it's not a duplicate.
    1315             :                             // Use the current Row as the next one to match against
    1316           0 :                             *aSearchRow = *m_aRow;
    1317             :                         }
    1318             :                     }
    1319             :                     // Now remove any keys marked with a 0
    1320           0 :                     m_pKeySet->get().erase(::std::remove_if(m_pKeySet->get().begin(),m_pKeySet->get().end()
    1321             :                                     ,::std::bind2nd(::std::equal_to<sal_Int32>(),0))
    1322           0 :                                      ,m_pKeySet->get().end());
    1323             : 
    1324           0 :                 }
    1325             :             }
    1326           0 :         }   break;
    1327             : 
    1328             :         case SQL_STATEMENT_UPDATE:
    1329             :         case SQL_STATEMENT_DELETE:
    1330             :         case SQL_STATEMENT_INSERT:
    1331           0 :             break;
    1332             :         default:
    1333           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_STMT_TYPE_NOT_SUPPORTED, *this );
    1334           0 :             break;
    1335           0 :     }
    1336           0 : }
    1337             : 
    1338             : 
    1339             : 
    1340             : 
    1341           0 : void OResultSet::setBoundedColumns(const OValueRow& _rRow,
    1342             :                                    const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
    1343             :                                    const Reference<XIndexAccess>& _xNames,
    1344             :                                    sal_Bool _bSetColumnMapping,
    1345             :                                    const Reference<XDatabaseMetaData>& _xMetaData,
    1346             :                                    ::std::vector<sal_Int32>& _rColMapping)
    1347             : {
    1348           0 :     ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
    1349             : 
    1350           0 :     Reference<XPropertySet> xTableColumn;
    1351           0 :     OUString sTableColumnName, sSelectColumnRealName;
    1352             : 
    1353           0 :     const OUString sName     = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
    1354           0 :     const OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
    1355             : 
    1356           0 :     ::std::vector< OUString> aColumnNames;
    1357           0 :     aColumnNames.reserve(_rxColumns->get().size());
    1358           0 :     OValueVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
    1359           0 :     for (sal_Int32 i=0; // the first column is the bookmark column
    1360           0 :          aRowIter != _rRow->get().end();
    1361             :             ++i, ++aRowIter
    1362             :         )
    1363             :     {
    1364             :         try
    1365             :         {
    1366             :             // get the table column and its name
    1367           0 :             _xNames->getByIndex(i) >>= xTableColumn;
    1368             :             OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
    1369           0 :             if (xTableColumn.is())
    1370           0 :                 xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
    1371             :             else
    1372           0 :                 sTableColumnName = "";
    1373             : 
    1374             :             // look if we have such a select column
    1375             :             // TODO: would like to have a O(log n) search here ...
    1376           0 :             sal_Int32 nColumnPos = 0;
    1377           0 :             for (   OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
    1378           0 :                     aIter != _rxColumns->get().end();
    1379             :                     ++aIter,++nColumnPos
    1380             :                 )
    1381             :             {
    1382           0 :                 if ( nColumnPos < (sal_Int32)aColumnNames.size() )
    1383           0 :                     sSelectColumnRealName = aColumnNames[nColumnPos];
    1384             :                 else
    1385             :                 {
    1386           0 :                     if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
    1387           0 :                         (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
    1388             :                     else
    1389           0 :                         (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
    1390           0 :                     aColumnNames.push_back(sSelectColumnRealName);
    1391             :                 }
    1392             : 
    1393           0 :                 if (aCase(sTableColumnName, sSelectColumnRealName))
    1394             :                 {
    1395           0 :                     if(_bSetColumnMapping)
    1396             :                     {
    1397           0 :                         sal_Int32 nSelectColumnPos = static_cast<sal_Int32>(aIter - _rxColumns->get().begin() + 1);
    1398             :                             // the getXXX methods are 1-based ...
    1399           0 :                         sal_Int32 nTableColumnPos = i + 1;
    1400             :                             // get first table column is the bookmark column
    1401             : 
    1402             : #if OSL_DEBUG_LEVEL > 0
    1403             :                         OSL_TRACE("Set Col Mapping: %d -> %d", nSelectColumnPos, nTableColumnPos );
    1404             : #endif
    1405           0 :                         _rColMapping[nSelectColumnPos] = nTableColumnPos;
    1406             :                     }
    1407             : 
    1408           0 :                     aRowIter->setBound(true);
    1409           0 :                     aRowIter->setTypeKind(DataType::VARCHAR);
    1410             :                 }
    1411             :             }
    1412             :         }
    1413           0 :         catch (Exception&)
    1414             :         {
    1415             :             OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!");
    1416             :         }
    1417           0 :     }
    1418           0 : }
    1419             : 
    1420             : 
    1421             : 
    1422           0 : sal_Bool OResultSet::isCount() const
    1423             : {
    1424           0 :     return (m_pParseTree &&
    1425           0 :             m_pParseTree->count() > 2                                                       &&
    1426           0 :             SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist)                      &&
    1427           0 :             SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column)               &&
    1428           0 :             SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
    1429           0 :             m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
    1430           0 :             );
    1431             : }
    1432             : 
    1433             : 
    1434             : 
    1435             : // Check for valid row in m_aQuery
    1436             : 
    1437           0 : sal_Bool OResultSet::validRow( sal_uInt32 nRow)
    1438             : {
    1439           0 :     sal_Int32  nNumberOfRecords = m_aQueryHelper.getResultCount();
    1440             : 
    1441           0 :     while ( nRow > (sal_uInt32)nNumberOfRecords && !m_aQueryHelper.queryComplete() ) {
    1442             : #if OSL_DEBUG_LEVEL > 0
    1443             :             OSL_TRACE("validRow: waiting...");
    1444             : #endif
    1445           0 :             if (m_aQueryHelper.checkRowAvailable( nRow ) == sal_False)
    1446             :             {
    1447             :                 OSL_TRACE("validRow(%u): return False", nRow);
    1448           0 :                 return sal_False;
    1449             :             }
    1450             : 
    1451           0 :             if ( m_aQueryHelper.hadError() )
    1452             :             {
    1453           0 :                 m_pStatement->getOwnConnection()->throwSQLException( m_aQueryHelper.getError(), *this );
    1454             :             }
    1455             : 
    1456           0 :             nNumberOfRecords = m_aQueryHelper.getResultCount();
    1457             :     }
    1458             : 
    1459           0 :     if (( nRow == 0 ) ||
    1460           0 :         ( nRow > (sal_uInt32)nNumberOfRecords && m_aQueryHelper.queryComplete()) ){
    1461             :         OSL_TRACE("validRow(%u): return False", nRow);
    1462           0 :         return sal_False;
    1463             :     }
    1464             : #if OSL_DEBUG_LEVEL > 0
    1465             :     OSL_TRACE("validRow(%u): return True", nRow);
    1466             : #endif
    1467             : 
    1468           0 :     return sal_True;
    1469             : }
    1470           0 : sal_Bool OResultSet::fillKeySet(sal_Int32 nMaxCardNumber)
    1471             : {
    1472           0 :     impl_ensureKeySet();
    1473           0 :     if (m_CurrentRowCount < nMaxCardNumber)
    1474             :     {
    1475             :         sal_Int32   nKeyValue;
    1476           0 :         if ( (sal_Int32)m_pKeySet->get().capacity() < nMaxCardNumber )
    1477           0 :             m_pKeySet->get().reserve(nMaxCardNumber + 20 );
    1478             : 
    1479           0 :         for (nKeyValue = m_CurrentRowCount+1; nKeyValue  <= nMaxCardNumber; nKeyValue ++)
    1480           0 :             m_pKeySet->get().push_back( nKeyValue );
    1481           0 :         m_CurrentRowCount = nMaxCardNumber;
    1482             :     }
    1483           0 :     return sal_True;
    1484             : }
    1485             : 
    1486           0 : sal_Int32 OResultSet::deletedCount()
    1487             : {
    1488           0 :     impl_ensureKeySet();
    1489           0 :     return m_CurrentRowCount - static_cast<sal_Int32>(m_pKeySet->get().size());
    1490             : 
    1491             : }
    1492             : 
    1493           0 : sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset )
    1494             : {
    1495             :     SAL_INFO("connectivity.mork", "=> OResultSet::seekRow()" );
    1496             : 
    1497           0 :     ResultSetEntryGuard aGuard( *this );
    1498           0 :     if ( !m_pKeySet.is() )
    1499           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ILLEGAL_MOVEMENT, *this );
    1500             : 
    1501           0 :     sal_Int32  nNumberOfRecords = m_aQueryHelper.getResultCount();
    1502           0 :     sal_Int32  nRetrievedRows = currentRowCount();
    1503           0 :     sal_Int32  nCurPos = m_nRowPos;
    1504             : 
    1505             :     OSL_TRACE("seekRow: nCurPos = %d", nCurPos );
    1506           0 :     switch( pos ) {
    1507             :         case NEXT_POS:
    1508             :             OSL_TRACE("seekRow: NEXT");
    1509           0 :             nCurPos++;
    1510           0 :             break;
    1511             :         case PRIOR_POS:
    1512             :             OSL_TRACE("seekRow: PRIOR");
    1513           0 :             if ( nCurPos > 0 )
    1514           0 :                 nCurPos--;
    1515           0 :             break;
    1516             : 
    1517             :         case FIRST_POS:
    1518             :             OSL_TRACE("seekRow: FIRST");
    1519           0 :             nCurPos = 1;
    1520           0 :             break;
    1521             : 
    1522             :         case LAST_POS:
    1523             :             OSL_TRACE("seekRow: LAST");
    1524           0 :             nCurPos = nRetrievedRows;
    1525           0 :             break;
    1526             :         case ABSOLUTE_POS:
    1527             :             OSL_TRACE("seekRow: ABSOLUTE : %d", nOffset);
    1528           0 :             nCurPos = nOffset;
    1529           0 :             break;
    1530             :         case RELATIVE_POS:
    1531             :             OSL_TRACE("seekRow: RELATIVE : %d", nOffset);
    1532           0 :             nCurPos += sal_uInt32( nOffset );
    1533           0 :             break;
    1534             :     }
    1535             : 
    1536           0 :     if ( nCurPos <= 0 ) {
    1537           0 :         m_nRowPos = 0;
    1538             :         OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
    1539           0 :         return sal_False;
    1540             :     }
    1541           0 :     sal_Int32 nCurCard = nCurPos;
    1542           0 :     if ( nCurPos < (sal_Int32)m_pKeySet->get().size() ) //The requested row is exist in m_pKeySet, so we just use it
    1543             :     {
    1544           0 :         nCurCard = (m_pKeySet->get())[nCurPos-1];
    1545             :     }
    1546             :     else    //The requested row has not been retrieved until now. We should get the right card for it.
    1547           0 :         nCurCard = nCurPos + deletedCount();
    1548             : 
    1549           0 :     if ( nCurCard > nNumberOfRecords) {
    1550           0 :         fillKeySet(nNumberOfRecords);
    1551           0 :         m_nRowPos = static_cast<sal_uInt32>(m_pKeySet->get().size() + 1);
    1552             :         OSL_TRACE("seekRow: return False, m_nRowPos = %u", m_nRowPos );
    1553           0 :         return sal_False;
    1554             :     }
    1555             :     //Insert new retrieved items for later use
    1556           0 :     fillKeySet(nNumberOfRecords);
    1557           0 :     m_nRowPos = (sal_uInt32)nCurPos;
    1558             :     OSL_TRACE("seekRow: return True, m_nRowPos = %u", m_nRowPos );
    1559           0 :     fetchCurrentRow();
    1560           0 :     return sal_True;
    1561             : }
    1562             : 
    1563           0 : void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping)
    1564             : {
    1565           0 :     m_aColMapping = _aColumnMapping;
    1566             : #if OSL_DEBUG_LEVEL > 0
    1567             :     for ( sal_uInt32 i = 0; i < m_aColMapping.size(); i++ )
    1568             :         OSL_TRACE("Set Mapped: %d -> %d", i, m_aColMapping[i] );
    1569             : #endif
    1570           0 : }
    1571             : 
    1572             : 
    1573           0 : ::com::sun::star::uno::Any OResultSet::getBookmark(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1574             : {
    1575             :     OSL_TRACE("getBookmark, m_nRowPos = %u", m_nRowPos );
    1576           0 :     ResultSetEntryGuard aGuard( *this );
    1577           0 :     if ( fetchCurrentRow() == sal_False ) {
    1578           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
    1579             :     }
    1580             : 
    1581             :     OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row");
    1582           0 :     return makeAny((sal_Int32)(m_aRow->get())[0]);
    1583             : }
    1584           0 : sal_Bool  OResultSet::moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1585             : {
    1586           0 :     ResultSetEntryGuard aGuard( *this );
    1587             :     OSL_TRACE("moveToBookmark, bookmark = %u", comphelper::getINT32(bookmark) );
    1588           0 :     sal_Int32 nCardNum = comphelper::getINT32(bookmark);
    1589           0 :     m_nRowPos = getRowForCardNumber(nCardNum);
    1590           0 :     fetchCurrentRow();
    1591           0 :     return sal_True;
    1592             : }
    1593           0 : sal_Bool  OResultSet::moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1594             : {
    1595           0 :     ResultSetEntryGuard aGuard( *this );
    1596             :     OSL_TRACE("moveRelativeToBookmark, bookmark = %u rows= %u", comphelper::getINT32(bookmark),rows );
    1597           0 :     sal_Int32 nCardNum = comphelper::getINT32(bookmark);
    1598           0 :     m_nRowPos = getRowForCardNumber(nCardNum);
    1599           0 :     return seekRow(RELATIVE_POS,rows );
    1600             : }
    1601           0 : sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1602             : {
    1603           0 :     ResultSetEntryGuard aGuard( *this );
    1604             :     OSL_TRACE("compareBookmarks, m_nRowPos = %u", m_nRowPos );
    1605           0 :         sal_Int32 nFirst=0;
    1606           0 :         sal_Int32 nSecond=0;
    1607           0 :         sal_Int32 nResult=0;
    1608             : 
    1609           0 :         if ( !( lhs >>= nFirst ) || !( rhs >>= nSecond ) ) {
    1610           0 :             m_pStatement->getOwnConnection()->throwSQLException( STR_INVALID_BOOKMARK, *this );
    1611             :         }
    1612             : 
    1613           0 :     if(nFirst < nSecond)
    1614           0 :          nResult = -1;
    1615           0 :     else if(nFirst > nSecond)
    1616           0 :          nResult = 1;
    1617             :     else
    1618           0 :          nResult = 0;
    1619             : 
    1620           0 :     return  nResult;
    1621             : }
    1622           0 : sal_Bool OResultSet::hasOrderedBookmarks(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1623             : {
    1624           0 :     ResultSetEntryGuard aGuard( *this );
    1625             :     OSL_TRACE("hasOrderedBookmarks, m_nRowPos = %u", m_nRowPos );
    1626           0 :     return sal_True;
    1627             : }
    1628           0 : sal_Int32 OResultSet::hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1629             : {
    1630           0 :     ResultSetEntryGuard aGuard( *this );
    1631             :     OSL_TRACE("hashBookmark, m_nRowPos = %u", m_nRowPos );
    1632           0 :     return  comphelper::getINT32(bookmark);
    1633             : }
    1634             : 
    1635           0 : sal_Int32 OResultSet::getCurrentCardNumber()
    1636             : {
    1637           0 :     if ( ( m_nRowPos == 0 ) || !m_pKeySet.is() )
    1638           0 :         return 0;
    1639           0 :     if (m_pKeySet->get().size() < m_nRowPos)
    1640           0 :         return 0;
    1641           0 :     return (m_pKeySet->get())[m_nRowPos-1];
    1642             : }
    1643           0 : void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException)
    1644             : {
    1645             :     OSL_FAIL( "OResultSet::checkPendingUpdate() not implemented" );
    1646             : /*
    1647             :     OSL_TRACE("checkPendingUpdate, m_nRowPos = %u", m_nRowPos );
    1648             :     const sal_Int32 nCurrentRow = getCurrentCardNumber();
    1649             : 
    1650             :     if ((m_nNewRow && nCurrentRow != m_nNewRow)
    1651             :         || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow))
    1652             :     {
    1653             :         const OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
    1654             :                 STR_COMMIT_ROW,
    1655             :                 "$position$", OUString::valueOf(nCurrentRow)
    1656             :              ) );
    1657             :         ::dbtools::throwGenericSQLException(sError,*this);
    1658             :     }
    1659             : */
    1660             : 
    1661           0 : }
    1662           0 : void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
    1663             : {
    1664             :     OSL_TRACE("updateValue, m_nRowPos = %u", m_nRowPos );
    1665           0 :     ResultSetEntryGuard aGuard( *this );
    1666           0 :     if ( fetchCurrentRow() == sal_False ) {
    1667           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
    1668             :     }
    1669             : 
    1670           0 :     checkPendingUpdate();
    1671             : 
    1672           0 :     checkIndex(columnIndex );
    1673           0 :     columnIndex = mapColumn(columnIndex);
    1674             : 
    1675           0 :     (m_aRow->get())[columnIndex].setBound(true);
    1676           0 :     (m_aRow->get())[columnIndex] = x;
    1677           0 :     m_nUpdatedRow = getCurrentCardNumber();
    1678             : //    m_RowStates = m_RowStates | RowStates_Updated;
    1679           0 : }
    1680             : 
    1681             : 
    1682           0 : void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
    1683             : {
    1684             :     OSL_TRACE("updateNull, m_nRowPos = %u", m_nRowPos );
    1685           0 :     ResultSetEntryGuard aGuard( *this );
    1686           0 :     if ( fetchCurrentRow() == sal_False )
    1687           0 :         m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this );
    1688             : 
    1689           0 :     checkPendingUpdate();
    1690           0 :     checkIndex(columnIndex );
    1691           0 :     columnIndex = mapColumn(columnIndex);
    1692             : 
    1693           0 :     (m_aRow->get())[columnIndex].setBound(true);
    1694           0 :     (m_aRow->get())[columnIndex].setNull();
    1695           0 :     m_nUpdatedRow = getCurrentCardNumber();
    1696             : //    m_RowStates = m_RowStates | RowStates_Updated;
    1697           0 : }
    1698             : 
    1699             : 
    1700           0 : void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException, std::exception)
    1701             : {
    1702           0 :     updateValue(columnIndex, static_cast<bool>(x));
    1703           0 : }
    1704             : 
    1705           0 : void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException, std::exception)
    1706             : {
    1707           0 :     updateValue(columnIndex,x);
    1708           0 : }
    1709             : 
    1710             : 
    1711           0 : void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException, std::exception)
    1712             : {
    1713           0 :     updateValue(columnIndex,x);
    1714           0 : }
    1715             : 
    1716           0 : void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException, std::exception)
    1717             : {
    1718           0 :     updateValue(columnIndex,x);
    1719           0 : }
    1720             : 
    1721           0 : void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException, std::exception)
    1722             : {
    1723           0 :     ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
    1724           0 : }
    1725             : 
    1726           0 : void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException, std::exception)
    1727             : {
    1728           0 :     updateValue(columnIndex,x);
    1729           0 : }
    1730             : 
    1731             : 
    1732           0 : void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException, std::exception)
    1733             : {
    1734           0 :     updateValue(columnIndex,x);
    1735           0 : }
    1736             : 
    1737           0 : void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const OUString& x ) throw(SQLException, RuntimeException, std::exception)
    1738             : {
    1739           0 :     updateValue(columnIndex,x);
    1740           0 : }
    1741             : 
    1742           0 : void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException, std::exception)
    1743             : {
    1744           0 :     updateValue(columnIndex,x);
    1745           0 : }
    1746             : 
    1747           0 : void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException, std::exception)
    1748             : {
    1749           0 :     updateValue(columnIndex,x);
    1750           0 : }
    1751             : 
    1752             : 
    1753           0 : void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException, std::exception)
    1754             : {
    1755           0 :     updateValue(columnIndex,x);
    1756           0 : }
    1757             : 
    1758             : 
    1759           0 : void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException, std::exception)
    1760             : {
    1761           0 :     updateValue(columnIndex,x);
    1762           0 : }
    1763             : 
    1764             : 
    1765           0 : void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException, std::exception)
    1766             : {
    1767           0 :     ResultSetEntryGuard aGuard( *this );
    1768             : 
    1769           0 :     if(!x.is())
    1770           0 :         ::dbtools::throwFunctionSequenceException(*this);
    1771             : 
    1772           0 :     Sequence<sal_Int8> aSeq;
    1773           0 :     x->readBytes(aSeq,length);
    1774           0 :     updateValue(columnIndex,aSeq);
    1775           0 : }
    1776             : 
    1777           0 : void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException, std::exception)
    1778             : {
    1779           0 :     updateBinaryStream(columnIndex,x,length);
    1780           0 : }
    1781             : 
    1782           0 : void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException, std::exception)
    1783             : {
    1784           0 :     if (!::dbtools::implUpdateObject(this, columnIndex, x))
    1785             :     {
    1786           0 :         const OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
    1787             :                 STR_COLUMN_NOT_UPDATEABLE,
    1788             :                 "$position$", OUString::number(columnIndex)
    1789           0 :              ) );
    1790           0 :         ::dbtools::throwGenericSQLException(sError,*this);
    1791             :     } // if (!::dbtools::implUpdateObject(this, columnIndex, x))
    1792           0 :  }
    1793             : 
    1794             : 
    1795           0 : void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException, std::exception)
    1796             : {
    1797           0 :     if (!::dbtools::implUpdateObject(this, columnIndex, x))
    1798             :     {
    1799           0 :         const OUString sError( m_pStatement->getOwnConnection()->getResources().getResourceStringWithSubstitution(
    1800             :                 STR_COLUMN_NOT_UPDATEABLE,
    1801             :                 "$position$", OUString::number(columnIndex)
    1802           0 :              ) );
    1803           0 :         ::dbtools::throwGenericSQLException(sError,*this);
    1804             :     }
    1805           0 : }
    1806             : 
    1807             : // XResultSetUpdate
    1808             : 
    1809           0 : void SAL_CALL OResultSet::insertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1810             : {
    1811           0 :     ResultSetEntryGuard aGuard( *this );
    1812             :     OSL_TRACE("insertRow in, m_nRowPos = %u", m_nRowPos );
    1813             : //    m_RowStates = RowStates_Inserted;
    1814           0 :     updateRow();
    1815           0 :     m_nOldRowPos = 0;
    1816           0 :     m_nNewRow = 0;
    1817             :     //m_aQueryHelper.setRowStates(getCurrentCardNumber(),m_RowStates);
    1818           0 :     OSL_TRACE("insertRow out, m_nRowPos = %u", m_nRowPos );
    1819           0 : }
    1820             : 
    1821           0 : void SAL_CALL OResultSet::updateRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1822             : {
    1823             :     OSL_FAIL( "OResultSet::updateRow(  ) not implemented" );
    1824           0 : }
    1825             : 
    1826           0 : void SAL_CALL OResultSet::deleteRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1827             : {
    1828             :     OSL_FAIL( "OResultSet::deleteRow(  ) not implemented" );
    1829           0 : }
    1830             : 
    1831           0 : void SAL_CALL OResultSet::cancelRowUpdates(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1832             : {
    1833             :     OSL_FAIL( "OResultSet::cancelRowUpdates(  ) not implemented" );
    1834           0 : }
    1835             : 
    1836           0 : void SAL_CALL OResultSet::moveToInsertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1837             : {
    1838             :     OSL_FAIL( "OResultSet::moveToInsertRow(  ) not implemented" );
    1839           0 : }
    1840             : 
    1841           0 : void SAL_CALL OResultSet::moveToCurrentRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
    1842             : {
    1843           0 :     ResultSetEntryGuard aGuard( *this );
    1844             :     OSL_TRACE("moveToCurrentRow, m_nRowPos = %u", m_nRowPos );
    1845           0 :     if (rowInserted())
    1846             :     {
    1847           0 :         m_nRowPos = m_nOldRowPos;
    1848           0 :         fetchCurrentRow();
    1849           0 :     }
    1850           0 : }
    1851             : 
    1852           0 : sal_Bool OResultSet::determineReadOnly()
    1853             : {
    1854             : //    OSL_FAIL( "OResultSet::determineReadOnly(  ) not implemented" );
    1855             : 
    1856           0 :     if (m_bIsReadOnly == -1)
    1857             :     {
    1858           0 :         m_bIsReadOnly = sal_True;
    1859             : //        OConnection* xConnection = static_cast<OConnection*>(m_pStatement->getConnection().get());
    1860             : //        m_bIsReadOnly = !m_aQueryHelper.isWritable(xConnection) || m_bIsAlwaysFalseQuery;
    1861             :     }
    1862             : 
    1863           0 :     return m_bIsReadOnly != 0;
    1864             : }
    1865             : 
    1866           0 : void OResultSet::setTable(OTable* _rTable)
    1867             : {
    1868             :     OSL_TRACE("In : setTable");
    1869           0 :     m_pTable = _rTable;
    1870           0 :     m_pTable->acquire();
    1871           0 :     m_xTableColumns = m_pTable->getColumns();
    1872           0 :     if(m_xTableColumns.is())
    1873           0 :         m_aColumnNames = m_xTableColumns->getElementNames();
    1874             :     OSL_TRACE("Out : setTable");
    1875           0 : }
    1876             : 
    1877           0 : void OResultSet::setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy)
    1878             : {
    1879           0 :     m_aOrderbyColumnNumber = _aColumnOrderBy;
    1880           0 : }
    1881             : 
    1882           0 : void OResultSet::setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc)
    1883             : {
    1884           0 :     m_aOrderbyAscending = _aOrderbyAsc;
    1885           0 : }
    1886           0 : Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& /*rows*/ ) throw(SQLException, RuntimeException, std::exception)
    1887             : {
    1888           0 :     ::dbtools::throwFeatureNotImplementedException( "XDeleteRows::deleteRows", *this );
    1889           0 :     return Sequence< sal_Int32 >();
    1890             : };
    1891             : 
    1892             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10