LCOV - code coverage report
Current view: top level - connectivity/source/drivers/file - FResultSet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 442 818 54.0 %
Date: 2012-08-25 Functions: 49 106 46.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 495 1481 33.4 %

           Branch data     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                 :            : 
      21                 :            : #ifdef GCC
      22                 :            : #include <iostream>
      23                 :            : #endif
      24                 :            : #include "connectivity/sdbcx/VColumn.hxx"
      25                 :            : #include "file/FResultSet.hxx"
      26                 :            : #include "file/FResultSetMetaData.hxx"
      27                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      28                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      29                 :            : #include <comphelper/property.hxx>
      30                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      31                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      32                 :            : #include <com/sun/star/container/XIndexAccess.hpp>
      33                 :            : #include <comphelper/sequence.hxx>
      34                 :            : #include <cppuhelper/typeprovider.hxx>
      35                 :            : #include "connectivity/dbconversion.hxx"
      36                 :            : #include "connectivity/dbtools.hxx"
      37                 :            : #include <cppuhelper/propshlp.hxx>
      38                 :            : #include <iterator>
      39                 :            : #include <tools/debug.hxx>
      40                 :            : #include <com/sun/star/sdbc/ResultSetType.hpp>
      41                 :            : #include <com/sun/star/sdbc/FetchDirection.hpp>
      42                 :            : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
      43                 :            : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
      44                 :            : 
      45                 :            : #include <algorithm>
      46                 :            : #include <comphelper/extract.hxx>
      47                 :            : #include "connectivity/dbexception.hxx"
      48                 :            : #include <comphelper/types.hxx>
      49                 :            : #include "resource/file_res.hrc"
      50                 :            : #include "resource/sharedresources.hxx"
      51                 :            : #include <rtl/logfile.hxx>
      52                 :            : 
      53                 :            : 
      54                 :            : using namespace ::comphelper;
      55                 :            : using namespace connectivity;
      56                 :            : using namespace connectivity::file;
      57                 :            : using namespace ::cppu;
      58                 :            : using namespace dbtools;
      59                 :            : using namespace com::sun::star::uno;
      60                 :            : using namespace com::sun::star::lang;
      61                 :            : using namespace com::sun::star::beans;
      62                 :            : using namespace com::sun::star::sdbc;
      63                 :            : using namespace com::sun::star::sdbcx;
      64                 :            : using namespace com::sun::star::container;
      65                 :            : 
      66                 :            : // Maximal number of Rows, that can be processed being sorted with ORDER BY:
      67                 :            : #define MAX_KEYSET_SIZE 0x40000 // 256K
      68                 :            : 
      69                 :            : namespace
      70                 :            : {
      71                 :          0 :     void lcl_throwError(sal_uInt16 _nErrorId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext)
      72                 :            :     {
      73         [ #  # ]:          0 :         ::connectivity::SharedResources aResources;
      74         [ #  # ]:          0 :         const ::rtl::OUString sMessage = aResources.getResourceString(_nErrorId);
      75 [ #  # ][ #  # ]:          0 :         ::dbtools::throwGenericSQLException(sMessage ,_xContext);
      76                 :          0 :     }
      77                 :            : }
      78                 :            : //------------------------------------------------------------------------------
      79 [ #  # ][ #  # ]:          0 : IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.drivers.file.ResultSet","com.sun.star.sdbc.ResultSet");
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      80                 :            : DBG_NAME( file_OResultSet )
      81                 :            : // -------------------------------------------------------------------------
      82                 :         88 : OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator&    _aSQLIterator) :    OResultSet_BASE(m_aMutex)
      83                 :            :                         ,::comphelper::OPropertyContainer(OResultSet_BASE::rBHelper)
      84                 :            :                         ,m_aAssignValues(NULL)
      85                 :            :                         ,m_pEvaluationKeySet(NULL)
      86                 :            :                         ,m_aSkipDeletedSet(this)
      87                 :            :                         ,m_pFileSet(NULL)
      88                 :            :                         ,m_pSortIndex(NULL)
      89                 :            :                         ,m_pTable(NULL)
      90                 :         88 :                         ,m_pParseTree(pStmt->getParseTree())
      91                 :            :                         ,m_pSQLAnalyzer(NULL)
      92                 :            :                         ,m_aSQLIterator(_aSQLIterator)
      93                 :            :                         ,m_nFetchSize(0)
      94                 :            :                         ,m_nResultSetType(ResultSetType::SCROLL_INSENSITIVE)
      95                 :            :                         ,m_nFetchDirection(FetchDirection::FORWARD)
      96                 :            :                         ,m_nResultSetConcurrency(ResultSetConcurrency::UPDATABLE)
      97                 :            :                         ,m_xStatement(*pStmt)
      98                 :            :                         ,m_xMetaData(NULL)
      99                 :         88 :                         ,m_xDBMetaData(pStmt->getOwnConnection()->getMetaData())
     100                 :         88 :                         ,m_nTextEncoding(pStmt->getOwnConnection()->getTextEncoding())
     101                 :            :                         ,m_nRowPos(-1)
     102                 :            :                         ,m_nFilePos(0)
     103                 :            :                         ,m_nLastVisitedPos(-1)
     104                 :            :                         ,m_nRowCountResult(-1)
     105                 :            :                         ,m_nCurrentPosition(0)
     106                 :            :                         ,m_nColumnCount(0)
     107                 :            :                         ,m_bWasNull(sal_False)
     108                 :            :                         ,m_bEOF(sal_False)
     109                 :            :                         ,m_bLastRecord(sal_False)
     110                 :            :                         ,m_bInserted(sal_False)
     111                 :            :                         ,m_bRowUpdated(sal_False)
     112                 :            :                         ,m_bRowInserted(sal_False)
     113                 :            :                         ,m_bRowDeleted(sal_False)
     114                 :         88 :                         ,m_bShowDeleted(pStmt->getOwnConnection()->showDeleted())
     115 [ +  - ][ +  - ]:        264 :                         ,m_bIsCount(sal_False)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  +  - ]
     116                 :            : {
     117                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OResultSet" );
     118                 :            :     DBG_CTOR( file_OResultSet, NULL );
     119         [ +  - ]:         88 :     osl_incrementInterlockedCount( &m_refCount );
     120                 :            :     m_bIsCount = (m_pParseTree &&
     121                 :         88 :             m_pParseTree->count() > 2                                                       &&
     122 [ +  - ][ +  - ]:        176 :             SQL_ISRULE(m_pParseTree->getChild(2),scalar_exp_commalist)                      &&
                 [ +  - ]
     123 [ +  - ][ +  - ]:         72 :             SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0),derived_column)               &&
         [ +  - ][ +  - ]
                 [ +  - ]
     124 [ +  - ][ +  - ]:         72 :             SQL_ISRULE(m_pParseTree->getChild(2)->getChild(0)->getChild(0),general_set_fct) &&
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     125 [ #  # ][ #  # ]:          0 :             m_pParseTree->getChild(2)->getChild(0)->getChild(0)->count() == 4
                 [ #  # ]
     126   [ +  -  +  -  :        496 :             );
                   +  - ]
           [ +  +  +  - ]
           [ +  -  +  - ]
           [ -  +  #  # ]
     127                 :            : 
     128         [ -  + ]:         88 :     m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
     129         [ +  - ]:         88 :     construct();
     130                 :         88 :     m_aSkipDeletedSet.SetDeletedVisible(m_bShowDeleted);
     131         [ +  - ]:         88 :     osl_decrementInterlockedCount( &m_refCount );
     132                 :         88 : }
     133                 :            : 
     134                 :            : // -------------------------------------------------------------------------
     135 [ +  - ][ +  - ]:         88 : OResultSet::~OResultSet()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     136                 :            : {
     137                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::~OResultSet" );
     138         [ +  - ]:         88 :     osl_incrementInterlockedCount( &m_refCount );
     139         [ +  - ]:         88 :     disposing();
     140                 :            :     DBG_DTOR( file_OResultSet, NULL );
     141         [ -  + ]:         88 : }
     142                 :            : // -------------------------------------------------------------------------
     143                 :         88 : void OResultSet::construct()
     144                 :            : {
     145                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::construct" );
     146         [ +  - ]:         88 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),           PROPERTY_ID_FETCHSIZE,          0,&m_nFetchSize,        ::getCppuType(static_cast<sal_Int32*>(0)));
     147         [ +  - ]:         88 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),        PROPERTY_ID_RESULTSETTYPE,      PropertyAttribute::READONLY,&m_nResultSetType,       ::getCppuType(static_cast<sal_Int32*>(0)));
     148         [ +  - ]:         88 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),      PROPERTY_ID_FETCHDIRECTION,     0,&m_nFetchDirection,   ::getCppuType(static_cast<sal_Int32*>(0)));
     149         [ +  - ]:         88 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY), PROPERTY_ID_RESULTSETCONCURRENCY,PropertyAttribute::READONLY,&m_nResultSetConcurrency,                ::getCppuType(static_cast<sal_Int32*>(0)));
     150                 :         88 : }
     151                 :            : // -------------------------------------------------------------------------
     152                 :        176 : void OResultSet::disposing(void)
     153                 :            : {
     154                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
     155         [ +  - ]:        176 :     OPropertySetHelper::disposing();
     156                 :            : 
     157         [ +  - ]:        176 :     ::osl::MutexGuard aGuard(m_aMutex);
     158                 :        176 :     m_xStatement.clear();
     159                 :        176 :     m_xMetaData.clear();
     160                 :        176 :     m_pParseTree    = NULL;
     161                 :        176 :     m_xColNames.clear();
     162         [ +  - ]:        176 :     m_xColumns = NULL;
     163         [ +  - ]:        176 :     m_xParamColumns = NULL;
     164                 :        176 :     m_xColsIdx.clear();
     165                 :            : 
     166 [ +  - ][ +  + ]:        176 :     Reference<XComponent> xComp = m_pTable;
     167         [ +  + ]:        176 :     if ( xComp.is() )
     168 [ +  - ][ +  - ]:         40 :         xComp->removeEventListener(this);
                 [ +  - ]
     169         [ +  + ]:        176 :     if(m_pTable)
     170                 :            :     {
     171                 :         40 :         m_pTable->release();
     172                 :         40 :         m_pTable = NULL;
     173                 :            :     }
     174 [ +  - ][ +  - ]:        176 :     clear();
     175                 :        176 : }
     176                 :            : // -----------------------------------------------------------------------------
     177                 :        216 : void OResultSet::clear()
     178                 :            : {
     179                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clear" );
     180                 :        216 :     m_pFileSet = NULL;
     181         [ -  + ]:        216 :     DELETEZ(m_pSortIndex);
     182                 :            : 
     183         [ +  + ]:        216 :     if(m_aInsertRow.is())
     184                 :         80 :         m_aInsertRow->get().clear();
     185                 :            : 
     186                 :        216 :     m_aSkipDeletedSet.clear();
     187                 :        216 : }
     188                 :            : // -------------------------------------------------------------------------
     189                 :        672 : Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
     190                 :            : {
     191                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::queryInterface" );
     192         [ +  - ]:        672 :     Any aRet = OPropertySetHelper::queryInterface(rType);
     193 [ +  + ][ +  - ]:        672 :     return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
     194                 :            : }
     195                 :            : // -------------------------------------------------------------------------
     196                 :          0 : Sequence< Type > SAL_CALL OResultSet::getTypes(  ) throw(RuntimeException)
     197                 :            : {
     198                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTypes" );
     199         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     200                 :            : 
     201         [ #  # ]:          0 :     OTypeCollection aTypes( ::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
     202         [ #  # ]:          0 :                             ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ),
     203 [ #  # ][ #  # ]:          0 :                             ::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
         [ #  # ][ #  # ]
     204                 :            : 
     205 [ #  # ][ #  # ]:          0 :     return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     206                 :            : }
     207                 :            : // -------------------------------------------------------------------------
     208                 :            : 
     209                 :          0 : sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
     210                 :            : {
     211                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::findColumn" );
     212         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     213         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     214                 :            : 
     215                 :            : 
     216         [ #  # ]:          0 :     Reference< XResultSetMetaData > xMeta = getMetaData();
     217 [ #  # ][ #  # ]:          0 :     sal_Int32 nLen = xMeta->getColumnCount();
     218                 :          0 :     sal_Int32 i = 1;
     219         [ #  # ]:          0 :     for(;i<=nLen;++i)
     220 [ #  # ][ #  # ]:          0 :         if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     221 [ #  # ][ #  # ]:          0 :                 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
         [ #  # ][ #  # ]
                 [ #  # ]
     222                 :          0 :             break;
     223         [ #  # ]:          0 :     return i;
     224                 :            : }
     225                 :            : // -----------------------------------------------------------------------------
     226                 :       5728 : const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
     227                 :            : {
     228                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getValue" );
     229         [ +  - ]:       5728 :     ::osl::MutexGuard aGuard( m_aMutex );
     230         [ +  - ]:       5728 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     231                 :            : 
     232         [ +  - ]:       5728 :     checkIndex(columnIndex );
     233                 :            : 
     234                 :            : 
     235                 :       5728 :     m_bWasNull = (m_aSelectRow->get())[columnIndex]->getValue().isNull();
     236         [ +  - ]:       5728 :     return *(m_aSelectRow->get())[columnIndex];
     237                 :            : }
     238                 :            : // -----------------------------------------------------------------------------
     239                 :       5738 : void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException)
     240                 :            : {
     241                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" );
     242 [ +  - ][ -  + ]:       5738 :     if (   columnIndex <= 0
     243                 :            :             || columnIndex >= m_nColumnCount )
     244 [ #  # ][ #  # ]:          0 :         ::dbtools::throwInvalidIndexException(*this);
     245                 :       5738 : }
     246                 :            : // -------------------------------------------------------------------------
     247                 :          0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     248                 :            : {
     249                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBinaryStream" );
     250                 :          0 :     return NULL;
     251                 :            : }
     252                 :            : // -------------------------------------------------------------------------
     253                 :          0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     254                 :            : {
     255                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getCharacterStream" );
     256                 :          0 :     return NULL;
     257                 :            : }
     258                 :            : 
     259                 :            : // -------------------------------------------------------------------------
     260                 :         56 : sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     261                 :            : {
     262                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBoolean" );
     263                 :         56 :     return getValue(columnIndex);
     264                 :            : }
     265                 :            : // -------------------------------------------------------------------------
     266                 :            : 
     267                 :          0 : sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     268                 :            : {
     269                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getByte" );
     270                 :          0 :     return getValue(columnIndex);
     271                 :            : }
     272                 :            : // -------------------------------------------------------------------------
     273                 :            : 
     274                 :          0 : Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     275                 :            : {
     276                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBytes" );
     277                 :          0 :     return getValue(columnIndex);
     278                 :            : }
     279                 :            : // -------------------------------------------------------------------------
     280                 :            : 
     281                 :        112 : ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     282                 :            : {
     283                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDate" );
     284                 :        112 :     return getValue(columnIndex);
     285                 :            : }
     286                 :            : // -------------------------------------------------------------------------
     287                 :            : 
     288                 :          0 : double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     289                 :            : {
     290                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDouble" );
     291                 :          0 :     return getValue(columnIndex);
     292                 :            : }
     293                 :            : // -------------------------------------------------------------------------
     294                 :            : 
     295                 :          0 : float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     296                 :            : {
     297                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getFloat" );
     298                 :          0 :     return getValue(columnIndex);
     299                 :            : }
     300                 :            : // -------------------------------------------------------------------------
     301                 :            : 
     302                 :          0 : sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     303                 :            : {
     304                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInt" );
     305                 :          0 :     return getValue(columnIndex);
     306                 :            : }
     307                 :            : // -------------------------------------------------------------------------
     308                 :            : 
     309                 :        438 : sal_Int32 SAL_CALL OResultSet::getRow(  ) throw(SQLException, RuntimeException)
     310                 :            : {
     311                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRow" );
     312         [ +  - ]:        438 :     ::osl::MutexGuard aGuard( m_aMutex );
     313         [ +  - ]:        438 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     314                 :            : 
     315                 :            :     OSL_ENSURE((m_bShowDeleted || !m_aRow->isDeleted()),"getRow called for deleted row");
     316                 :            : 
     317 [ +  - ][ +  - ]:        438 :     return m_aSkipDeletedSet.getMappedPosition((m_aRow->get())[0]->getValue());
                 [ +  - ]
     318                 :            : }
     319                 :            : // -------------------------------------------------------------------------
     320                 :            : 
     321                 :          0 : sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     322                 :            : {
     323                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getLong" );
     324                 :          0 :     return getValue(columnIndex);
     325                 :            : }
     326                 :            : // -------------------------------------------------------------------------
     327                 :            : 
     328                 :         80 : Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData(  ) throw(SQLException, RuntimeException)
     329                 :            : {
     330                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getMetaData" );
     331         [ +  - ]:         80 :     ::osl::MutexGuard aGuard( m_aMutex );
     332         [ +  - ]:         80 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     333                 :            : 
     334                 :            : 
     335         [ -  + ]:         80 :     if(!m_xMetaData.is())
     336 [ #  # ][ #  # ]:          0 :         m_xMetaData = new OResultSetMetaData(m_xColumns,m_aSQLIterator.getTables().begin()->first,m_pTable);
         [ #  # ][ #  # ]
     337         [ +  - ]:         80 :     return m_xMetaData;
     338                 :            : }
     339                 :            : // -------------------------------------------------------------------------
     340                 :          0 : Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     341                 :            : {
     342                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getArray" );
     343                 :          0 :     return NULL;
     344                 :            : }
     345                 :            : 
     346                 :            : // -------------------------------------------------------------------------
     347                 :            : 
     348                 :          0 : Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     349                 :            : {
     350                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getClob" );
     351                 :          0 :     return NULL;
     352                 :            : }
     353                 :            : // -------------------------------------------------------------------------
     354                 :          0 : Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     355                 :            : {
     356                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getBlob" );
     357                 :          0 :     return NULL;
     358                 :            : }
     359                 :            : // -------------------------------------------------------------------------
     360                 :            : 
     361                 :          0 : Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
     362                 :            : {
     363                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getRef" );
     364                 :          0 :     return NULL;
     365                 :            : }
     366                 :            : // -------------------------------------------------------------------------
     367                 :            : 
     368                 :          0 : Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
     369                 :            : {
     370                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getObject" );
     371                 :          0 :     return getValue(columnIndex).makeAny();
     372                 :            : }
     373                 :            : // -------------------------------------------------------------------------
     374                 :            : 
     375                 :          0 : sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     376                 :            : {
     377                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getShort" );
     378                 :          0 :     return getValue(columnIndex);
     379                 :            : }
     380                 :            : // -------------------------------------------------------------------------
     381                 :       5560 : ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     382                 :            : {
     383                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getString" );
     384                 :       5560 :     return getValue(columnIndex);
     385                 :            : }
     386                 :            : // -------------------------------------------------------------------------
     387                 :          0 : ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     388                 :            : {
     389                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTime" );
     390                 :          0 :     return getValue(columnIndex);
     391                 :            : }
     392                 :            : // -------------------------------------------------------------------------
     393                 :          0 : ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     394                 :            : {
     395                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getTimestamp" );
     396                 :          0 :     return getValue(columnIndex);
     397                 :            : }
     398                 :            : // -------------------------------------------------------------------------
     399                 :            : 
     400                 :          0 : sal_Bool SAL_CALL OResultSet::isAfterLast(  ) throw(SQLException, RuntimeException)
     401                 :            : {
     402                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isAfterLast" );
     403         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     404         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     405                 :            : 
     406                 :            : 
     407         [ #  # ]:          0 :     return m_nRowPos == sal_Int32(m_pFileSet->get().size());
     408                 :            : }
     409                 :            : // -------------------------------------------------------------------------
     410                 :          0 : sal_Bool SAL_CALL OResultSet::isFirst(  ) throw(SQLException, RuntimeException)
     411                 :            : {
     412                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isFirst" );
     413         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     414         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     415                 :            : 
     416                 :            : 
     417         [ #  # ]:          0 :     return m_nRowPos == 0;
     418                 :            : }
     419                 :            : // -------------------------------------------------------------------------
     420                 :          0 : sal_Bool SAL_CALL OResultSet::isLast(  ) throw(SQLException, RuntimeException)
     421                 :            : {
     422                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isLast" );
     423         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     424         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     425                 :            : 
     426                 :            : 
     427         [ #  # ]:          0 :     return m_nRowPos == sal_Int32(m_pFileSet->get().size() - 1);
     428                 :            : }
     429                 :            : // -------------------------------------------------------------------------
     430                 :         48 : void SAL_CALL OResultSet::beforeFirst(  ) throw(SQLException, RuntimeException)
     431                 :            : {
     432                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::beforeFirst" );
     433         [ +  - ]:         48 :     ::osl::MutexGuard aGuard( m_aMutex );
     434         [ +  - ]:         48 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     435                 :            : 
     436                 :            : 
     437 [ +  - ][ +  + ]:         48 :     if(first())
     438 [ +  - ][ +  - ]:         48 :         previous();
     439                 :         48 : }
     440                 :            : // -------------------------------------------------------------------------
     441                 :         10 : void SAL_CALL OResultSet::afterLast(  ) throw(SQLException, RuntimeException)
     442                 :            : {
     443                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::afterLast" );
     444         [ +  - ]:         10 :     ::osl::MutexGuard aGuard( m_aMutex );
     445         [ +  - ]:         10 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     446                 :            : 
     447                 :            : 
     448 [ +  - ][ +  - ]:         10 :     if(last())
     449         [ +  - ]:         10 :         next();
     450         [ +  - ]:         10 :     m_bEOF = sal_True;
     451                 :         10 : }
     452                 :            : // -------------------------------------------------------------------------
     453                 :            : 
     454                 :        128 : void SAL_CALL OResultSet::close(  ) throw(SQLException, RuntimeException)
     455                 :            : {
     456                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::close" );
     457                 :        128 :     dispose();
     458                 :        128 : }
     459                 :            : // -------------------------------------------------------------------------
     460                 :            : 
     461                 :         98 : sal_Bool SAL_CALL OResultSet::first(  ) throw(SQLException, RuntimeException)
     462                 :            : {
     463                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::first" );
     464         [ +  - ]:         98 :     ::osl::MutexGuard aGuard( m_aMutex );
     465         [ +  - ]:         98 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     466 [ +  - ][ +  - ]:         98 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::FIRST,1,sal_True) : sal_False;
                 [ +  - ]
     467                 :            : }
     468                 :            : // -------------------------------------------------------------------------
     469                 :            : 
     470                 :         18 : sal_Bool SAL_CALL OResultSet::last(  ) throw(SQLException, RuntimeException)
     471                 :            : {
     472                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::last" );
     473                 :            :     // here I know definitely that I stand on the last record
     474         [ +  - ]:         18 :     ::osl::MutexGuard aGuard( m_aMutex );
     475         [ +  - ]:         18 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     476 [ +  - ][ +  - ]:         18 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_True) : sal_False;
                 [ +  - ]
     477                 :            : }
     478                 :            : // -------------------------------------------------------------------------
     479                 :        122 : sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
     480                 :            : {
     481                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::absolute" );
     482         [ +  - ]:        122 :     ::osl::MutexGuard aGuard( m_aMutex );
     483         [ +  - ]:        122 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     484 [ +  - ][ +  - ]:        122 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::ABSOLUTE,row,sal_True) : sal_False;
                 [ +  - ]
     485                 :            : }
     486                 :            : // -------------------------------------------------------------------------
     487                 :          0 : sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
     488                 :            : {
     489                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::relative" );
     490         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     491         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     492 [ #  # ][ #  # ]:          0 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::RELATIVE,row,sal_True) : sal_False;
                 [ #  # ]
     493                 :            : }
     494                 :            : // -------------------------------------------------------------------------
     495                 :         82 : sal_Bool SAL_CALL OResultSet::previous(  ) throw(SQLException, RuntimeException)
     496                 :            : {
     497                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::previous" );
     498         [ +  - ]:         82 :     ::osl::MutexGuard aGuard( m_aMutex );
     499         [ +  - ]:         82 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     500 [ +  - ][ +  - ]:         82 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::PRIOR,0,sal_True) : sal_False;
                 [ +  - ]
     501                 :            : }
     502                 :            : // -------------------------------------------------------------------------
     503                 :          0 : Reference< XInterface > SAL_CALL OResultSet::getStatement(  ) throw(SQLException, RuntimeException)
     504                 :            : {
     505                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getStatement" );
     506         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     507         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     508                 :            : 
     509                 :            : 
     510         [ #  # ]:          0 :     return m_xStatement;
     511                 :            : }
     512                 :            : // -------------------------------------------------------------------------
     513                 :            : 
     514                 :          2 : sal_Bool SAL_CALL OResultSet::rowDeleted(  ) throw(SQLException, RuntimeException)
     515                 :            : {
     516                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowDeleted" );
     517         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
     518         [ +  - ]:          2 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     519                 :            : 
     520                 :            : 
     521         [ +  - ]:          2 :     return m_bRowDeleted;
     522                 :            : }
     523                 :            : // -------------------------------------------------------------------------
     524                 :          4 : sal_Bool SAL_CALL OResultSet::rowInserted(  ) throw(SQLException, RuntimeException)
     525         [ +  - ]:          4 : {   ::osl::MutexGuard aGuard( m_aMutex );
     526         [ +  - ]:          4 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     527                 :            : 
     528                 :            : 
     529         [ +  - ]:          4 :     return m_bRowInserted;
     530                 :            : }
     531                 :            : // -------------------------------------------------------------------------
     532                 :          2 : sal_Bool SAL_CALL OResultSet::rowUpdated(  ) throw(SQLException, RuntimeException)
     533                 :            : {
     534                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::rowInserted" );
     535         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
     536         [ +  - ]:          2 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     537                 :            : 
     538                 :            : 
     539         [ +  - ]:          2 :     return m_bRowUpdated;
     540                 :            : }
     541                 :            : // -------------------------------------------------------------------------
     542                 :            : 
     543                 :          0 : sal_Bool SAL_CALL OResultSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
     544                 :            : {
     545                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isBeforeFirst" );
     546         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     547         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     548                 :            : 
     549                 :            : 
     550         [ #  # ]:          0 :     return m_nRowPos == -1;
     551                 :            : }
     552                 :            : // -------------------------------------------------------------------------
     553                 :          0 : sal_Bool OResultSet::evaluate()
     554                 :            : {
     555                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::evaluate" );
     556                 :            :     OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::evaluate: Analyzer isn't set!");
     557                 :          0 :     sal_Bool bRet = sal_True;
     558         [ #  # ]:          0 :     while(!m_pSQLAnalyzer->evaluateRestriction())
     559                 :            :     {
     560         [ #  # ]:          0 :         if(m_pEvaluationKeySet)
     561                 :            :         {
     562 [ #  # ][ #  # ]:          0 :             if(m_aEvaluateIter == m_pEvaluationKeySet->end())
     563                 :          0 :                 return sal_False;
     564                 :          0 :             bRet = m_pTable->seekRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),m_nRowPos);
     565                 :          0 :             ++m_aEvaluateIter;
     566                 :            :         }
     567                 :            :         else
     568                 :          0 :             bRet = m_pTable->seekRow(IResultSetHelper::NEXT,1,m_nRowPos);
     569         [ #  # ]:          0 :         if(bRet)
     570                 :            :         {
     571         [ #  # ]:          0 :             if(m_pEvaluationKeySet)
     572                 :            :             {
     573         [ #  # ]:          0 :                 bRet = m_pTable->fetchRow(m_aEvaluateRow,*(m_pTable->getTableColumns()),sal_True,sal_True);
     574                 :          0 :                 evaluate();
     575                 :            : 
     576                 :            :             }
     577                 :            :             else
     578                 :          0 :                 bRet = m_pTable->fetchRow(m_aRow,*m_xColumns,sal_False,sal_True);
     579                 :            :         }
     580                 :            :     }
     581                 :            : 
     582                 :          0 :     return bRet;
     583                 :            : }
     584                 :            : // -------------------------------------------------------------------------
     585                 :            : 
     586                 :        306 : sal_Bool SAL_CALL OResultSet::next(  ) throw(SQLException, RuntimeException)
     587                 :            : {
     588                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::next" );
     589         [ +  - ]:        306 :     ::osl::MutexGuard aGuard( m_aMutex );
     590         [ +  - ]:        306 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     591                 :            : 
     592 [ +  - ][ +  - ]:        306 :     return m_pTable ? m_aSkipDeletedSet.skipDeleted(IResultSetHelper::NEXT,1,sal_True) : sal_False;
                 [ +  - ]
     593                 :            : }
     594                 :            : // -------------------------------------------------------------------------
     595                 :            : 
     596                 :       5728 : sal_Bool SAL_CALL OResultSet::wasNull(  ) throw(SQLException, RuntimeException)
     597                 :            : {
     598                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::wasNull" );
     599         [ +  - ]:       5728 :     ::osl::MutexGuard aGuard( m_aMutex );
     600         [ +  - ]:       5728 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     601                 :            : 
     602         [ +  - ]:       5728 :     return m_bWasNull;
     603                 :            : }
     604                 :            : // -------------------------------------------------------------------------
     605                 :            : 
     606                 :          0 : void SAL_CALL OResultSet::cancel(  ) throw(RuntimeException)
     607                 :            : {
     608                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancel" );
     609                 :          0 : }
     610                 :            : // -------------------------------------------------------------------------
     611                 :          0 : void SAL_CALL OResultSet::clearWarnings(  ) throw(SQLException, RuntimeException)
     612                 :            : {
     613                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearWarnings" );
     614                 :          0 : }
     615                 :            : // -------------------------------------------------------------------------
     616                 :          2 : Any SAL_CALL OResultSet::getWarnings(  ) throw(SQLException, RuntimeException)
     617                 :            : {
     618                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getWarnings" );
     619                 :          2 :     return Any();
     620                 :            : }
     621                 :            : // -------------------------------------------------------------------------
     622                 :          2 : void SAL_CALL OResultSet::insertRow(  ) throw(SQLException, RuntimeException)
     623                 :            : {
     624                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::insertRow" );
     625         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
     626         [ +  - ]:          2 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     627                 :            : 
     628                 :            : 
     629 [ +  - ][ -  + ]:          2 :     if(!m_bInserted || !m_pTable)
     630 [ #  # ][ #  # ]:          0 :         throwFunctionSequenceException(*this);
     631                 :            : 
     632                 :            :     // we know that we append new rows at the end
     633                 :            :     // so we have to know where the end is
     634         [ +  - ]:          2 :     m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False);
     635         [ +  - ]:          2 :     m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, sal_True, m_xColsIdx);
     636 [ +  - ][ +  - ]:          2 :     if(m_bRowInserted && m_pFileSet.is())
                 [ +  - ]
     637                 :            :     {
     638         [ +  - ]:          2 :         sal_Int32 nPos = (m_aInsertRow->get())[0]->getValue();
     639         [ +  - ]:          2 :         m_pFileSet->get().push_back(nPos);
     640 [ +  - ][ +  - ]:          2 :         *(m_aInsertRow->get())[0] = sal_Int32(m_pFileSet->get().size());
                 [ +  - ]
     641         [ +  - ]:          2 :         clearInsertRow();
     642                 :            : 
     643 [ +  - ][ +  - ]:          2 :         m_aSkipDeletedSet.insertNewPosition((m_aRow->get())[0]->getValue());
     644         [ +  - ]:          2 :     }
     645                 :          2 : }
     646                 :            : // -------------------------------------------------------------------------
     647                 :          8 : void SAL_CALL OResultSet::updateRow(  ) throw(SQLException, RuntimeException)
     648                 :            : {
     649                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateRow" );
     650         [ +  - ]:          8 :     ::osl::MutexGuard aGuard( m_aMutex );
     651         [ +  - ]:          8 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     652                 :            : 
     653 [ +  - ][ -  + ]:          8 :     if(!m_pTable || m_pTable->isReadOnly())
                 [ -  + ]
     654 [ #  # ][ #  # ]:          0 :         lcl_throwError(STR_TABLE_READONLY,*this);
     655                 :            : 
     656         [ +  - ]:          8 :     m_bRowUpdated = m_pTable->UpdateRow(*m_aInsertRow, m_aRow,m_xColsIdx);
     657 [ +  - ][ +  - ]:          8 :     *(m_aInsertRow->get())[0] = (sal_Int32)(m_aRow->get())[0]->getValue();
         [ +  - ][ +  - ]
     658                 :            : 
     659 [ +  - ][ +  - ]:          8 :     clearInsertRow();
     660                 :          8 : }
     661                 :            : // -------------------------------------------------------------------------
     662                 :          2 : void SAL_CALL OResultSet::deleteRow() throw(SQLException, RuntimeException)
     663                 :            : {
     664                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deleteRow" );
     665         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
     666         [ +  - ]:          2 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     667                 :            : 
     668                 :            : 
     669 [ +  - ][ -  + ]:          2 :     if(!m_pTable || m_pTable->isReadOnly())
                 [ -  + ]
     670 [ #  # ][ #  # ]:          0 :         lcl_throwError(STR_TABLE_READONLY,*this);
     671         [ -  + ]:          2 :     if (m_bShowDeleted)
     672 [ #  # ][ #  # ]:          0 :         lcl_throwError(STR_DELETE_ROW,*this);
     673         [ -  + ]:          2 :     if(m_aRow->isDeleted())
     674 [ #  # ][ #  # ]:          0 :         lcl_throwError(STR_ROW_ALREADY_DELETED,*this);
     675                 :            : 
     676         [ +  - ]:          2 :     sal_Int32 nPos = (sal_Int32)(m_aRow->get())[0]->getValue();
     677         [ +  - ]:          2 :     m_bRowDeleted = m_pTable->DeleteRow(*m_xColumns);
     678 [ +  - ][ +  - ]:          2 :     if(m_bRowDeleted && m_pFileSet.is())
                 [ +  - ]
     679                 :            :     {
     680                 :          2 :         m_aRow->setDeleted(sal_True);
     681                 :            :         // don't touch the m_pFileSet member here
     682         [ +  - ]:          2 :         m_aSkipDeletedSet.deletePosition(nPos);
     683         [ +  - ]:          2 :     }
     684                 :          2 : }
     685                 :            : // -------------------------------------------------------------------------
     686                 :         40 : void SAL_CALL OResultSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
     687                 :            : {
     688                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::cancelRowUpdates" );
     689         [ +  - ]:         40 :     ::osl::MutexGuard aGuard( m_aMutex );
     690         [ +  - ]:         40 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     691                 :            : 
     692                 :            : 
     693                 :         40 :     m_bInserted     = sal_False;
     694                 :         40 :     m_bRowUpdated   = sal_False;
     695                 :         40 :     m_bRowInserted  = sal_False;
     696                 :         40 :     m_bRowDeleted   = sal_False;
     697                 :            : 
     698         [ +  - ]:         40 :     if(m_aInsertRow.is())
     699                 :            :     {
     700         [ +  - ]:         40 :         OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
     701 [ +  - ][ +  + ]:        720 :         for(;aIter != m_aInsertRow->get().end();++aIter)
     702                 :            :         {
     703                 :        680 :             (*aIter)->setBound(sal_False);
     704         [ +  - ]:        680 :             (*aIter)->setNull();
     705                 :            :         }
     706         [ +  - ]:         40 :     }
     707                 :         40 : }
     708                 :            : // -------------------------------------------------------------------------
     709                 :            : 
     710                 :         42 : void SAL_CALL OResultSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
     711                 :            : {
     712                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToInsertRow" );
     713         [ +  - ]:         42 :     ::osl::MutexGuard aGuard( m_aMutex );
     714         [ +  - ]:         42 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     715                 :            : 
     716 [ +  - ][ -  + ]:         42 :     if(!m_pTable || m_pTable->isReadOnly())
                 [ -  + ]
     717 [ #  # ][ #  # ]:          0 :         lcl_throwError(STR_TABLE_READONLY,*this);
     718                 :            : 
     719                 :         42 :     m_bInserted     = sal_True;
     720                 :            : 
     721         [ +  - ]:         42 :     OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin()+1;
     722 [ +  - ][ +  + ]:        784 :     for(;aIter != m_aInsertRow->get().end();++aIter)
     723                 :            :     {
     724                 :        742 :         (*aIter)->setBound(sal_False);
     725         [ +  - ]:        742 :         (*aIter)->setNull();
     726         [ +  - ]:         42 :     }
     727                 :         42 : }
     728                 :            : // -------------------------------------------------------------------------
     729                 :            : 
     730                 :          0 : void SAL_CALL OResultSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
     731                 :            : {
     732                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::moveToCurrentRow" );
     733                 :          0 : }
     734                 :            : // -------------------------------------------------------------------------
     735                 :         10 : void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException)
     736                 :            : {
     737                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateValue" );
     738         [ +  - ]:         10 :     ::osl::MutexGuard aGuard( m_aMutex );
     739         [ +  - ]:         10 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     740                 :            : 
     741         [ +  - ]:         10 :     checkIndex(columnIndex );
     742         [ +  - ]:         10 :     columnIndex = mapColumn(columnIndex);
     743                 :            : 
     744                 :         10 :     (m_aInsertRow->get())[columnIndex]->setBound(sal_True);
     745 [ +  - ][ +  - ]:         10 :     *(m_aInsertRow->get())[columnIndex] = x;
     746                 :         10 : }
     747                 :            : // -----------------------------------------------------------------------------
     748                 :            : 
     749                 :          0 : void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     750                 :            : {
     751                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNull" );
     752                 :          0 :     ORowSetValue aEmpty;
     753 [ #  # ][ #  # ]:          0 :     updateValue(columnIndex,aEmpty);
     754                 :          0 : }
     755                 :            : // -------------------------------------------------------------------------
     756                 :            : 
     757                 :          0 : void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
     758                 :            : {
     759                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBoolean" );
     760         [ #  # ]:          0 :     updateValue(columnIndex,x);
     761                 :          0 : }
     762                 :            : // -------------------------------------------------------------------------
     763                 :          0 : void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
     764                 :            : {
     765                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateByte" );
     766         [ #  # ]:          0 :     updateValue(columnIndex,x);
     767                 :          0 : }
     768                 :            : // -------------------------------------------------------------------------
     769                 :            : 
     770                 :          0 : void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
     771                 :            : {
     772                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateShort" );
     773         [ #  # ]:          0 :     updateValue(columnIndex,x);
     774                 :          0 : }
     775                 :            : // -------------------------------------------------------------------------
     776                 :          0 : void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
     777                 :            : {
     778                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateInt" );
     779         [ #  # ]:          0 :     updateValue(columnIndex,x);
     780                 :          0 : }
     781                 :            : // -------------------------------------------------------------------------
     782                 :          0 : void SAL_CALL OResultSet::updateLong( sal_Int32 /*columnIndex*/, sal_Int64 /*x*/ ) throw(SQLException, RuntimeException)
     783                 :            : {
     784                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateLong" );
     785         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XRowUpdate::updateLong", *this );
     786                 :          0 : }
     787                 :            : // -----------------------------------------------------------------------
     788                 :          0 : void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
     789                 :            : {
     790                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateFloat" );
     791         [ #  # ]:          0 :     updateValue(columnIndex,x);
     792                 :          0 : }
     793                 :            : // -------------------------------------------------------------------------
     794                 :            : 
     795                 :          0 : void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
     796                 :            : {
     797                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDouble" );
     798         [ #  # ]:          0 :     updateValue(columnIndex,x);
     799                 :          0 : }
     800                 :            : // -------------------------------------------------------------------------
     801                 :         10 : void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
     802                 :            : {
     803                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateString" );
     804         [ +  - ]:         10 :     updateValue(columnIndex,x);
     805                 :         10 : }
     806                 :            : // -------------------------------------------------------------------------
     807                 :          0 : void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
     808                 :            : {
     809                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBytes" );
     810         [ #  # ]:          0 :     updateValue(columnIndex,x);
     811                 :          0 : }
     812                 :            : // -------------------------------------------------------------------------
     813                 :          0 : void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
     814                 :            : {
     815                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateDate" );
     816         [ #  # ]:          0 :     updateValue(columnIndex,x);
     817                 :          0 : }
     818                 :            : // -------------------------------------------------------------------------
     819                 :            : 
     820                 :          0 : void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
     821                 :            : {
     822                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTime" );
     823         [ #  # ]:          0 :     updateValue(columnIndex,x);
     824                 :          0 : }
     825                 :            : // -------------------------------------------------------------------------
     826                 :            : 
     827                 :          0 : void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
     828                 :            : {
     829                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateTimestamp" );
     830         [ #  # ]:          0 :     updateValue(columnIndex,x);
     831                 :          0 : }
     832                 :            : // -------------------------------------------------------------------------
     833                 :            : 
     834                 :          0 : void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
     835                 :            : {
     836                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateBinaryStream" );
     837         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     838         [ #  # ]:          0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     839                 :            : 
     840         [ #  # ]:          0 :     if(!x.is())
     841 [ #  # ][ #  # ]:          0 :         ::dbtools::throwFunctionSequenceException(*this);
     842                 :            : 
     843         [ #  # ]:          0 :     Sequence<sal_Int8> aSeq;
     844 [ #  # ][ #  # ]:          0 :     x->readBytes(aSeq,length);
     845 [ #  # ][ #  # ]:          0 :     updateValue(columnIndex,aSeq);
         [ #  # ][ #  # ]
                 [ #  # ]
     846                 :          0 : }
     847                 :            : // -------------------------------------------------------------------------
     848                 :          0 : void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
     849                 :            : {
     850                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateCharacterStream" );
     851                 :          0 :     updateBinaryStream(columnIndex,x,length);
     852                 :          0 : }
     853                 :            : // -------------------------------------------------------------------------
     854                 :          2 : void SAL_CALL OResultSet::refreshRow(  ) throw(SQLException, RuntimeException)
     855                 :            : {
     856                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::refreshRow" );
     857         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
     858 [ +  - ][ +  - ]:          2 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     859                 :          2 : }
     860                 :            : // -------------------------------------------------------------------------
     861                 :          0 : void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
     862                 :            : {
     863                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateObject" );
     864 [ #  # ][ #  # ]:          0 :     if (!::dbtools::implUpdateObject(this, columnIndex, x))
     865         [ #  # ]:          0 :         throw SQLException();
     866                 :          0 : }
     867                 :            : // -------------------------------------------------------------------------
     868                 :            : 
     869                 :          0 : void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
     870                 :            : {
     871                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::updateNumericObject" );
     872 [ #  # ][ #  # ]:          0 :     if (!::dbtools::implUpdateObject(this, columnIndex, x))
     873         [ #  # ]:          0 :         throw SQLException();
     874                 :          0 : }
     875                 :            : // -------------------------------------------------------------------------
     876                 :          0 : IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
     877                 :            : {
     878                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::createArrayHelper" );
     879         [ #  # ]:          0 :     Sequence< Property > aProps;
     880         [ #  # ]:          0 :     describeProperties(aProps);
     881 [ #  # ][ #  # ]:          0 :     return new ::cppu::OPropertyArrayHelper(aProps);
     882                 :            : }
     883                 :            : // -------------------------------------------------------------------------
     884                 :          0 : IPropertyArrayHelper & OResultSet::getInfoHelper()
     885                 :            : {
     886                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getInfoHelper" );
     887                 :          0 :     return *const_cast<OResultSet*>(this)->getArrayHelper();
     888                 :            : }
     889                 :            : 
     890                 :            : //------------------------------------------------------------------
     891                 :       3126 : sal_Bool OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition,
     892                 :            :                                sal_Int32 nFirstOffset,
     893                 :            :                                sal_Bool bEvaluate,
     894                 :            :                                sal_Bool bRetrieveData)
     895                 :            : {
     896                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" );
     897                 :            :     OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!");
     898                 :            : 
     899                 :            :     // For further Fetch-Operations this information may possibly be changed ...
     900                 :       3126 :     IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition;
     901                 :       3126 :     sal_Int32  nOffset = nFirstOffset;
     902                 :            : 
     903                 :       3126 :     const OSQLColumns & rTableCols = *(m_pTable->getTableColumns());
     904                 :       3126 :     sal_Bool bHasRestriction = m_pSQLAnalyzer->hasRestriction();
     905                 :            : again:
     906                 :            : 
     907                 :            :     // protect from reading over the end when someboby is inserting while we are reading
     908                 :            :     // this method works only for dBase at the moment !!!!
     909 [ +  + ][ +  + ]:       3156 :     if (eCursorPosition == IResultSetHelper::NEXT && m_nFilePos == m_nLastVisitedPos)
     910                 :            :     {
     911                 :         40 :         return sal_False;
     912                 :            :     }
     913                 :            : 
     914 [ +  - ][ -  + ]:       3116 :     if (!m_pTable || !m_pTable->seekRow(eCursorPosition, nOffset, m_nFilePos))
                 [ -  + ]
     915                 :            :     {
     916                 :          0 :         return sal_False;
     917                 :            :     }
     918                 :            : 
     919         [ +  + ]:       3116 :     if (!bEvaluate) // If no evaluation runs, then just fill the results-row
     920                 :            :     {
     921                 :       2856 :         m_pTable->fetchRow(m_aRow,rTableCols, sal_True,bRetrieveData);
     922                 :            :     }
     923                 :            :     else
     924                 :            :     {
     925 [ +  - ][ +  + ]:        260 :         m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
     926                 :            : 
     927   [ +  +  +  + ]:        556 :         if  (   (   !m_bShowDeleted
                 [ +  + ]
           [ +  -  +  + ]
     928                 :        260 :                 &&  m_aEvaluateRow->isDeleted()
     929                 :            :                 )
     930                 :            :             ||  (   bHasRestriction
     931                 :         36 :                 &&  !m_pSQLAnalyzer->evaluateRestriction()
     932                 :            :                 )
     933                 :            :             )
     934                 :            :         {                                                // Evaluate the next record
     935                 :            :             // delete current row in Keyset
     936         [ -  + ]:        214 :             if (m_pEvaluationKeySet)
     937                 :            :             {
     938                 :          0 :                 ++m_aEvaluateIter;
     939 [ #  # ][ #  # ]:          0 :                 if (m_pEvaluationKeySet->end() != m_aEvaluateIter)
     940                 :          0 :                     nOffset = (*m_aEvaluateIter);
     941                 :            :                 else
     942                 :            :                 {
     943                 :          0 :                     return sal_False;
     944                 :            :                 }
     945                 :            :             }
     946         [ +  + ]:        214 :             else if (m_pFileSet.is())
     947                 :            :             {
     948                 :            :                 OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!");
     949                 :         30 :                 eCursorPosition = IResultSetHelper::NEXT;
     950                 :         30 :                 nOffset = 1;
     951                 :            :             }
     952 [ +  - ][ +  - ]:        184 :             else if (eCursorPosition == IResultSetHelper::FIRST ||
                 [ -  + ]
     953                 :            :                      eCursorPosition == IResultSetHelper::NEXT ||
     954                 :            :                      eCursorPosition == IResultSetHelper::ABSOLUTE)
     955                 :            :             {
     956                 :          0 :                 eCursorPosition = IResultSetHelper::NEXT;
     957                 :          0 :                 nOffset = 1;
     958                 :            :             }
     959 [ +  - ][ -  + ]:        184 :             else if (eCursorPosition == IResultSetHelper::LAST ||
     960                 :            :                      eCursorPosition == IResultSetHelper::PRIOR)
     961                 :            :             {
     962                 :          0 :                 eCursorPosition = IResultSetHelper::PRIOR;
     963                 :          0 :                 nOffset = 1;
     964                 :            :             }
     965         [ -  + ]:        184 :             else if (eCursorPosition == IResultSetHelper::RELATIVE)
     966                 :            :             {
     967                 :          0 :                 eCursorPosition = (nOffset >= 0) ? IResultSetHelper::NEXT : IResultSetHelper::PRIOR;
     968                 :            :             }
     969                 :            :             else
     970                 :            :             {
     971                 :        184 :                 return sal_False;
     972                 :            :             }
     973                 :            :             // Try again ...
     974                 :         30 :             goto again;
     975                 :            :         }
     976                 :            :     }
     977                 :            : 
     978                 :            :     // Evaluate may only be set,
     979                 :            :     // if the Keyset will be constructed further
     980   [ +  -  +  - ]:       5804 :     if  (   ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
         [ +  + ][ +  + ]
     981                 :       2902 :         &&  !isCount()
     982                 :            :         &&  bEvaluate
     983                 :            :         )
     984                 :            :     {
     985         [ +  + ]:         46 :         if (m_pSortIndex)
     986                 :            :         {
     987                 :         40 :             OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow );
     988                 :         40 :             m_pSortIndex->AddKeyValue(pKeyValue);
     989                 :            :         }
     990         [ +  - ]:          6 :         else if (m_pFileSet.is())
     991                 :            :         {
     992                 :          6 :             sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue());
     993         [ +  - ]:          6 :             m_pFileSet->get().push_back(nBookmarkValue);
     994                 :            :         }
     995                 :            :     }
     996         [ -  + ]:       2856 :     else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_UPDATE)
     997                 :            :     {
     998                 :          0 :         sal_Bool bOK = sal_True;
     999         [ #  # ]:          0 :         if (bEvaluate)
    1000                 :            :         {
    1001                 :            :             // read the actual result-row
    1002         [ #  # ]:          0 :             bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True);
    1003                 :            :         }
    1004                 :            : 
    1005         [ #  # ]:          0 :         if (bOK)
    1006                 :            :         {
    1007                 :            :             // just give the values to be changed:
    1008         [ #  # ]:          0 :             if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx))
    1009                 :          0 :                 return sal_False;
    1010                 :            :         }
    1011                 :            :     }
    1012         [ -  + ]:       2856 :     else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_DELETE)
    1013                 :            :     {
    1014                 :          0 :         sal_Bool bOK = sal_True;
    1015         [ #  # ]:          0 :         if (bEvaluate)
    1016                 :            :         {
    1017         [ #  # ]:          0 :             bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True);
    1018                 :            :         }
    1019         [ #  # ]:          0 :         if (bOK)
    1020                 :            :         {
    1021         [ #  # ]:          0 :             if(!m_pTable->DeleteRow(*m_xColumns))
    1022                 :          0 :                 return sal_False;
    1023                 :            :         }
    1024                 :            :     }
    1025                 :       3126 :     return sal_True;
    1026                 :            : }
    1027                 :            : 
    1028                 :            : //-------------------------------------------------------------------
    1029                 :       3078 : sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Bool bRetrieveData)
    1030                 :            : {
    1031                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::Move" );
    1032                 :            : 
    1033                 :            : //IgnoreDeletedRows:
    1034                 :            : //
    1035                 :       3078 :     sal_Int32 nTempPos = m_nRowPos;
    1036                 :            : 
    1037   [ +  -  +  - ]:       6156 :     if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT &&
                 [ +  - ]
    1038                 :       3078 :         !isCount())
    1039                 :            :     {
    1040         [ -  + ]:       3078 :         if (!m_pFileSet.is()) //no Index available
    1041                 :            :         {
    1042                 :            :             // Normal FETCH
    1043                 :          0 :             ExecuteRow(eCursorPosition,nOffset,sal_False,bRetrieveData);
    1044                 :            : 
    1045                 :            :             // now set the bookmark for outside this is the logical pos  and not the file pos
    1046 [ #  # ][ #  # ]:          0 :             *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
                 [ #  # ]
    1047                 :            :         }
    1048                 :            :         else
    1049                 :            :         {
    1050   [ +  +  +  -  :       3078 :             switch(eCursorPosition)
                -  +  - ]
    1051                 :            :             {
    1052                 :            :                 case IResultSetHelper::NEXT:
    1053                 :       1448 :                     ++m_nRowPos;
    1054                 :       1448 :                     break;
    1055                 :            :                 case IResultSetHelper::PRIOR:
    1056         [ +  + ]:        972 :                     if (m_nRowPos >= 0)
    1057                 :        966 :                         --m_nRowPos;
    1058                 :        972 :                     break;
    1059                 :            :                 case IResultSetHelper::FIRST:
    1060                 :        110 :                     m_nRowPos = 0;
    1061                 :        110 :                     break;
    1062                 :            :                 case IResultSetHelper::LAST:
    1063                 :          0 :                     m_nRowPos = m_pFileSet->get().size() - 1;
    1064                 :          0 :                     break;
    1065                 :            :                 case IResultSetHelper::RELATIVE:
    1066                 :          0 :                     m_nRowPos += nOffset;
    1067                 :          0 :                     break;
    1068                 :            :                 case IResultSetHelper::ABSOLUTE:
    1069                 :            :                 case IResultSetHelper::BOOKMARK:
    1070         [ +  + ]:        548 :                     if ( m_nRowPos == (nOffset -1) )
    1071                 :        280 :                         return sal_True;
    1072                 :        268 :                     m_nRowPos = nOffset -1;
    1073                 :        268 :                     break;
    1074                 :            :             }
    1075                 :            : 
    1076                 :            :             // OffRange?
    1077                 :            :             // The FileCursor is outside of the valid range, if:
    1078                 :            :             // a.) m_nRowPos < 1
    1079                 :            :             // b.) a KeySet exists and m_nRowPos > m_pFileSet->size()
    1080 [ +  + ][ +  + ]:       2798 :             if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen()
         [ +  + ][ +  + ]
                 [ +  + ]
    1081                 :            :             {
    1082                 :        122 :                 goto Error;
    1083                 :            :             }
    1084                 :            :             else
    1085                 :            :             {
    1086         [ +  + ]:       2676 :                 if (m_nRowPos < (sal_Int32)m_pFileSet->get().size())
    1087                 :            :                 {
    1088                 :            :                     // Fetch via Index
    1089                 :       2632 :                     ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],sal_False,bRetrieveData);
    1090                 :            : 
    1091                 :            :                     // now set the bookmark for outside
    1092 [ +  - ][ +  - ]:       2632 :                     *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
                 [ +  - ]
    1093 [ +  + ][ -  + ]:       2632 :                     if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
         [ -  + ][ -  + ]
    1094                 :            :                     {
    1095                 :          0 :                         m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
    1096                 :            :                     }
    1097                 :            :                 }
    1098                 :            :                 else // Index must be further constructed
    1099                 :            :                 {
    1100                 :            :                     // set first on the last known row
    1101         [ +  + ]:         44 :                     if (!m_pFileSet->get().empty())
    1102                 :            :                     {
    1103         [ +  - ]:         32 :                         m_aFileSetIter = m_pFileSet->get().end()-1;
    1104                 :         32 :                         m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos);
    1105                 :            :                     }
    1106                 :         44 :                     sal_Bool bOK = sal_True;
    1107                 :            :                     // Determine the number of further Fetches
    1108 [ +  + ][ +  + ]:         88 :                     while (bOK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size())
                 [ +  + ]
    1109                 :            :                     {
    1110         [ -  + ]:         44 :                         if (m_pEvaluationKeySet)
    1111                 :            :                         {
    1112         [ #  # ]:          0 :                             if (m_nRowPos >= (sal_Int32)m_pEvaluationKeySet->size())
    1113                 :          0 :                                 return sal_False;
    1114         [ #  # ]:          0 :                             else if (m_nRowPos == 0)
    1115                 :            :                             {
    1116                 :          0 :                                 m_aEvaluateIter = m_pEvaluationKeySet->begin();
    1117                 :          0 :                                 bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData);
    1118                 :            :                             }
    1119                 :            :                             else
    1120                 :            :                             {
    1121                 :          0 :                                 ++m_aEvaluateIter;
    1122                 :          0 :                                 bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData);
    1123                 :            :                             }
    1124                 :            :                         }
    1125                 :            :                         else
    1126                 :         44 :                             bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True, sal_False);//bRetrieveData);
    1127                 :            :                     }
    1128                 :            : 
    1129         [ +  + ]:         44 :                     if (bOK)
    1130                 :            :                     {
    1131                 :            :                         // read the results again
    1132         [ +  - ]:          6 :                         m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), sal_True,bRetrieveData);
    1133                 :            : 
    1134                 :            :                         // now set the bookmark for outside
    1135 [ +  - ][ +  - ]:          6 :                         *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1);
                 [ +  - ]
    1136                 :            : 
    1137 [ -  + ][ #  # ]:          6 :                         if ( (bRetrieveData || m_pSQLAnalyzer->hasRestriction()) && m_pSQLAnalyzer->hasFunctions() )
         [ -  + ][ -  + ]
    1138                 :            :                         {
    1139                 :          0 :                             m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
    1140                 :            :                         }
    1141                 :            :                     }
    1142         [ +  - ]:         38 :                     else if (!m_pFileSet->isFrozen())                   // no valid record found
    1143                 :            :                     {
    1144                 :         38 :                         m_pFileSet->setFrozen();
    1145                 :         38 :                         m_pEvaluationKeySet = NULL;
    1146                 :         38 :                         goto Error;
    1147                 :            :                     }
    1148                 :            :                 }
    1149                 :            :             }
    1150                 :            :         }
    1151                 :            :     }
    1152 [ #  # ][ #  # ]:          0 :     else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && isCount())
                 [ #  # ]
    1153                 :            :     {
    1154                 :            :         // Fetch the COUNT(*)
    1155   [ #  #  #  #  :          0 :         switch (eCursorPosition)
                #  #  # ]
    1156                 :            :         {
    1157                 :            :             case IResultSetHelper::NEXT:
    1158                 :          0 :                 ++m_nRowPos;
    1159                 :          0 :                 break;
    1160                 :            :             case IResultSetHelper::PRIOR:
    1161                 :          0 :                 --m_nRowPos;
    1162                 :          0 :                 break;
    1163                 :            :             case IResultSetHelper::FIRST:
    1164                 :          0 :                 m_nRowPos = 0;
    1165                 :          0 :                 break;
    1166                 :            :             case IResultSetHelper::LAST:
    1167                 :          0 :                 m_nRowPos = 0;
    1168                 :          0 :                 break;
    1169                 :            :             case IResultSetHelper::RELATIVE:
    1170                 :          0 :                 m_nRowPos += nOffset;
    1171                 :          0 :                 break;
    1172                 :            :             case IResultSetHelper::ABSOLUTE:
    1173                 :            :             case IResultSetHelper::BOOKMARK:
    1174                 :          0 :                 m_nRowPos = nOffset - 1;
    1175                 :          0 :                 break;
    1176                 :            :         }
    1177                 :            : 
    1178         [ #  # ]:          0 :         if ( m_nRowPos < 0 )
    1179                 :          0 :             goto Error;
    1180         [ #  # ]:          0 :         else if (m_nRowPos == 0)
    1181                 :            :         {
    1182                 :            :             // put COUNT(*) in result-row
    1183                 :            :             // (must be the first and only variable in the row)
    1184         [ #  # ]:          0 :             if (m_aRow->get().size() >= 2)
    1185                 :            :             {
    1186         [ #  # ]:          0 :                 *(m_aRow->get())[1] = m_nRowCountResult;
    1187 [ #  # ][ #  # ]:          0 :                 *(m_aRow->get())[0] = sal_Int32(1);
                 [ #  # ]
    1188                 :          0 :                 (m_aRow->get())[1]->setBound(sal_True);
    1189                 :          0 :                 (m_aSelectRow->get())[1] = (m_aRow->get())[1];
    1190                 :            :             }
    1191                 :            :         }
    1192                 :            :         else
    1193                 :            :         {
    1194                 :          0 :             m_bEOF = sal_True;
    1195                 :          0 :             m_nRowPos = 1;
    1196                 :          0 :             return sal_False;
    1197                 :            :         }
    1198                 :            :     }
    1199                 :            :     else
    1200                 :            :         // Fetch only possible at SELECT!
    1201                 :          0 :         return sal_False;
    1202                 :            : 
    1203                 :       2638 :     return sal_True;
    1204                 :            : 
    1205                 :            : Error:
    1206                 :            :     // is the Cursor positioned before the first row
    1207                 :            :     // then the position will be maintained
    1208         [ +  + ]:        160 :     if (nTempPos == -1)
    1209                 :         28 :         m_nRowPos = nTempPos;
    1210                 :            :     else
    1211                 :            :     {
    1212   [ +  +  -  - ]:        132 :         switch(eCursorPosition)
    1213                 :            :         {
    1214                 :            :             case IResultSetHelper::PRIOR:
    1215                 :            :             case IResultSetHelper::FIRST:
    1216                 :         42 :                 m_nRowPos = -1;
    1217                 :         42 :                 break;
    1218                 :            :             case IResultSetHelper::LAST:
    1219                 :            :             case IResultSetHelper::NEXT:
    1220                 :            :             case IResultSetHelper::ABSOLUTE:
    1221                 :            :             case IResultSetHelper::RELATIVE:
    1222         [ +  - ]:         90 :                 if (nOffset > 0)
    1223         [ +  - ]:         90 :                     m_nRowPos = m_pFileSet.is() ? (sal_Int32)m_pFileSet->get().size() : -1;
    1224         [ #  # ]:          0 :                 else if (nOffset < 0)
    1225                 :          0 :                     m_nRowPos = -1;
    1226                 :         90 :                 break;
    1227                 :            :             case IResultSetHelper::BOOKMARK:
    1228                 :          0 :                 m_nRowPos = nTempPos;    // last Position
    1229                 :            :         }
    1230                 :            :     }
    1231                 :       3078 :     return sal_False;
    1232                 :            : }
    1233                 :            : // -------------------------------------------------------------------------
    1234                 :          2 : void OResultSet::sortRows()
    1235                 :            : {
    1236                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" );
    1237 [ +  - ][ +  - ]:          2 :     if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1)
         [ +  - ][ +  - ]
    1238                 :            :     {
    1239                 :            :         // is just one field given for sorting
    1240                 :            :         // and this field is indexed, then the Index will be used
    1241                 :          2 :         Reference<XIndexesSupplier> xIndexSup;
    1242 [ +  - ][ +  - ]:          2 :         m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= xIndexSup;
                 [ +  - ]
    1243                 :            : 
    1244                 :          2 :         Reference<XIndexAccess> xIndexes;
    1245         [ +  - ]:          2 :         if(xIndexSup.is())
    1246                 :            :         {
    1247 [ +  - ][ +  - ]:          2 :             xIndexes.set(xIndexSup->getIndexes(),UNO_QUERY);
                 [ +  - ]
    1248                 :          2 :             Reference<XPropertySet> xColProp;
    1249 [ +  - ][ +  - ]:          2 :             if(m_aOrderbyColumnNumber[0] < xIndexes->getCount())
         [ -  + ][ +  - ]
    1250                 :            :             {
    1251 [ #  # ][ #  # ]:          0 :                 xColProp.set(xIndexes->getByIndex(m_aOrderbyColumnNumber[0]),UNO_QUERY);
         [ #  # ][ #  # ]
    1252                 :            :                 // iterate through the indexes to find the matching column
    1253 [ #  # ][ #  # ]:          0 :                 const sal_Int32 nCount = xIndexes->getCount();
    1254         [ #  # ]:          2 :                 for(sal_Int32 i=0; i < nCount;++i)
    1255                 :            :                 {
    1256 [ #  # ][ #  # ]:          0 :                     Reference<XColumnsSupplier> xIndex(xIndexes->getByIndex(i),UNO_QUERY);
                 [ #  # ]
    1257 [ #  # ][ #  # ]:          0 :                     Reference<XNameAccess> xIndexCols = xIndex->getColumns();
    1258 [ #  # ][ #  # ]:          0 :                     if(xIndexCols->hasByName(comphelper::getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1259                 :            :                     {
    1260 [ #  # ][ #  # ]:          0 :                         m_pFileSet = new OKeySet();
    1261                 :            : 
    1262 [ #  # ][ #  # ]:          0 :                         if(fillIndexValues(xIndex))
    1263                 :          2 :                             return;
    1264                 :            :                     }
    1265 [ #  # ][ #  # ]:          0 :                 }
    1266         [ +  - ]:          2 :             }
    1267 [ -  + ][ +  - ]:          2 :         }
    1268                 :            :     }
    1269                 :            : 
    1270         [ +  - ]:          2 :     OSortIndex::TKeyTypeVector eKeyType(m_aOrderbyColumnNumber.size());
    1271                 :          2 :     ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
    1272 [ +  - ][ +  + ]:          4 :     for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
                 [ +  - ]
    1273                 :            :     {
    1274                 :            :         OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index");
    1275 [ +  - ][ +  - ]:          2 :         switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
              [ +  -  - ]
    1276                 :            :         {
    1277                 :            :             case DataType::CHAR:
    1278                 :            :             case DataType::VARCHAR:
    1279                 :            :             case DataType::LONGVARCHAR:
    1280         [ +  - ]:          2 :                 eKeyType[i] = SQL_ORDERBYKEY_STRING;
    1281                 :          2 :                 break;
    1282                 :            : 
    1283                 :            :             case DataType::OTHER:
    1284                 :            :             case DataType::TINYINT:
    1285                 :            :             case DataType::SMALLINT:
    1286                 :            :             case DataType::INTEGER:
    1287                 :            :             case DataType::DECIMAL:
    1288                 :            :             case DataType::NUMERIC:
    1289                 :            :             case DataType::REAL:
    1290                 :            :             case DataType::DOUBLE:
    1291                 :            :             case DataType::DATE:
    1292                 :            :             case DataType::TIME:
    1293                 :            :             case DataType::TIMESTAMP:
    1294                 :            :             case DataType::BIT:
    1295         [ #  # ]:          0 :                 eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
    1296                 :          0 :                 break;
    1297                 :            : 
    1298                 :            :         // Other types aren't implemented (so they are always FALSE)
    1299                 :            :             default:
    1300         [ #  # ]:          0 :                 eKeyType[i] = SQL_ORDERBYKEY_NONE;
    1301                 :            :                 OSL_FAIL("OFILECursor::Execute: Datentyp nicht implementiert");
    1302                 :          0 :                 break;
    1303                 :            :         }
    1304         [ +  - ]:          2 :         (m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True);
    1305                 :            :     }
    1306                 :            : 
    1307         [ +  - ]:          2 :     m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
    1308                 :            : 
    1309         [ -  + ]:          2 :     if (m_pEvaluationKeySet)
    1310                 :            :     {
    1311                 :          0 :         m_aEvaluateIter = m_pEvaluationKeySet->begin();
    1312                 :            : 
    1313 [ #  # ][ #  # ]:          0 :         while (m_aEvaluateIter != m_pEvaluationKeySet->end())
    1314                 :            :         {
    1315 [ #  # ][ #  # ]:          0 :             ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
    1316         [ #  # ]:          0 :             ++m_aEvaluateIter;
    1317                 :            :         }
    1318                 :            :     }
    1319                 :            :     else
    1320                 :            :     {
    1321 [ +  - ][ +  + ]:        226 :         while ( ExecuteRow( IResultSetHelper::NEXT, 1, sal_False, sal_True ) )
    1322                 :            :         {
    1323         [ +  - ]:        224 :             m_aSelectRow->get()[0]->setValue( m_aRow->get()[0]->getValue() );
    1324 [ +  - ][ -  + ]:        224 :             if ( m_pSQLAnalyzer->hasFunctions() )
    1325         [ #  # ]:          0 :                 m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping );
    1326         [ +  - ]:        224 :             const sal_Int32 nBookmark = (*m_aRow->get().begin())->getValue();
    1327         [ +  - ]:        224 :             ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, sal_True, sal_False );
    1328                 :            :         }
    1329                 :            :     }
    1330                 :            : 
    1331                 :            :     // create sorted Keyset
    1332                 :          2 :     m_pEvaluationKeySet = NULL;
    1333         [ +  - ]:          2 :     m_pFileSet = NULL;
    1334 [ +  - ][ +  - ]:          2 :     m_pFileSet = m_pSortIndex->CreateKeySet();
                 [ +  - ]
    1335 [ +  - ][ +  - ]:          2 :     DELETEZ(m_pSortIndex);
    1336                 :            :     // now access to a sorted set is possible via Index
    1337                 :            : }
    1338                 :            : 
    1339                 :            : 
    1340                 :            : // -------------------------------------------------------------------------
    1341                 :         40 : sal_Bool OResultSet::OpenImpl()
    1342                 :            : {
    1343                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OpenImpl" );
    1344                 :            :     OSL_ENSURE(m_pSQLAnalyzer,"No analyzer set with setSqlAnalyzer!");
    1345         [ +  - ]:         40 :     if(!m_pTable)
    1346                 :            :     {
    1347         [ +  - ]:         40 :         const OSQLTables& xTabs = m_aSQLIterator.getTables();
    1348 [ +  - ][ -  + ]:         40 :         if ((xTabs.begin() == xTabs.end()) || !xTabs.begin()->second.is())
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
    1349 [ #  # ][ #  # ]:          0 :             lcl_throwError(STR_QUERY_TOO_COMPLEX,*this);
    1350                 :            : 
    1351 [ +  - ][ -  + ]:         40 :         if ( xTabs.size() > 1 || m_aSQLIterator.hasErrors() )
                 [ -  + ]
    1352 [ #  # ][ #  # ]:          0 :             lcl_throwError(STR_QUERY_MORE_TABLES,*this);
    1353                 :            : 
    1354                 :         40 :         OSQLTable xTable = xTabs.begin()->second;
    1355 [ +  - ][ +  - ]:         40 :         m_xColumns = m_aSQLIterator.getSelectColumns();
                 [ +  - ]
    1356                 :            : 
    1357 [ +  - ][ +  - ]:         40 :         m_xColNames = xTable->getColumns();
                 [ +  - ]
    1358         [ +  - ]:         40 :         m_xColsIdx.set(m_xColNames,UNO_QUERY);
    1359         [ +  - ]:         40 :         doTableSpecials(xTable);
    1360         [ +  - ]:         40 :         Reference<XComponent> xComp(xTable,UNO_QUERY);
    1361         [ +  - ]:         40 :         if(xComp.is())
    1362 [ +  - ][ +  - ]:         40 :             xComp->addEventListener(this);
                 [ +  - ]
    1363                 :            :     }
    1364                 :            : 
    1365                 :         40 :     m_pTable->refreshHeader();
    1366                 :            : 
    1367                 :         40 :     sal_Int32 nColumnCount = m_xColsIdx->getCount();
    1368                 :            : 
    1369                 :         40 :     initializeRow(m_aRow,nColumnCount);
    1370                 :         40 :     initializeRow(m_aEvaluateRow,nColumnCount);
    1371                 :         40 :     initializeRow(m_aInsertRow,nColumnCount);
    1372                 :            : 
    1373                 :            : 
    1374 [ -  + ][ +  - ]:         40 :     m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE;
    1375                 :            : 
    1376                 :            :     // create new Index:
    1377                 :         40 :     m_pFileSet = NULL;
    1378                 :            : 
    1379                 :            :     // position at the beginning
    1380                 :         40 :     m_nRowPos = -1;
    1381                 :         40 :     m_nFilePos  = 0;
    1382                 :         40 :     m_nRowCountResult = -1;
    1383                 :            : 
    1384                 :         40 :     m_nLastVisitedPos = m_pTable->getCurrentLastPos();
    1385                 :            : 
    1386   [ +  -  -  - ]:         40 :     switch(m_aSQLIterator.getStatementType())
    1387                 :            :     {
    1388                 :            :         case SQL_STATEMENT_SELECT:
    1389                 :            :         {
    1390         [ -  + ]:         40 :             if(isCount())
    1391                 :            :             {
    1392         [ #  # ]:          0 :                 if(m_xColumns->get().size() > 1)
    1393         [ #  # ]:          0 :                     lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this);
    1394                 :            : 
    1395                 :          0 :                 m_nRowCountResult = 0;
    1396                 :            :                 // for now simply iterate over all rows and
    1397                 :            :                 // do all actions (or just count)
    1398                 :            :                 {
    1399                 :          0 :                     sal_Bool bOK = sal_True;
    1400         [ #  # ]:          0 :                     if (m_pEvaluationKeySet)
    1401                 :            :                     {
    1402                 :          0 :                         m_aEvaluateIter = m_pEvaluationKeySet->begin();
    1403         [ #  # ]:          0 :                         bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
    1404                 :            : 
    1405                 :            :                     }
    1406         [ #  # ]:          0 :                     while (bOK)
    1407                 :            :                     {
    1408         [ #  # ]:          0 :                         if (m_pEvaluationKeySet)
    1409                 :          0 :                             ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
    1410                 :            :                         else
    1411                 :          0 :                             bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True);
    1412                 :            : 
    1413         [ #  # ]:          0 :                         if (bOK)
    1414                 :            :                         {
    1415                 :          0 :                             m_nRowCountResult++;
    1416         [ #  # ]:          0 :                             if(m_pEvaluationKeySet)
    1417                 :            :                             {
    1418                 :          0 :                                 ++m_aEvaluateIter;
    1419         [ #  # ]:          0 :                                 bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
    1420                 :            :                             }
    1421                 :            :                         }
    1422                 :            :                     }
    1423                 :            : 
    1424                 :            :                     // save result of COUNT(*) in m_nRowCountResult.
    1425                 :            :                     // nRowCount (number of Rows in the result) = 1 for this request!
    1426                 :          0 :                     m_pEvaluationKeySet = NULL;
    1427                 :            :                 }
    1428                 :            :             }
    1429                 :            :             else
    1430                 :            :             {
    1431                 :         40 :                 sal_Bool bDistinct = sal_False;
    1432                 :         40 :                 OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
    1433                 :            : 
    1434                 :            :                 assert(m_aOrderbyColumnNumber.size() ==
    1435                 :            :                        m_aOrderbyAscending.size());
    1436 [ -  + ][ -  + ]:         40 :                 if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT )
                 [ +  - ]
    1437                 :            :                 {
    1438                 :            :                     // To eliminate duplicates we need to sort on all columns.
    1439                 :            :                     // This is not a problem because the SQL spec says that the
    1440                 :            :                     // order of columns that are not specified in ORDER BY
    1441                 :            :                     // clause is undefined, so it doesn't hurt to sort on
    1442                 :            :                     // these; pad the vectors to include them.
    1443         [ #  # ]:          0 :                     for (sal_Int32 i = 1; // 0: bookmark (see setBoundedColumns)
    1444                 :          0 :                          static_cast<size_t>(i) < m_aColMapping.size(); ++i)
    1445                 :            :                     {
    1446 [ #  # ][ #  # ]:          0 :                         if (::std::find(m_aOrderbyColumnNumber.begin(),
    1447                 :          0 :                                         m_aOrderbyColumnNumber.end(), i)
    1448         [ #  # ]:          0 :                                 == m_aOrderbyColumnNumber.end())
    1449                 :            :                         {
    1450         [ #  # ]:          0 :                             m_aOrderbyColumnNumber.push_back(i);
    1451                 :            :                             // ASC or DESC doesn't matter
    1452         [ #  # ]:          0 :                             m_aOrderbyAscending.push_back(SQL_ASC);
    1453                 :            :                         }
    1454                 :            :                     }
    1455                 :          0 :                     bDistinct = sal_True;
    1456                 :            :                 }
    1457                 :            : 
    1458         [ +  + ]:         40 :                 if (IsSorted())
    1459                 :          2 :                     sortRows();
    1460                 :            : 
    1461         [ +  + ]:         40 :                 if (!m_pFileSet.is())
    1462                 :            :                 {
    1463         [ +  - ]:         38 :                     m_pFileSet = new OKeySet();
    1464                 :            : 
    1465         [ +  + ]:         38 :                     if (!m_pSQLAnalyzer->hasRestriction())
    1466                 :            :                     // now the Keyset can be filled!
    1467                 :            :                     // But be careful: It is assumed, that the FilePositions will be stored as sequence 1..n
    1468                 :            :                     {
    1469         [ +  - ]:         26 :                         if ( m_nLastVisitedPos > 0)
    1470                 :         26 :                             m_pFileSet->get().reserve( m_nLastVisitedPos );
    1471         [ +  + ]:       1194 :                         for (sal_Int32 i = 0; i < m_nLastVisitedPos; i++)
    1472         [ +  - ]:       1168 :                             m_pFileSet->get().push_back(i + 1);
    1473                 :            :                     }
    1474                 :            :                 }
    1475                 :            :                 OSL_ENSURE(m_pFileSet.is(),"Kein KeySet vorhanden! :-(");
    1476                 :            : 
    1477 [ -  + ][ #  # ]:         40 :                 if(bDistinct && m_pFileSet.is())
                 [ -  + ]
    1478                 :            :                 {
    1479 [ #  # ][ #  # ]:          0 :                     OValueRow aSearchRow = new OValueVector(m_aRow->get().size());
    1480                 :          0 :                     OValueRefVector::Vector::iterator aRowIter = m_aRow->get().begin();
    1481                 :          0 :                     OValueVector::Vector::iterator aSearchIter = aSearchRow->get().begin();
    1482   [ #  #  #  # ]:          0 :                     for (   ++aRowIter,++aSearchIter;   // the first column is the bookmark column
         [ #  # ][ #  # ]
    1483                 :          0 :                             aRowIter != m_aRow->get().end();
    1484                 :            :                             ++aRowIter,++aSearchIter)
    1485         [ #  # ]:          0 :                         aSearchIter->setBound((*aRowIter)->isBound());
    1486                 :            : 
    1487                 :          0 :                     size_t nMaxRow = m_pFileSet->get().size();
    1488                 :            : 
    1489         [ #  # ]:          0 :                     if (nMaxRow)
    1490                 :            :                     {
    1491                 :            :     #if OSL_DEBUG_LEVEL > 1
    1492                 :            :                         sal_Int32 nFound=0;
    1493                 :            :     #endif
    1494                 :            :                         sal_Int32 nPos;
    1495                 :            :                         sal_Int32 nKey;
    1496                 :            : 
    1497         [ #  # ]:          0 :                         for( size_t j = nMaxRow-1; j > 0; --j)
    1498                 :            :                         {
    1499         [ #  # ]:          0 :                             nPos = (m_pFileSet->get())[j];
    1500         [ #  # ]:          0 :                             ExecuteRow(IResultSetHelper::BOOKMARK,nPos,sal_False);
    1501         [ #  # ]:          0 :                             m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
    1502                 :            :                             { // copy row values
    1503                 :          0 :                                 OValueRefVector::Vector::iterator copyFrom = m_aSelectRow->get().begin();
    1504                 :          0 :                                 OValueVector::Vector::iterator copyTo = aSearchRow->get().begin();
    1505   [ #  #  #  # ]:          0 :                                 for (   ++copyFrom,++copyTo;    // the first column is the bookmark column
         [ #  # ][ #  # ]
    1506                 :          0 :                                         copyFrom != m_aSelectRow->get().end();
    1507                 :            :                                         ++copyFrom,++copyTo)
    1508 [ #  # ][ #  # ]:          0 :                                             *copyTo = *(*copyFrom);
    1509                 :            :                             }
    1510                 :            : 
    1511                 :            :                             // compare with next row
    1512         [ #  # ]:          0 :                             nKey = (m_pFileSet->get())[j-1];
    1513         [ #  # ]:          0 :                             ExecuteRow(IResultSetHelper::BOOKMARK,nKey,sal_False);
    1514         [ #  # ]:          0 :                             m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping);
    1515                 :          0 :                             OValueRefVector::Vector::iterator loopInRow = m_aSelectRow->get().begin();
    1516                 :          0 :                             OValueVector::Vector::iterator existentInSearchRow = aSearchRow->get().begin();
    1517   [ #  #  #  # ]:          0 :                             for (   ++loopInRow,++existentInSearchRow;  // the first column is the bookmark column
         [ #  # ][ #  # ]
    1518                 :          0 :                                     loopInRow != m_aSelectRow->get().end();
    1519                 :            :                                     ++loopInRow,++existentInSearchRow)
    1520                 :            :                             {
    1521 [ #  # ][ #  # ]:          0 :                                 if ( (*loopInRow)->isBound() && !( *(*loopInRow) == *existentInSearchRow) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1522                 :          0 :                                     break;
    1523                 :            :                             }
    1524                 :            : 
    1525 [ #  # ][ #  # ]:          0 :                             if(loopInRow == m_aSelectRow->get().end())
    1526         [ #  # ]:          0 :                                 (m_pFileSet->get())[j] = 0; // Rows match -- Mark for deletion by setting key to 0
    1527                 :            :     #if OSL_DEBUG_LEVEL > 1
    1528                 :            :                             else
    1529                 :            :                                 nFound++;
    1530                 :            :     #endif
    1531                 :            :                         }
    1532                 :            : 
    1533                 :          0 :                         m_pFileSet->get().erase(::std::remove_if(m_pFileSet->get().begin(),m_pFileSet->get().end(),
    1534                 :            :                                                             ::std::bind2nd(::std::equal_to<sal_Int32>(),0))
    1535   [ #  #  #  #  :          0 :                                           ,m_pFileSet->get().end());
                   #  # ]
    1536         [ #  # ]:          0 :                     }
    1537                 :            :                 }
    1538                 :            :             }
    1539                 :         40 :         }   break;
    1540                 :            : 
    1541                 :            :         case SQL_STATEMENT_UPDATE:
    1542                 :            :         case SQL_STATEMENT_DELETE:
    1543                 :            :             // during processing count the number of processed Rows
    1544                 :          0 :             m_nRowCountResult = 0;
    1545                 :            :             // for now simply iterate over all rows and
    1546                 :            :             // run the actions (or simply count):
    1547                 :            :             {
    1548                 :            : 
    1549                 :          0 :                 sal_Bool bOK = sal_True;
    1550         [ #  # ]:          0 :                 if (m_pEvaluationKeySet)
    1551                 :            :                 {
    1552                 :          0 :                     m_aEvaluateIter = m_pEvaluationKeySet->begin();
    1553         [ #  # ]:          0 :                     bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
    1554                 :            : 
    1555                 :            :                 }
    1556         [ #  # ]:          0 :                 while (bOK)
    1557                 :            :                 {
    1558         [ #  # ]:          0 :                     if (m_pEvaluationKeySet)
    1559                 :          0 :                         ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True);
    1560                 :            :                     else
    1561                 :          0 :                         bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True);
    1562                 :            : 
    1563         [ #  # ]:          0 :                     if (bOK)
    1564                 :            :                     {
    1565                 :          0 :                         m_nRowCountResult++;
    1566         [ #  # ]:          0 :                         if(m_pEvaluationKeySet)
    1567                 :            :                         {
    1568                 :          0 :                             ++m_aEvaluateIter;
    1569         [ #  # ]:          0 :                             bOK = m_aEvaluateIter == m_pEvaluationKeySet->end();
    1570                 :            :                         }
    1571                 :            :                     }
    1572                 :            :                 }
    1573                 :            : 
    1574                 :            :                 // save result of COUNT(*) in nRowCountResult.
    1575                 :            :                 // nRowCount (number of rows in the result-set) = 1 for this request!
    1576                 :          0 :                 m_pEvaluationKeySet = NULL;
    1577                 :            :             }
    1578                 :          0 :             break;
    1579                 :            :         case SQL_STATEMENT_INSERT:
    1580                 :          0 :             m_nRowCountResult = 0;
    1581                 :            : 
    1582                 :            :             OSL_ENSURE(m_aAssignValues.is(),"No assign values set!");
    1583         [ #  # ]:          0 :             if(!m_pTable->InsertRow(*m_aAssignValues, sal_True,m_xColsIdx))
    1584                 :            :             {
    1585                 :          0 :                 m_nFilePos  = 0;
    1586                 :          0 :                 return sal_False;
    1587                 :            :             }
    1588                 :            : 
    1589                 :          0 :             m_nRowCountResult = 1;
    1590                 :          0 :             break;
    1591                 :            :         default:
    1592                 :            :             OSL_FAIL( "OResultSet::OpenImpl: unsupported statement type!" );
    1593                 :          0 :             break;
    1594                 :            :     }
    1595                 :            : 
    1596                 :            :     // reset FilePos
    1597                 :         40 :     m_nFilePos  = 0;
    1598                 :            : 
    1599                 :         40 :     return sal_True;
    1600                 :            : }
    1601                 :            : //--------------------------------------------------------------------------
    1602                 :          0 : Sequence< sal_Int8 > OResultSet::getUnoTunnelImplementationId()
    1603                 :            : {
    1604                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getUnoTunnelImplementationId" );
    1605                 :            :     static ::cppu::OImplementationId * pId = 0;
    1606         [ #  # ]:          0 :     if (! pId)
    1607                 :            :     {
    1608 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
    1609         [ #  # ]:          0 :         if (! pId)
    1610                 :            :         {
    1611 [ #  # ][ #  # ]:          0 :             static ::cppu::OImplementationId aId;
    1612                 :          0 :             pId = &aId;
    1613         [ #  # ]:          0 :         }
    1614                 :            :     }
    1615                 :          0 :     return pId->getImplementationId();
    1616                 :            : }
    1617                 :            : 
    1618                 :            : // com::sun::star::lang::XUnoTunnel
    1619                 :            : //------------------------------------------------------------------
    1620                 :          0 : sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException)
    1621                 :            : {
    1622                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getSomething" );
    1623 [ #  # ][ #  # ]:          0 :     return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
                 [ #  # ]
    1624                 :            :                 ? reinterpret_cast< sal_Int64 >( this )
    1625   [ #  #  #  # ]:          0 :                 : 0;
    1626                 :            : }
    1627                 :            : // -----------------------------------------------------------------------------
    1628                 :        176 : void OResultSet::setBoundedColumns(const OValueRefRow& _rRow,
    1629                 :            :                                    const OValueRefRow& _rSelectRow,
    1630                 :            :                                    const ::rtl::Reference<connectivity::OSQLColumns>& _rxColumns,
    1631                 :            :                                    const Reference<XIndexAccess>& _xNames,
    1632                 :            :                                    sal_Bool _bSetColumnMapping,
    1633                 :            :                                    const Reference<XDatabaseMetaData>& _xMetaData,
    1634                 :            :                                    ::std::vector<sal_Int32>& _rColMapping)
    1635                 :            : {
    1636                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::setBoundedColumns" );
    1637 [ +  - ][ +  - ]:        176 :     ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers());
    1638                 :            : 
    1639                 :        176 :     Reference<XPropertySet> xTableColumn;
    1640                 :        176 :     ::rtl::OUString sTableColumnName, sSelectColumnRealName;
    1641                 :            : 
    1642 [ +  - ][ +  - ]:        176 :     const ::rtl::OUString sName     = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME);
    1643 [ +  - ][ +  - ]:        176 :     const ::rtl::OUString sRealName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME);
    1644 [ +  - ][ +  - ]:        176 :     const ::rtl::OUString sType     = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE);
    1645                 :            : 
    1646                 :            :     typedef ::std::map<OSQLColumns::Vector::iterator,sal_Bool> IterMap;
    1647         [ +  - ]:        176 :     IterMap aSelectIters;
    1648         [ +  - ]:        176 :     OValueRefVector::Vector::iterator aRowIter = _rRow->get().begin()+1;
    1649 [ +  - ][ +  + ]:       6784 :     for (sal_Int32 i=0; // the first column is the bookmark column
    1650                 :       3392 :          aRowIter != _rRow->get().end();
    1651                 :            :             ++i, ++aRowIter
    1652                 :            :         )
    1653                 :            :     {
    1654                 :       3216 :         (*aRowIter)->setBound(sal_False);
    1655                 :            :         try
    1656                 :            :         {
    1657                 :            :             // get the table column and it's name
    1658 [ +  - ][ +  - ]:       3216 :             _xNames->getByIndex(i) >>= xTableColumn;
                 [ +  - ]
    1659                 :            :             OSL_ENSURE(xTableColumn.is(), "OResultSet::setBoundedColumns: invalid table column!");
    1660         [ +  - ]:       3216 :             if (xTableColumn.is())
    1661 [ +  - ][ +  - ]:       3216 :                 xTableColumn->getPropertyValue(sName) >>= sTableColumnName;
    1662                 :            :             else
    1663                 :          0 :                 sTableColumnName = ::rtl::OUString();
    1664                 :            : 
    1665                 :            :             // look if we have such a select column
    1666                 :            :             // TODO: would like to have a O(log n) search here ...
    1667 [ +  - ][ +  + ]:      31728 :             for (   OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
    1668         [ #  # ]:      15344 :                     aIter != _rxColumns->get().end();
    1669                 :            :                     ++aIter
    1670                 :            :                 )
    1671                 :            :             {
    1672 [ +  - ][ +  - ]:      13168 :                 if((*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName))
         [ +  - ][ +  - ]
                 [ +  - ]
    1673 [ +  - ][ +  - ]:      13168 :                     (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
    1674                 :            :                 else
    1675 [ #  # ][ #  # ]:          0 :                     (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
    1676                 :            : 
    1677 [ +  + ][ +  - ]:      13168 :                 if ( aCase(sTableColumnName, sSelectColumnRealName) && !(*aRowIter)->isBound() && aSelectIters.end() == aSelectIters.find(aIter) )
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
           [ +  +  #  #  
                   #  # ]
    1678                 :            :                 {
    1679         [ +  - ]:       1040 :                     aSelectIters.insert(IterMap::value_type(aIter,sal_True));
    1680         [ +  + ]:       1040 :                     if(_bSetColumnMapping)
    1681                 :            :                     {
    1682         [ +  - ]:       1016 :                         sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
    1683                 :            :                             // the getXXX methods are 1-based ...
    1684                 :       1016 :                         sal_Int32 nTableColumnPos = i + 1;
    1685                 :            :                             // get first table column is the bookmark column ...
    1686         [ +  - ]:       1016 :                         _rColMapping[nSelectColumnPos] = nTableColumnPos;
    1687         [ +  - ]:       1016 :                         (_rSelectRow->get())[nSelectColumnPos] = *aRowIter;
    1688                 :            :                     }
    1689                 :            : 
    1690                 :       1040 :                     (*aRowIter)->setBound(sal_True);
    1691                 :       1040 :                     sal_Int32 nType = DataType::OTHER;
    1692         [ +  - ]:       1040 :                     if (xTableColumn.is())
    1693 [ +  - ][ +  - ]:       1040 :                         xTableColumn->getPropertyValue(sType) >>= nType;
    1694         [ +  - ]:       1040 :                     (*aRowIter)->setTypeKind(nType);
    1695                 :            : 
    1696                 :            :                     break;
    1697                 :            :                 }
    1698                 :            :             }
    1699                 :            :         }
    1700         [ #  # ]:          0 :         catch (Exception&)
    1701                 :            :         {
    1702                 :            :             OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!");
    1703                 :            :         }
    1704                 :            :     }
    1705                 :            :     // in this case we got more select columns as columns exist in the table
    1706 [ +  + ][ +  - ]:        176 :     if ( _bSetColumnMapping && aSelectIters.size() != _rColMapping.size() )
                 [ +  + ]
    1707                 :            :     {
    1708         [ +  - ]:         88 :         Reference<XNameAccess> xNameAccess(_xNames,UNO_QUERY);
    1709 [ +  - ][ +  - ]:         88 :         Sequence< ::rtl::OUString > aSelectColumns = xNameAccess->getElementNames();
    1710                 :            : 
    1711 [ +  - ][ +  + ]:       2208 :         for (   OSQLColumns::Vector::iterator aIter = _rxColumns->get().begin();
    1712                 :       1104 :                 aIter != _rxColumns->get().end();
    1713                 :            :                     ++aIter
    1714                 :            :                 )
    1715                 :            :         {
    1716 [ +  - ][ -  + ]:       1016 :             if ( aSelectIters.end() == aSelectIters.find(aIter) )
    1717                 :            :             {
    1718 [ #  # ][ #  # ]:          0 :                 if ( (*aIter)->getPropertySetInfo()->hasPropertyByName(sRealName) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1719 [ #  # ][ #  # ]:          0 :                     (*aIter)->getPropertyValue(sRealName) >>= sSelectColumnRealName;
    1720                 :            :                 else
    1721 [ #  # ][ #  # ]:          0 :                     (*aIter)->getPropertyValue(sName) >>= sSelectColumnRealName;
    1722                 :            : 
    1723 [ #  # ][ #  # ]:          0 :                 if ( xNameAccess->hasByName( sSelectColumnRealName ) )
                 [ #  # ]
    1724                 :            :                 {
    1725         [ #  # ]:          0 :                     aSelectIters.insert(IterMap::value_type(aIter,sal_True));
    1726         [ #  # ]:          0 :                     sal_Int32 nSelectColumnPos = aIter - _rxColumns->get().begin() + 1;
    1727                 :          0 :                     const ::rtl::OUString* pBegin = aSelectColumns.getConstArray();
    1728                 :          0 :                     const ::rtl::OUString* pEnd   = pBegin + aSelectColumns.getLength();
    1729         [ #  # ]:          0 :                     for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
    1730                 :            :                     {
    1731         [ #  # ]:          0 :                         if ( aCase(*pBegin, sSelectColumnRealName) )
    1732                 :            :                         {
    1733                 :            :                             // the getXXX methods are 1-based ...
    1734                 :          0 :                             sal_Int32 nTableColumnPos = i + 1;
    1735                 :            :                                 // get first table column is the bookmark column ...
    1736         [ #  # ]:          0 :                             _rColMapping[nSelectColumnPos] = nTableColumnPos;
    1737         [ #  # ]:          0 :                             (_rSelectRow->get())[nSelectColumnPos] = (_rRow->get())[nTableColumnPos];
    1738                 :          0 :                             break;
    1739                 :            :                         }
    1740                 :            :                     }
    1741                 :            :                 }
    1742                 :            :             }
    1743         [ +  - ]:         88 :         }
    1744                 :        176 :     }
    1745                 :        176 : }
    1746                 :            : // -----------------------------------------------------------------------------
    1747                 :       3724 : void SAL_CALL OResultSet::acquire() throw()
    1748                 :            : {
    1749                 :       3724 :     OResultSet_BASE::acquire();
    1750                 :       3724 : }
    1751                 :            : // -----------------------------------------------------------------------------
    1752                 :       3724 : void SAL_CALL OResultSet::release() throw()
    1753                 :            : {
    1754                 :       3724 :     OResultSet_BASE::release();
    1755                 :       3724 : }
    1756                 :            : // -----------------------------------------------------------------------------
    1757                 :          0 : Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo(  ) throw(RuntimeException)
    1758                 :            : {
    1759                 :            :     //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getPropertySetInfo" );
    1760                 :          0 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
    1761                 :            : }
    1762                 :            : // -----------------------------------------------------------------------------
    1763                 :         40 : void OResultSet::doTableSpecials(const OSQLTable& _xTable)
    1764                 :            : {
    1765                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::doTableSpecials" );
    1766         [ +  - ]:         40 :     Reference< ::com::sun::star::lang::XUnoTunnel> xTunnel(_xTable,UNO_QUERY);
    1767         [ +  - ]:         40 :     if(xTunnel.is())
    1768                 :            :     {
    1769 [ +  - ][ +  - ]:         40 :         m_pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
         [ +  - ][ +  - ]
    1770         [ +  - ]:         40 :         if(m_pTable)
    1771                 :         40 :             m_pTable->acquire();
    1772                 :         40 :     }
    1773                 :         40 : }
    1774                 :            : // -----------------------------------------------------------------------------
    1775                 :         10 : void OResultSet::clearInsertRow()
    1776                 :            : {
    1777                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::clearInsertRow" );
    1778                 :         10 :     m_aRow->setDeleted(sal_False); // set to false here because this is the new row
    1779                 :         10 :     OValueRefVector::Vector::iterator aIter = m_aInsertRow->get().begin();
    1780                 :         10 :     const OValueRefVector::Vector::iterator aEnd = m_aInsertRow->get().end();
    1781 [ +  - ][ +  + ]:        170 :     for(sal_Int32 nPos = 0;aIter != aEnd;++aIter,++nPos)
    1782                 :            :     {
    1783                 :        160 :         ORowSetValueDecoratorRef& rValue = (*aIter);
    1784         [ +  + ]:        160 :         if ( rValue->isBound() )
    1785                 :            :         {
    1786         [ +  - ]:         20 :             (m_aRow->get())[nPos]->setValue( (*aIter)->getValue() );
    1787                 :            :         }
    1788                 :        160 :         rValue->setBound(nPos == 0);
    1789                 :        160 :         rValue->setModified(sal_False);
    1790         [ +  - ]:        160 :         rValue->setNull();
    1791                 :            :     }
    1792                 :         10 : }
    1793                 :            : // -----------------------------------------------------------------------------
    1794                 :        120 : void OResultSet::initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount)
    1795                 :            : {
    1796                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::initializeRow" );
    1797         [ +  + ]:        120 :     if(!_rRow.is())
    1798                 :            :     {
    1799         [ +  - ]:         40 :         _rRow   = new OValueRefVector(_nColumnCount);
    1800                 :         40 :         (_rRow->get())[0]->setBound(sal_True);
    1801 [ +  - ][ +  - ]:         40 :         ::std::for_each(_rRow->get().begin()+1,_rRow->get().end(),TSetRefBound(sal_False));
    1802                 :            :     }
    1803                 :        120 : }
    1804                 :            : // -----------------------------------------------------------------------------
    1805                 :          0 : sal_Bool OResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
    1806                 :            : {
    1807                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::fillIndexValues" );
    1808                 :          0 :     return sal_False;
    1809                 :            : }
    1810                 :            : // -----------------------------------------------------------------------------
    1811                 :       2680 : sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData)
    1812                 :            : {
    1813                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::move" );
    1814                 :       2680 :     return Move(_eCursorPosition,_nOffset,_bRetrieveData);
    1815                 :            : }
    1816                 :            : // -----------------------------------------------------------------------------
    1817                 :        382 : sal_Int32 OResultSet::getDriverPos() const
    1818                 :            : {
    1819                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::getDriverPos" );
    1820                 :        382 :     return (m_aRow->get())[0]->getValue();
    1821                 :            : }
    1822                 :            : // -----------------------------------------------------------------------------
    1823                 :          0 : sal_Bool OResultSet::deletedVisible() const
    1824                 :            : {
    1825                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::deletedVisible" );
    1826                 :          0 :     return m_bShowDeleted;
    1827                 :            : }
    1828                 :            : // -----------------------------------------------------------------------------
    1829                 :       2370 : sal_Bool OResultSet::isRowDeleted() const
    1830                 :            : {
    1831                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::isRowDeleted" );
    1832                 :       2370 :     return m_aRow->isDeleted();
    1833                 :            : }
    1834                 :            : // -----------------------------------------------------------------------------
    1835                 :          0 : void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException)
    1836                 :            : {
    1837                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" );
    1838 [ #  # ][ #  # ]:          0 :     Reference<XPropertySet> xProp = m_pTable;
    1839 [ #  # ][ #  # ]:          0 :     if(m_pTable && Source.Source == xProp)
         [ #  # ][ #  # ]
    1840                 :            :     {
    1841                 :          0 :         m_pTable->release();
    1842                 :          0 :         m_pTable = NULL;
    1843                 :          0 :     }
    1844 [ +  - ][ +  - ]:         27 : }
    1845                 :            : // -----------------------------------------------------------------------------
    1846                 :            : 
    1847                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10