LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 937 1542 60.8 %
Date: 2012-08-25 Functions: 97 169 57.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1190 3649 32.6 %

           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                 :            : #include "RowSet.hxx"
      22                 :            : #include "dbastrings.hrc"
      23                 :            : #include "sdbcoretools.hxx"
      24                 :            : #include "SingleSelectQueryComposer.hxx"
      25                 :            : #include "module_dba.hxx"
      26                 :            : #include "CRowSetColumn.hxx"
      27                 :            : #include "CRowSetDataColumn.hxx"
      28                 :            : #include "RowSetCache.hxx"
      29                 :            : #include "core_resource.hrc"
      30                 :            : #include "core_resource.hxx"
      31                 :            : #include "tablecontainer.hxx"
      32                 :            : 
      33                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      34                 :            : #include <com/sun/star/container/XChild.hpp>
      35                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      36                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      37                 :            : #include <com/sun/star/sdb/ErrorCondition.hpp>
      38                 :            : #include <com/sun/star/sdb/RowChangeAction.hpp>
      39                 :            : #include <com/sun/star/sdb/RowSetVetoException.hpp>
      40                 :            : #include <com/sun/star/sdb/XCompletedConnection.hpp>
      41                 :            : #include <com/sun/star/sdb/XParametersSupplier.hpp>
      42                 :            : #include <com/sun/star/sdb/XQueriesSupplier.hpp>
      43                 :            : #include <com/sun/star/sdbc/FetchDirection.hpp>
      44                 :            : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
      45                 :            : #include <com/sun/star/sdbc/XDataSource.hpp>
      46                 :            : #include <com/sun/star/sdbc/XDriverAccess.hpp>
      47                 :            : #include <com/sun/star/sdbcx/CompareBookmark.hpp>
      48                 :            : #include <com/sun/star/sdbcx/Privilege.hpp>
      49                 :            : #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
      50                 :            : #include <com/sun/star/uno/XNamingService.hpp>
      51                 :            : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      52                 :            : 
      53                 :            : #include <comphelper/componentcontext.hxx>
      54                 :            : #include <comphelper/extract.hxx>
      55                 :            : #include <comphelper/interaction.hxx>
      56                 :            : #include <comphelper/property.hxx>
      57                 :            : #include <comphelper/seqstream.hxx>
      58                 :            : #include <comphelper/sequence.hxx>
      59                 :            : #include <comphelper/types.hxx>
      60                 :            : #include <comphelper/uno3.hxx>
      61                 :            : #include <connectivity/BlobHelper.hxx>
      62                 :            : #include <connectivity/dbconversion.hxx>
      63                 :            : #include <connectivity/dbexception.hxx>
      64                 :            : #include <connectivity/dbtools.hxx>
      65                 :            : #include <cppuhelper/exc_hlp.hxx>
      66                 :            : #include <cppuhelper/interfacecontainer.h>
      67                 :            : #include <cppuhelper/typeprovider.hxx>
      68                 :            : #include <rtl/logfile.hxx>
      69                 :            : #include <unotools/syslocale.hxx>
      70                 :            : #include <tools/debug.hxx>
      71                 :            : #include <tools/diagnose_ex.h>
      72                 :            : #include <unotools/configmgr.hxx>
      73                 :            : 
      74                 :            : using namespace utl;
      75                 :            : using namespace dbaccess;
      76                 :            : using namespace connectivity;
      77                 :            : using namespace comphelper;
      78                 :            : using namespace dbtools;
      79                 :            : using namespace ::com::sun::star;
      80                 :            : using namespace ::com::sun::star::uno;
      81                 :            : using namespace ::com::sun::star::beans;
      82                 :            : using namespace ::com::sun::star::sdbc;
      83                 :            : using namespace ::com::sun::star::sdb;
      84                 :            : using namespace ::com::sun::star::sdbcx;
      85                 :            : using namespace ::com::sun::star::container;
      86                 :            : using namespace ::com::sun::star::lang;
      87                 :            : using namespace ::com::sun::star::task;
      88                 :            : using namespace ::com::sun::star::util;
      89                 :            : using namespace ::cppu;
      90                 :            : using namespace ::osl;
      91                 :            : 
      92                 :         32 : extern "C" void SAL_CALL createRegistryInfo_ORowSet()
      93                 :            : {
      94 [ +  - ][ +  - ]:         32 :     static ::dba::OAutoRegistration< ORowSet > aAutoRegistration;
         [ +  - ][ #  # ]
      95                 :         32 : }
      96                 :            : 
      97                 :            : #define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method)                             \
      98                 :            :     Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
      99                 :            :                                                                                   \
     100                 :            :     const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray();     \
     101                 :            :     const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \
     102                 :            :                                                                                   \
     103                 :            :     _rGuard.clear();                                                              \
     104                 :            :     sal_Bool bCheck = sal_True;                                                   \
     105                 :            :     while( pxInt > pxIntBegin && bCheck )                                         \
     106                 :            :     {                                                                             \
     107                 :            :         try                                                                       \
     108                 :            :         {                                                                         \
     109                 :            :             while( pxInt > pxIntBegin && bCheck )                                 \
     110                 :            :             {                                                                     \
     111                 :            :                 --pxInt;                                                          \
     112                 :            :                 bCheck = static_cast< T* >( pxInt->get() )->method(aEvt);         \
     113                 :            :             }                                                                     \
     114                 :            :         }                                                                         \
     115                 :            :         catch( RuntimeException& )                                                \
     116                 :            :         {                                                                         \
     117                 :            :         }                                                                         \
     118                 :            :     }                                                                             \
     119                 :            :     _rGuard.reset();
     120                 :            : 
     121                 :            : 
     122                 :            : namespace dbaccess
     123                 :            : {
     124                 :            : 
     125                 :        304 : Reference< XInterface > ORowSet_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
     126                 :            : {
     127         [ +  - ]:        304 :     return *(new ORowSet(_rxFactory));
     128                 :            : }
     129                 :            : 
     130                 :        304 : ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
     131                 :            :     :ORowSet_BASE1(m_aMutex)
     132                 :            :     ,ORowSetBase( _rxORB, ORowSet_BASE1::rBHelper, &m_aMutex )
     133                 :            :     ,m_pParameters( NULL )
     134                 :            :     ,m_aRowsetListeners(*m_pMutex)
     135                 :            :     ,m_aApproveListeners(*m_pMutex)
     136                 :            :     ,m_aRowsChangeListener(*m_pMutex)
     137                 :            :     ,m_pTables(NULL)
     138                 :            :     ,m_nFetchDirection(FetchDirection::FORWARD)
     139                 :            :     ,m_nFetchSize(50)
     140                 :            :     ,m_nMaxFieldSize(0)
     141                 :            :     ,m_nMaxRows(0)
     142                 :            :     ,m_nQueryTimeOut(0)
     143                 :            :     ,m_nCommandType(CommandType::COMMAND)
     144                 :            :     ,m_nTransactionIsolation(0)
     145                 :            :     ,m_nPrivileges(0)
     146                 :            :     ,m_nInAppend(0)
     147                 :            :     ,m_bUseEscapeProcessing(sal_True)
     148                 :            :     ,m_bApplyFilter(sal_False)
     149                 :            :     ,m_bCommandFacetsDirty( sal_True )
     150                 :            :     ,m_bModified(sal_False)
     151                 :            :     ,m_bRebuildConnOnExecute(sal_False)
     152                 :            :     ,m_bIsBookmarkable(sal_True)
     153                 :            :     ,m_bNew(sal_False)
     154                 :            :     ,m_bCanUpdateInsertedRows(sal_True)
     155                 :            :     ,m_bOwnConnection(sal_False)
     156 [ +  - ][ +  - ]:        304 :     ,m_bPropChangeNotifyEnabled(sal_True)
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     157                 :            : {
     158                 :        304 :     m_nResultSetType = ResultSetType::SCROLL_SENSITIVE;
     159                 :        304 :     m_nResultSetConcurrency = ResultSetConcurrency::UPDATABLE;
     160                 :        304 :     m_pMySelf = this;
     161         [ +  - ]:        304 :     m_aActiveConnection <<= m_xActiveConnection;
     162                 :            : 
     163                 :        304 :     sal_Int32 nRBT  = PropertyAttribute::READONLY   | PropertyAttribute::BOUND      | PropertyAttribute::TRANSIENT;
     164                 :        304 :     sal_Int32 nRT   = PropertyAttribute::READONLY   | PropertyAttribute::TRANSIENT;
     165                 :        304 :     sal_Int32 nBT   = PropertyAttribute::BOUND      | PropertyAttribute::TRANSIENT;
     166                 :            : 
     167         [ +  - ]:        304 :     m_aPrematureParamValues.get().resize( 0 );
     168                 :            : 
     169                 :            :     // sdb.RowSet Properties
     170 [ +  - ][ +  - ]:        304 :     registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::TRANSIENT|PropertyAttribute::BOUND, &m_aActiveConnection,   ::getCppuType(static_cast< Reference< XConnection >* >(0)));
                 [ +  - ]
     171 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_DATASOURCENAME,       PROPERTY_ID_DATASOURCENAME,         PropertyAttribute::BOUND,       &m_aDataSourceName,     ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     172 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_COMMAND,              PROPERTY_ID_COMMAND,                PropertyAttribute::BOUND,       &m_aCommand,            ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     173 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_COMMAND_TYPE,         PROPERTY_ID_COMMAND_TYPE,           PropertyAttribute::BOUND,       &m_nCommandType,        ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     174 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ACTIVECOMMAND,        PROPERTY_ID_ACTIVECOMMAND,          nRBT,                           &m_aActiveCommand,      ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     175 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_IGNORERESULT,         PROPERTY_ID_IGNORERESULT,           PropertyAttribute::BOUND,       &m_bIgnoreResult,       ::getBooleanCppuType());
                 [ +  - ]
     176 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_FILTER,               PROPERTY_ID_FILTER,                 PropertyAttribute::BOUND,       &m_aFilter,             ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     177 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_HAVING_CLAUSE,        PROPERTY_ID_HAVING_CLAUSE,          PropertyAttribute::BOUND,       &m_aHavingClause,       ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     178 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_GROUP_BY,             PROPERTY_ID_GROUP_BY,               PropertyAttribute::BOUND,       &m_aGroupBy,            ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     179 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_APPLYFILTER,          PROPERTY_ID_APPLYFILTER,            PropertyAttribute::BOUND,       &m_bApplyFilter,        ::getBooleanCppuType());
                 [ +  - ]
     180 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ORDER,                PROPERTY_ID_ORDER,                  PropertyAttribute::BOUND,       &m_aOrder,              ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     181 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_PRIVILEGES,           PROPERTY_ID_PRIVILEGES,             nRT,                            &m_nPrivileges,         ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     182 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ISMODIFIED,           PROPERTY_ID_ISMODIFIED,             nBT,                            &m_bModified,           ::getBooleanCppuType());
                 [ +  - ]
     183 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ISNEW,                PROPERTY_ID_ISNEW,                  nRBT,                           &m_bNew,                ::getBooleanCppuType());
                 [ +  - ]
     184 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_SINGLESELECTQUERYCOMPOSER,PROPERTY_ID_SINGLESELECTQUERYCOMPOSER,  nRT,                    &m_xComposer,   ::getCppuType(static_cast< Reference< XSingleSelectQueryComposer >* >(0)));
                 [ +  - ]
     185                 :            : 
     186                 :            :     // sdbcx.ResultSet Properties
     187 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ISBOOKMARKABLE,       PROPERTY_ID_ISBOOKMARKABLE,         nRT,                            &m_bIsBookmarkable,      ::getBooleanCppuType());
                 [ +  - ]
     188 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_CANUPDATEINSERTEDROWS,PROPERTY_ID_CANUPDATEINSERTEDROWS,  nRT,                            &m_bCanUpdateInsertedRows,      ::getBooleanCppuType());
                 [ +  - ]
     189                 :            :     // sdbc.ResultSet Properties
     190 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY,   PropertyAttribute::TRANSIENT,   &m_nResultSetConcurrency,::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     191 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_RESULTSETTYPE,        PROPERTY_ID_RESULTSETTYPE,          PropertyAttribute::TRANSIENT,   &m_nResultSetType,      ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     192 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_FETCHDIRECTION,       PROPERTY_ID_FETCHDIRECTION,         PropertyAttribute::TRANSIENT,   &m_nFetchDirection,     ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     193 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_FETCHSIZE,            PROPERTY_ID_FETCHSIZE,              PropertyAttribute::TRANSIENT,   &m_nFetchSize,          ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     194                 :            : 
     195                 :            :     // sdbc.RowSet Properties
     196 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_URL,                  PROPERTY_ID_URL,                    0,                              &m_aURL,                ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     197 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_TRANSACTIONISOLATION, PROPERTY_ID_TRANSACTIONISOLATION,   PropertyAttribute::TRANSIENT,   &m_nTransactionIsolation,::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     198 [ +  - ][ +  - ]:        304 :     registerMayBeVoidProperty(PROPERTY_TYPEMAP,     PROPERTY_ID_TYPEMAP,                PropertyAttribute::MAYBEVOID|PropertyAttribute::TRANSIENT,  &m_aTypeMap,            ::getCppuType(static_cast< Reference< XNameAccess >* >(0)));
                 [ +  - ]
     199 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_ESCAPE_PROCESSING,PROPERTY_ID_ESCAPE_PROCESSING,  PropertyAttribute::BOUND,       &m_bUseEscapeProcessing,::getBooleanCppuType()  );
                 [ +  - ]
     200 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_QUERYTIMEOUT,         PROPERTY_ID_QUERYTIMEOUT,           PropertyAttribute::TRANSIENT,   &m_nQueryTimeOut,       ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     201 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_MAXFIELDSIZE,         PROPERTY_ID_MAXFIELDSIZE,           PropertyAttribute::TRANSIENT,   &m_nMaxFieldSize,       ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
     202 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_MAXROWS,              PROPERTY_ID_MAXROWS,                0,                              &m_nMaxRows,            ::getCppuType(static_cast< sal_Int32*>(0)) );
                 [ +  - ]
     203 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_USER,                 PROPERTY_ID_USER,                   PropertyAttribute::TRANSIENT,   &m_aUser,               ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     204 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_PASSWORD,             PROPERTY_ID_PASSWORD,               PropertyAttribute::TRANSIENT,   &m_aPassword,           ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     205                 :            : 
     206 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_UPDATE_CATALOGNAME,   PROPERTY_ID_UPDATE_CATALOGNAME,     PropertyAttribute::BOUND,       &m_aUpdateCatalogName,  ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     207 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_UPDATE_SCHEMANAME,    PROPERTY_ID_UPDATE_SCHEMANAME,      PropertyAttribute::BOUND,       &m_aUpdateSchemaName,   ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     208 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_UPDATE_TABLENAME,     PROPERTY_ID_UPDATE_TABLENAME,       PropertyAttribute::BOUND,       &m_aUpdateTableName,    ::getCppuType(static_cast< ::rtl::OUString*>(0)));
                 [ +  - ]
     209                 :            : 
     210                 :            :     // ???
     211 [ +  - ][ +  - ]:        304 :     registerProperty(PROPERTY_CHANGE_NOTIFICATION_ENABLED, PROPERTY_ID_PROPCHANGE_NOTIFY, PropertyAttribute::BOUND,     &m_bPropChangeNotifyEnabled, ::getBooleanCppuType());
                 [ +  - ]
     212                 :        304 : }
     213                 :            : 
     214 [ +  - ][ +  - ]:        297 : ORowSet::~ORowSet()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     215                 :            : {
     216 [ -  + ][ #  # ]:        297 :     if ( !m_rBHelper.bDisposed && !m_rBHelper.bInDispose )
     217                 :            :     {
     218                 :            :         OSL_FAIL("Please check who doesn't dispose this component!");
     219         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     220         [ #  # ]:          0 :         dispose();
     221                 :            :     }
     222         [ -  + ]:        594 : }
     223                 :            : 
     224                 :          0 : void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
     225                 :            : {
     226   [ #  #  #  #  :          0 :     switch( _nHandle )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     227                 :            :     {
     228                 :            :         case PROPERTY_ID_COMMAND_TYPE:
     229         [ #  # ]:          0 :             _rDefault <<= static_cast<sal_Int32>(CommandType::COMMAND);
     230                 :          0 :             break;
     231                 :            :         case PROPERTY_ID_IGNORERESULT:
     232         [ #  # ]:          0 :             _rDefault <<= sal_False;
     233                 :          0 :             break;
     234                 :            :         case PROPERTY_ID_APPLYFILTER:
     235         [ #  # ]:          0 :             _rDefault <<= sal_False;
     236                 :          0 :             break;
     237                 :            :         case PROPERTY_ID_ISMODIFIED:
     238         [ #  # ]:          0 :             _rDefault <<= sal_False;
     239                 :          0 :             break;
     240                 :            :         case PROPERTY_ID_ISBOOKMARKABLE:
     241         [ #  # ]:          0 :             _rDefault <<= sal_True;
     242                 :          0 :             break;
     243                 :            :         case PROPERTY_ID_CANUPDATEINSERTEDROWS:
     244         [ #  # ]:          0 :             _rDefault <<= sal_True;
     245                 :          0 :             break;
     246                 :            :         case PROPERTY_ID_RESULTSETTYPE:
     247                 :          0 :             _rDefault <<= ResultSetType::SCROLL_INSENSITIVE;
     248                 :          0 :             break;
     249                 :            :         case PROPERTY_ID_RESULTSETCONCURRENCY:
     250                 :          0 :             _rDefault <<= ResultSetConcurrency::UPDATABLE;
     251                 :          0 :             break;
     252                 :            :         case PROPERTY_ID_FETCHDIRECTION:
     253                 :          0 :             _rDefault <<= FetchDirection::FORWARD;
     254                 :          0 :             break;
     255                 :            :         case PROPERTY_ID_FETCHSIZE:
     256         [ #  # ]:          0 :             _rDefault <<= static_cast<sal_Int32>(1);
     257                 :          0 :             break;
     258                 :            :         case PROPERTY_ID_ESCAPE_PROCESSING:
     259         [ #  # ]:          0 :             _rDefault <<= sal_True;
     260                 :          0 :             break;
     261                 :            :         case PROPERTY_ID_MAXROWS:
     262         [ #  # ]:          0 :             _rDefault <<= sal_Int32( 0 );
     263                 :          0 :             break;
     264                 :            :         case PROPERTY_ID_FILTER:
     265                 :            :         case PROPERTY_ID_HAVING_CLAUSE:
     266                 :            :         case PROPERTY_ID_GROUP_BY:
     267                 :            :         case PROPERTY_ID_ORDER:
     268                 :            :         case PROPERTY_ID_UPDATE_CATALOGNAME:
     269                 :            :         case PROPERTY_ID_UPDATE_SCHEMANAME:
     270                 :            :         case PROPERTY_ID_UPDATE_TABLENAME:
     271         [ #  # ]:          0 :             _rDefault <<= ::rtl::OUString();
     272                 :          0 :             break;
     273                 :            :     }
     274                 :          0 : }
     275                 :            : 
     276                 :            : //  typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_Prop;
     277                 :       1483 : void SAL_CALL ORowSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
     278                 :            : {
     279      [ +  +  + ]:       1483 :     switch(nHandle)
     280                 :            :     {
     281                 :            :         case PROPERTY_ID_ISMODIFIED:
     282                 :         12 :             m_bModified = cppu::any2bool(rValue);
     283                 :         12 :             break;
     284                 :            :         case PROPERTY_ID_FETCHDIRECTION:
     285         [ -  + ]:          6 :             if( m_nResultSetType == ResultSetType::FORWARD_ONLY)
     286         [ #  # ]:          0 :                 throw Exception(); // else run through
     287                 :            :         default:
     288                 :       1471 :             OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
     289                 :            :     }
     290                 :            : 
     291 [ +  + ][ +  + ]:       1483 :     if  (   ( nHandle == PROPERTY_ID_ACTIVE_CONNECTION )
         [ +  + ][ +  + ]
         [ +  + ][ +  + ]
         [ +  + ][ +  + ]
         [ +  + ][ +  + ]
         [ +  + ][ +  + ]
     292                 :            :         ||  ( nHandle == PROPERTY_ID_DATASOURCENAME )
     293                 :            :         ||  ( nHandle == PROPERTY_ID_COMMAND )
     294                 :            :         ||  ( nHandle == PROPERTY_ID_COMMAND_TYPE )
     295                 :            :         ||  ( nHandle == PROPERTY_ID_IGNORERESULT )
     296                 :            :         ||  ( nHandle == PROPERTY_ID_FILTER )
     297                 :            :         ||  ( nHandle == PROPERTY_ID_HAVING_CLAUSE )
     298                 :            :         ||  ( nHandle == PROPERTY_ID_GROUP_BY )
     299                 :            :         ||  ( nHandle == PROPERTY_ID_APPLYFILTER )
     300                 :            :         ||  ( nHandle == PROPERTY_ID_ORDER )
     301                 :            :         ||  ( nHandle == PROPERTY_ID_URL )
     302                 :            :         ||  ( nHandle == PROPERTY_ID_USER )
     303                 :            :         )
     304                 :            :     {
     305                 :       1333 :         m_bCommandFacetsDirty = sal_True;
     306                 :            :     }
     307                 :            : 
     308                 :            : 
     309   [ +  +  +  +  :       1483 :     switch(nHandle)
                -  +  + ]
     310                 :            :     {
     311                 :            :         case PROPERTY_ID_ACTIVE_CONNECTION:
     312                 :            :             // the new connection
     313                 :            :             {
     314         [ +  - ]:        263 :                 Reference< XConnection > xNewConnection(m_aActiveConnection,UNO_QUERY);
     315         [ +  - ]:        263 :                 setActiveConnection(xNewConnection, sal_False);
     316                 :            :             }
     317                 :            : 
     318                 :        263 :             m_bOwnConnection        = sal_False;
     319                 :        263 :             m_bRebuildConnOnExecute = sal_False;
     320                 :        263 :             break;
     321                 :            : 
     322                 :            :         case PROPERTY_ID_DATASOURCENAME:
     323         [ +  + ]:        192 :             if(!m_xStatement.is())
     324                 :            :             {
     325                 :        178 :                 Reference< XConnection >  xNewConn;
     326                 :        178 :                 Any aNewConn;
     327         [ +  - ]:        178 :                 aNewConn <<= xNewConn;
     328         [ +  - ]:        178 :                 setFastPropertyValue(PROPERTY_ID_ACTIVE_CONNECTION, aNewConn);
     329                 :            :             }
     330                 :            :             else
     331                 :         14 :                 m_bRebuildConnOnExecute = sal_True;
     332                 :        192 :             break;
     333                 :            :         case PROPERTY_ID_FETCHSIZE:
     334         [ +  + ]:         30 :             if(m_pCache)
     335                 :            :             {
     336                 :          6 :                 m_pCache->setFetchSize(m_nFetchSize);
     337                 :          6 :                 fireRowcount();
     338                 :            :             }
     339                 :         30 :             break;
     340                 :            :         case PROPERTY_ID_URL:
     341                 :            :             // is the connection-to-be-built determined by the url (which is the case if m_aDataSourceName is empty) ?
     342         [ -  + ]:          2 :             if (m_aDataSourceName.isEmpty())
     343                 :            :             {
     344                 :            :                 // are we active at the moment ?
     345         [ #  # ]:          0 :                 if (m_xStatement.is())
     346                 :            :                     // yes -> the next execute needs to rebuild our connection because of this new property
     347                 :          0 :                     m_bRebuildConnOnExecute = sal_True;
     348                 :            :                 else
     349                 :            :                 {   // no -> drop our active connection (if we have one) as it doesn't correspond to this new property value anymore
     350                 :          0 :                     Reference< XConnection >  xNewConn;
     351                 :          0 :                     Any aNewConn;
     352         [ #  # ]:          0 :                     aNewConn <<= xNewConn;
     353         [ #  # ]:          0 :                     setFastPropertyValue(PROPERTY_ID_ACTIVE_CONNECTION, aNewConn);
     354                 :            :                 }
     355                 :            :             }
     356                 :          2 :             m_bOwnConnection = sal_True;
     357                 :          2 :             break;
     358                 :            :         case PROPERTY_ID_TYPEMAP:
     359                 :          0 :             ::cppu::extractInterface(m_xTypeMap,m_aTypeMap);
     360                 :          0 :             break;
     361                 :            :         case PROPERTY_ID_PROPCHANGE_NOTIFY:
     362                 :          8 :             m_bPropChangeNotifyEnabled = ::cppu::any2bool(rValue);
     363                 :          8 :             break;
     364                 :            :         default:
     365                 :        988 :             break;
     366                 :            :     };
     367                 :       1483 : }
     368                 :            : 
     369                 :       1961 : void SAL_CALL ORowSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
     370                 :            : {
     371         [ +  + ]:       1961 :     if(m_pCache)
     372                 :            :     {
     373   [ +  +  +  +  :        848 :         switch(nHandle)
                   +  + ]
     374                 :            :         {
     375                 :            :         case PROPERTY_ID_ISMODIFIED:
     376                 :         58 :             rValue.setValue(&m_bModified,::getCppuBooleanType());
     377                 :         58 :             break;
     378                 :            :         case PROPERTY_ID_ISNEW:
     379                 :         18 :             rValue.setValue(&m_bNew,::getCppuBooleanType());
     380                 :         18 :             break;
     381                 :            :         case PROPERTY_ID_PRIVILEGES:
     382                 :          6 :             rValue <<= m_pCache->m_nPrivileges;
     383                 :          6 :             break;
     384                 :            :         case PROPERTY_ID_ACTIVE_CONNECTION:
     385                 :        122 :             rValue <<= m_xActiveConnection;
     386                 :        122 :             break;
     387                 :            :         case PROPERTY_ID_TYPEMAP:
     388                 :          4 :             rValue <<= m_xTypeMap;
     389                 :          4 :             break;
     390                 :            :         default:
     391                 :        848 :             ORowSetBase::getFastPropertyValue(rValue,nHandle);
     392                 :            :         };
     393                 :            :     }
     394                 :            :     else
     395                 :            :     {
     396   [ +  -  -  + ]:       1113 :         switch(nHandle)
     397                 :            :         {
     398                 :            :             case PROPERTY_ID_ACTIVE_CONNECTION:
     399                 :        633 :                 rValue <<= m_xActiveConnection;
     400                 :        633 :                 break;
     401                 :            :             case PROPERTY_ID_TYPEMAP:
     402                 :          0 :                 rValue <<= m_xTypeMap;
     403                 :          0 :                 break;
     404                 :            :             case PROPERTY_ID_PROPCHANGE_NOTIFY:
     405                 :          0 :                 rValue <<= m_bPropChangeNotifyEnabled;
     406                 :          0 :                 break;
     407                 :            :             default:
     408                 :        480 :                 ORowSetBase::getFastPropertyValue(rValue,nHandle);
     409                 :            :         }
     410                 :            :     }
     411                 :       1961 : }
     412                 :            : 
     413                 :            : // com::sun::star::XTypeProvider
     414                 :          2 : Sequence< Type > SAL_CALL ORowSet::getTypes() throw (RuntimeException)
     415                 :            : {
     416         [ +  - ]:          2 :     OTypeCollection aTypes(::getCppuType( (const Reference< XPropertySet > *)0 ),
     417         [ +  - ]:          2 :                             ::getCppuType( (const Reference< XFastPropertySet > *)0 ),
     418         [ +  - ]:          2 :                             ::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
     419 [ +  - ][ +  - ]:          4 :                            ::comphelper::concatSequences(ORowSet_BASE1::getTypes(),ORowSetBase::getTypes()));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     420 [ +  - ][ +  - ]:          2 :     return aTypes.getTypes();
     421                 :            : }
     422                 :            : 
     423                 :          2 : Sequence< sal_Int8 > SAL_CALL ORowSet::getImplementationId() throw (RuntimeException)
     424                 :            : {
     425                 :            :     static OImplementationId * pId = 0;
     426         [ +  - ]:          2 :     if (! pId)
     427                 :            :     {
     428 [ +  - ][ +  - ]:          2 :         MutexGuard aGuard( Mutex::getGlobalMutex() );
     429         [ +  - ]:          2 :         if (! pId)
     430                 :            :         {
     431 [ +  - ][ +  - ]:          2 :             static OImplementationId aId;
     432                 :          2 :             pId = &aId;
     433         [ +  - ]:          2 :         }
     434                 :            :     }
     435                 :          2 :     return pId->getImplementationId();
     436                 :            : }
     437                 :            : 
     438                 :            : // com::sun::star::XInterface
     439                 :       4457 : Any SAL_CALL ORowSet::queryInterface( const Type & rType ) throw (RuntimeException)
     440                 :            : {
     441                 :       4457 :     return ORowSet_BASE1::queryInterface( rType);
     442                 :            : }
     443                 :            : 
     444                 :      15808 : void SAL_CALL ORowSet::acquire() throw()
     445                 :            : {
     446                 :      15808 :     ORowSet_BASE1::acquire();
     447                 :      15808 : }
     448                 :            : 
     449                 :      15712 : void SAL_CALL ORowSet::release() throw()
     450                 :            : {
     451                 :      15712 :     ORowSet_BASE1::release();
     452                 :      15712 : }
     453                 :            : 
     454                 :            : // com::sun::star::XUnoTunnel
     455                 :          0 : sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
     456                 :            : {
     457 [ #  # ][ #  # ]:          0 :     if (rId.getLength() == 16 && 0 == rtl_compareMemory(getImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     458                 :          0 :         return reinterpret_cast<sal_Int64>(this);
     459                 :            : 
     460                 :          0 :     return 0;
     461                 :            : }
     462                 :            : 
     463                 :            : // com::sun::star::XAggregation
     464                 :       5688 : Any SAL_CALL ORowSet::queryAggregation( const Type& rType ) throw(RuntimeException)
     465                 :            : {
     466                 :       5688 :     Any aRet(ORowSetBase::queryInterface(rType));
     467         [ +  + ]:       5688 :     if (!aRet.hasValue())
     468         [ +  - ]:       3108 :         aRet = ORowSet_BASE1::queryAggregation(rType);
     469                 :       5688 :     return aRet;
     470                 :            : }
     471                 :            : 
     472                 :         32 : rtl::OUString ORowSet::getImplementationName_static(  ) throw(RuntimeException)
     473                 :            : {
     474                 :         32 :     return rtl::OUString("com.sun.star.comp.dba.ORowSet");
     475                 :            : }
     476                 :            : 
     477                 :            : // ::com::sun::star::XServiceInfo
     478                 :          0 : ::rtl::OUString SAL_CALL ORowSet::getImplementationName(  ) throw(RuntimeException)
     479                 :            : {
     480                 :          0 :     return getImplementationName_static();
     481                 :            : }
     482                 :            : 
     483                 :          8 : sal_Bool SAL_CALL ORowSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
     484                 :            : {
     485 [ +  - ][ +  - ]:          8 :     return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
     486                 :            : }
     487                 :            : 
     488                 :         40 : Sequence< ::rtl::OUString > ORowSet::getSupportedServiceNames_static(  ) throw (RuntimeException)
     489                 :            : {
     490                 :         40 :     Sequence< rtl::OUString > aSNS( 5 );
     491 [ +  - ][ +  - ]:         40 :     aSNS[0] = SERVICE_SDBC_RESULTSET;
     492 [ +  - ][ +  - ]:         40 :     aSNS[1] = SERVICE_SDBC_ROWSET;
     493 [ +  - ][ +  - ]:         40 :     aSNS[2] = SERVICE_SDBCX_RESULTSET;
     494 [ +  - ][ +  - ]:         40 :     aSNS[3] = SERVICE_SDB_RESULTSET;
     495 [ +  - ][ +  - ]:         40 :     aSNS[4] = SERVICE_SDB_ROWSET;
     496                 :         40 :     return aSNS;
     497                 :            : }
     498                 :            : 
     499                 :          8 : Sequence< ::rtl::OUString > SAL_CALL ORowSet::getSupportedServiceNames(  ) throw(RuntimeException)
     500                 :            : {
     501                 :          8 :     return getSupportedServiceNames_static();
     502                 :            : }
     503                 :            : 
     504                 :        304 : Reference< XInterface > ORowSet::Create(const Reference< XComponentContext >& _rxContext)
     505                 :            : {
     506         [ +  - ]:        304 :     ::comphelper::ComponentContext aContext( _rxContext );
     507 [ +  - ][ +  - ]:        304 :     return ORowSet_CreateInstance( aContext.getLegacyServiceFactory() );
                 [ +  - ]
     508                 :            : }
     509                 :            : 
     510                 :            : // OComponentHelper
     511                 :        300 : void SAL_CALL ORowSet::disposing()
     512                 :            : {
     513         [ +  - ]:        300 :     OPropertyStateContainer::disposing();
     514                 :            : 
     515         [ +  - ]:        300 :     MutexGuard aGuard(m_aMutex);
     516         [ +  - ]:        300 :     EventObject aDisposeEvent;
     517         [ +  - ]:        300 :     aDisposeEvent.Source = static_cast< XComponent* >(this);
     518         [ +  - ]:        300 :     m_aRowsetListeners.disposeAndClear( aDisposeEvent );
     519         [ +  - ]:        300 :     m_aApproveListeners.disposeAndClear( aDisposeEvent );
     520         [ +  - ]:        300 :     m_aRowsChangeListener.disposeAndClear( aDisposeEvent );
     521                 :            : 
     522         [ +  - ]:        300 :     freeResources( true );
     523                 :            : 
     524                 :            :     // remove myself as dispose listener
     525         [ +  - ]:        300 :     Reference< XComponent >  xComponent(m_xActiveConnection, UNO_QUERY);
     526         [ +  + ]:        300 :     if (xComponent.is())
     527                 :            :     {
     528                 :         22 :         Reference<XEventListener> xEvt;
     529 [ +  - ][ +  - ]:         22 :         query_aggregation(this,xEvt);
     530 [ +  - ][ +  - ]:         22 :         xComponent->removeEventListener(xEvt);
     531                 :            :     }
     532                 :            : 
     533                 :        300 :     m_aActiveConnection = Any(); // the any conatains a reference too
     534         [ +  + ]:        300 :     if(m_bOwnConnection)
     535         [ +  - ]:         24 :         ::comphelper::disposeComponent(m_xActiveConnection);
     536         [ +  - ]:        300 :     m_xActiveConnection = NULL;
     537                 :            : 
     538                 :            : 
     539 [ +  - ][ +  - ]:        300 :     ORowSetBase::disposing();
                 [ +  - ]
     540                 :        300 : }
     541                 :            : 
     542                 :        438 : void ORowSet::freeResources( bool _bComplete )
     543                 :            : {
     544         [ +  - ]:        438 :     MutexGuard aGuard(m_aMutex);
     545                 :            : 
     546                 :            :     // free all clones
     547                 :        438 :     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
     548 [ +  - ][ +  + ]:        442 :     for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i)
                 [ +  - ]
     549                 :            :     {
     550 [ +  - ][ +  - ]:          4 :         Reference< XComponent > xComp(i->get(), UNO_QUERY);
                 [ +  - ]
     551         [ +  - ]:          4 :         if (xComp.is())
     552 [ +  - ][ +  - ]:          4 :             xComp->dispose();
     553                 :          4 :     }
     554                 :        438 :     m_aClones.clear();
     555                 :            : 
     556         [ +  - ]:        438 :     if ( _bComplete )
     557                 :            :     {
     558                 :            :         // the columns must be disposed before the querycomposer is disposed because
     559                 :            :         // their owner can be the composer
     560         [ +  - ]:        438 :         TDataColumns().swap(m_aDataColumns);// clear and resize capacity
     561         [ +  - ]:        438 :         m_xColumns      = NULL;
     562         [ +  + ]:        438 :         if ( m_pColumns )
     563         [ +  - ]:         52 :             m_pColumns->disposing();
     564                 :            :         // dispose the composer to avoid that everbody knows that the querycomposer is eol
     565         [ +  - ]:        438 :         try { ::comphelper::disposeComponent( m_xComposer ); }
     566   [ #  #  #  # ]:          0 :         catch(Exception&)
     567                 :            :         {
     568                 :            :             DBG_UNHANDLED_EXCEPTION();
     569         [ #  # ]:          0 :             m_xComposer = NULL;
     570                 :            :         }
     571                 :            : 
     572                 :            :         // let our warnings container forget the reference to the (possibly disposed) old result set
     573 [ +  - ][ +  - ]:        438 :         m_aWarnings.setExternalWarnings( NULL );
     574                 :            : 
     575 [ +  - ][ +  + ]:        438 :         DELETEZ(m_pCache);
     576                 :            : 
     577         [ +  - ]:        438 :         impl_resetTables_nothrow();
     578                 :            : 
     579         [ +  - ]:        438 :         m_xStatement    = NULL;
     580         [ +  - ]:        438 :         m_xTypeMap      = NULL;
     581                 :            : 
     582                 :        438 :         m_aBookmark     = Any();
     583                 :        438 :         m_bBeforeFirst  = sal_True;
     584                 :        438 :         m_bAfterLast    = sal_False;
     585                 :        438 :         m_bNew          = sal_False;
     586                 :        438 :         m_bModified     = sal_False;
     587                 :        438 :         m_bIsInsertRow  = sal_False;
     588                 :        438 :         m_bLastKnownRowCountFinal = sal_False;
     589                 :        438 :         m_nLastKnownRowCount      = 0;
     590         [ +  + ]:        438 :         if ( m_aOldRow.is() )
     591         [ +  - ]:         52 :             m_aOldRow->clearRow();
     592                 :            : 
     593         [ +  - ]:        438 :         impl_disposeParametersContainer_nothrow();
     594                 :            : 
     595                 :        438 :         m_bCommandFacetsDirty = sal_True;
     596         [ +  - ]:        438 :     }
     597                 :        438 : }
     598                 :            : 
     599                 :        359 : void ORowSet::setActiveConnection( Reference< XConnection >& _rxNewConn, sal_Bool _bFireEvent )
     600                 :            : {
     601 [ +  - ][ +  - ]:        359 :     if (_rxNewConn.get() == m_xActiveConnection.get())
                 [ +  + ]
     602                 :            :         // nothing to do
     603                 :        359 :         return;
     604                 :            : 
     605                 :            :     // remove the event listener for the old connection
     606         [ +  - ]:         78 :     Reference< XComponent >  xComponent(m_xActiveConnection, UNO_QUERY);
     607         [ +  + ]:         78 :     if (xComponent.is())
     608                 :            :     {
     609                 :         28 :         Reference<XEventListener> xListener;
     610 [ +  - ][ +  - ]:         28 :         query_aggregation(this, xListener);
     611 [ +  - ][ +  - ]:         28 :         xComponent->removeEventListener(xListener);
     612                 :            :     }
     613                 :            : 
     614                 :            :     // if we owned the connection, remember it for later disposing
     615         [ +  + ]:         78 :     if(m_bOwnConnection)
     616         [ +  - ]:          2 :         m_xOldConnection = m_xActiveConnection;
     617                 :            : 
     618                 :            :     // for firing the PropertyChangeEvent
     619                 :         78 :     sal_Int32 nHandle = PROPERTY_ID_ACTIVE_CONNECTION;
     620         [ +  - ]:         78 :     Any aOldConnection; aOldConnection <<= m_xActiveConnection;
     621         [ +  - ]:         78 :     Any aNewConnection; aNewConnection <<= _rxNewConn;
     622                 :            : 
     623                 :            :     // set the new connection
     624         [ +  - ]:         78 :     m_xActiveConnection = _rxNewConn;
     625         [ +  + ]:         78 :     if (m_xActiveConnection.is())
     626         [ +  - ]:         50 :         m_aActiveConnection <<= m_xActiveConnection;
     627                 :            :     else
     628                 :         28 :         m_aActiveConnection.clear();
     629                 :            : 
     630                 :            :     // fire the event
     631         [ +  + ]:         78 :     if (_bFireEvent)
     632         [ +  - ]:         52 :         fire(&nHandle, &aNewConnection, &aOldConnection, 1, sal_False);
     633                 :            : 
     634                 :            :     // register as event listener for the new connection
     635         [ +  - ]:         78 :     xComponent.set(m_xActiveConnection,UNO_QUERY);
     636         [ +  + ]:         78 :     if (xComponent.is())
     637                 :            :     {
     638                 :         50 :         Reference<XEventListener> xListener;
     639 [ +  - ][ +  - ]:         50 :         query_aggregation(this, xListener);
     640 [ +  - ][ +  - ]:         50 :         xComponent->addEventListener(xListener);
     641                 :        359 :     }
     642                 :            : }
     643                 :            : 
     644                 :            : // ::com::sun::star::XEventListener
     645                 :         72 : void SAL_CALL ORowSet::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException)
     646                 :            : {
     647                 :            :     // close rowset because the connection is going to be deleted (someone told me :-)
     648         [ +  - ]:         72 :     Reference<XConnection> xCon(Source.Source,UNO_QUERY);
     649 [ +  - ][ +  - ]:         72 :     if(m_xActiveConnection == xCon)
     650                 :            :     {
     651         [ +  - ]:         72 :         close();
     652                 :            :         {
     653         [ +  - ]:         72 :             MutexGuard aGuard( m_aMutex );
     654                 :         72 :             Reference< XConnection > xXConnection;
     655 [ +  - ][ +  - ]:         72 :             setActiveConnection( xXConnection );
     656                 :            :         }
     657                 :         72 :     }
     658                 :         72 : }
     659                 :            : 
     660                 :            : // XCloseable
     661                 :         76 : void SAL_CALL ORowSet::close(  ) throw(SQLException, RuntimeException)
     662                 :            : {
     663                 :            :     {
     664         [ +  - ]:         76 :         MutexGuard aGuard( m_aMutex );
     665 [ +  - ][ +  - ]:         76 :         ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     666                 :            :     }
     667                 :            :     // additionals things to set
     668                 :         76 :     freeResources( true );
     669                 :         76 : }
     670                 :            : 
     671                 :            : // comphelper::OPropertyArrayUsageHelper
     672                 :         67 : ::cppu::IPropertyArrayHelper* ORowSet::createArrayHelper( ) const
     673                 :            : {
     674         [ +  - ]:         67 :     Sequence< Property > aProps;
     675         [ +  - ]:         67 :     describeProperties(aProps);
     676 [ +  - ][ +  - ]:         67 :     return new ::cppu::OPropertyArrayHelper(aProps);
     677                 :            : }
     678                 :            : 
     679                 :            : // cppu::OPropertySetHelper
     680                 :       9965 : ::cppu::IPropertyArrayHelper& SAL_CALL ORowSet::getInfoHelper()
     681                 :            : {
     682                 :            :     typedef ::comphelper::OPropertyArrayUsageHelper<ORowSet> ORowSet_PROP;
     683                 :       9965 :     return *ORowSet_PROP::getArrayHelper();
     684                 :            : }
     685                 :            : 
     686                 :         12 : void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
     687                 :            : {
     688         [ +  - ]:         12 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     689                 :            : 
     690         [ +  - ]:         12 :     ::osl::MutexGuard aGuard( *m_pMutex );
     691         [ +  - ]:         12 :     checkUpdateConditions(columnIndex);
     692         [ +  - ]:         12 :     checkUpdateIterator();
     693                 :            : 
     694         [ +  - ]:         12 :     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
     695         [ +  - ]:         12 :     ORowSetNotifier aNotify(this,rRow);
     696 [ +  - ][ +  - ]:         12 :     m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
     697 [ +  - ][ +  - ]:         12 :     m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
                 [ +  - ]
     698 [ +  - ][ +  - ]:         12 :     aNotify.firePropertyChange();
                 [ +  - ]
     699                 :         12 : }
     700                 :            : 
     701                 :            : // XRowUpdate
     702                 :          0 : void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
     703                 :            : {
     704         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     705                 :            : 
     706         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
     707         [ #  # ]:          0 :     checkUpdateConditions(columnIndex);
     708         [ #  # ]:          0 :     checkUpdateIterator();
     709                 :            : 
     710         [ #  # ]:          0 :     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
     711         [ #  # ]:          0 :     ORowSetNotifier aNotify(this,rRow);
     712 [ #  # ][ #  # ]:          0 :     m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
     713 [ #  # ][ #  # ]:          0 :     m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
                 [ #  # ]
     714 [ #  # ][ #  # ]:          0 :     aNotify.firePropertyChange();
                 [ #  # ]
     715                 :          0 : }
     716                 :            : 
     717                 :          0 : void SAL_CALL ORowSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
     718                 :            : {
     719         [ #  # ]:          0 :     updateValue(columnIndex,x);
     720                 :          0 : }
     721                 :            : 
     722                 :          0 : void SAL_CALL ORowSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
     723                 :            : {
     724         [ #  # ]:          0 :     updateValue(columnIndex,x);
     725                 :          0 : }
     726                 :            : 
     727                 :          0 : void SAL_CALL ORowSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
     728                 :            : {
     729         [ #  # ]:          0 :     updateValue(columnIndex,x);
     730                 :          0 : }
     731                 :            : 
     732                 :          0 : void SAL_CALL ORowSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
     733                 :            : {
     734         [ #  # ]:          0 :     updateValue(columnIndex,x);
     735                 :          0 : }
     736                 :            : 
     737                 :          0 : void SAL_CALL ORowSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
     738                 :            : {
     739         [ #  # ]:          0 :     updateValue(columnIndex,x);
     740                 :          0 : }
     741                 :            : 
     742                 :          0 : void SAL_CALL ORowSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
     743                 :            : {
     744         [ #  # ]:          0 :     updateValue(columnIndex,x);
     745                 :          0 : }
     746                 :            : 
     747                 :          0 : void SAL_CALL ORowSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
     748                 :            : {
     749         [ #  # ]:          0 :     updateValue(columnIndex,x);
     750                 :          0 : }
     751                 :            : 
     752                 :         12 : void SAL_CALL ORowSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
     753                 :            : {
     754         [ +  - ]:         12 :     updateValue(columnIndex,x);
     755                 :         12 : }
     756                 :            : 
     757                 :          0 : void SAL_CALL ORowSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
     758                 :            : {
     759         [ #  # ]:          0 :     updateValue(columnIndex,x);
     760                 :          0 : }
     761                 :            : 
     762                 :          0 : void SAL_CALL ORowSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
     763                 :            : {
     764         [ #  # ]:          0 :     updateValue(columnIndex,x);
     765                 :          0 : }
     766                 :            : 
     767                 :          0 : void SAL_CALL ORowSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
     768                 :            : {
     769         [ #  # ]:          0 :     updateValue(columnIndex,x);
     770                 :          0 : }
     771                 :            : 
     772                 :          0 : void SAL_CALL ORowSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
     773                 :            : {
     774         [ #  # ]:          0 :     updateValue(columnIndex,x);
     775                 :          0 : }
     776                 :            : 
     777                 :          0 : void SAL_CALL ORowSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
     778                 :            : {
     779         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     780         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
     781         [ #  # ]:          0 :     checkUpdateConditions(columnIndex);
     782         [ #  # ]:          0 :     checkUpdateIterator();
     783                 :            : 
     784                 :            :      {
     785         [ #  # ]:          0 :         Sequence<sal_Int8> aSeq;
     786         [ #  # ]:          0 :         if(x.is())
     787 [ #  # ][ #  # ]:          0 :             x->readBytes(aSeq,length);
     788 [ #  # ][ #  # ]:          0 :         updateValue(columnIndex,aSeq);
         [ #  # ][ #  # ]
     789         [ #  # ]:          0 :     }
     790                 :          0 : }
     791                 :            : 
     792                 :          0 : void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
     793                 :            : {
     794         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     795         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
     796         [ #  # ]:          0 :     checkUpdateConditions(columnIndex);
     797         [ #  # ]:          0 :     checkUpdateIterator();
     798         [ #  # ]:          0 :     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
     799         [ #  # ]:          0 :     ORowSetNotifier aNotify(this,rRow);
     800 [ #  # ][ #  # ]:          0 :     m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
     801 [ #  # ][ #  # ]:          0 :     m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
                 [ #  # ]
     802 [ #  # ][ #  # ]:          0 :     aNotify.firePropertyChange();
                 [ #  # ]
     803                 :          0 : }
     804                 :            : 
     805                 :          0 : void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
     806                 :            : {
     807         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     808         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
     809         [ #  # ]:          0 :     checkUpdateConditions(columnIndex);
     810         [ #  # ]:          0 :     checkUpdateIterator();
     811                 :            : 
     812                 :          0 :     Any aNewValue = x;
     813                 :            : 
     814         [ #  # ]:          0 :     if ( m_pColumns )
     815                 :            :     {
     816 [ #  # ][ #  # ]:          0 :         Reference<XPropertySet> xColumn(m_pColumns->getByIndex(columnIndex-1),UNO_QUERY);
     817                 :          0 :         sal_Int32 nColType = 0;
     818 [ #  # ][ #  # ]:          0 :         xColumn->getPropertyValue(PROPERTY_TYPE) >>= nColType;
                 [ #  # ]
     819         [ #  # ]:          0 :         switch( nColType )
     820                 :            :         {
     821                 :            :             case DataType::DATE:
     822                 :            :             case DataType::TIME:
     823                 :            :             case DataType::TIMESTAMP:
     824                 :            :             {
     825                 :          0 :                 double nValue = 0;
     826         [ #  # ]:          0 :                 if ( x >>= nValue )
     827                 :            :                 {
     828         [ #  # ]:          0 :                     if ( DataType::TIMESTAMP == nColType )
     829 [ #  # ][ #  # ]:          0 :                         aNewValue <<= dbtools::DBTypeConversion::toDateTime( nValue );
                 [ #  # ]
     830         [ #  # ]:          0 :                     else if ( DataType::DATE == nColType )
     831 [ #  # ][ #  # ]:          0 :                         aNewValue <<= dbtools::DBTypeConversion::toDate( nValue );
                 [ #  # ]
     832                 :            :                     else
     833 [ #  # ][ #  # ]:          0 :                         aNewValue <<= dbtools::DBTypeConversion::toTime( nValue );
     834                 :            :                 }
     835                 :            :                 break;
     836                 :            :             }
     837                 :          0 :         }
     838                 :            :     }
     839                 :            : 
     840 [ #  # ][ #  # ]:          0 :     if (!::dbtools::implUpdateObject(this, columnIndex, aNewValue))
                 [ #  # ]
     841                 :            :     {   // there is no other updateXXX call which can handle the value in x
     842         [ #  # ]:          0 :         ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
     843         [ #  # ]:          0 :         ORowSetNotifier aNotify(this,rRow);
     844 [ #  # ][ #  # ]:          0 :         m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
     845 [ #  # ][ #  # ]:          0 :         m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
                 [ #  # ]
     846 [ #  # ][ #  # ]:          0 :         aNotify.firePropertyChange();
     847         [ #  # ]:          0 :     }
     848                 :          0 : }
     849                 :            : 
     850                 :          0 : void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 scale ) throw(SQLException, RuntimeException)
     851                 :            : {
     852         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     853         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
     854         [ #  # ]:          0 :     checkUpdateConditions(columnIndex);
     855         [ #  # ]:          0 :     checkUpdateIterator();
     856         [ #  # ]:          0 :     ORowSetValueVector::Vector& rRow = ((*m_aCurrentRow)->get());
     857         [ #  # ]:          0 :     ORowSetNotifier aNotify(this,rRow);
     858 [ #  # ][ #  # ]:          0 :     m_pCache->updateNumericObject(columnIndex,x,scale,rRow,aNotify.getChangedColumns());
     859 [ #  # ][ #  # ]:          0 :     m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
                 [ #  # ]
     860 [ #  # ][ #  # ]:          0 :     aNotify.firePropertyChange();
                 [ #  # ]
     861                 :          0 : }
     862                 :            : 
     863                 :            : // XResultSetUpdate
     864                 :          2 : void SAL_CALL ORowSet::insertRow(  ) throw(SQLException, RuntimeException)
     865                 :            : {
     866         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     867                 :            :     // insertRow is not allowd when
     868                 :            :     // standing not on the insert row nor
     869                 :            :     // when the row isn't modified
     870                 :            :     // or the concurency is read only
     871         [ +  - ]:          2 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
     872                 :            : 
     873 [ +  - ][ +  - ]:          2 :     if(!m_pCache || !m_bNew || !m_bModified || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
         [ +  - ][ -  + ]
     874 [ #  # ][ #  # ]:          0 :         throwFunctionSequenceException(*this);
     875                 :            : 
     876                 :            :     // remember old value for fire
     877                 :          2 :     sal_Bool bOld = m_bNew;
     878                 :            : 
     879                 :          2 :     ORowSetRow aOldValues;
     880 [ +  - ][ +  - ]:          2 :     if ( !m_aCurrentRow.isNull() )
     881 [ +  - ][ +  - ]:          2 :         aOldValues = new ORowSetValueVector( *(*m_aCurrentRow));
                 [ +  - ]
     882         [ +  - ]:          2 :     Sequence<Any> aChangedBookmarks;
     883 [ +  - ][ +  - ]:          2 :     RowsChangeEvent aEvt(*this,RowChangeAction::INSERT,1,aChangedBookmarks);
     884         [ +  - ]:          2 :     notifyAllListenersRowBeforeChange(aGuard,aEvt);
     885                 :            : 
     886         [ +  - ]:          2 :     ::std::vector< Any > aBookmarks;
     887         [ +  - ]:          2 :     sal_Bool bInserted = m_pCache->insertRow(aBookmarks);
     888                 :            : 
     889                 :            :     // make sure that our row is set to the new inserted row before clearing the insert flags in the cache
     890         [ +  - ]:          2 :     m_pCache->resetInsertRow(bInserted);
     891                 :            : 
     892                 :            :     // notification order
     893                 :            :     // - column values
     894         [ +  - ]:          2 :     setCurrentRow( sal_False, sal_True, aOldValues, aGuard ); // we don't move here
     895                 :            : 
     896                 :            :     // read-only flag restored
     897         [ +  - ]:          2 :     impl_restoreDataColumnsWriteable_throw();
     898                 :            : 
     899                 :            :     // - rowChanged
     900         [ +  - ]:          2 :     notifyAllListenersRowChanged(aGuard,aEvt);
     901                 :            : 
     902         [ -  + ]:          2 :     if ( !aBookmarks.empty() )
     903                 :            :     {
     904 [ #  # ][ #  # ]:          0 :         RowsChangeEvent aUpEvt(*this,RowChangeAction::UPDATE,aBookmarks.size(),Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size()));
         [ #  # ][ #  # ]
     905 [ #  # ][ #  # ]:          0 :         notifyAllListenersRowChanged(aGuard,aUpEvt);
     906                 :            :     }
     907                 :            : 
     908                 :            :     // - IsModified
     909         [ +  - ]:          2 :     if(!m_bModified)
     910         [ +  - ]:          2 :         fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
     911                 :            :     OSL_ENSURE( !m_bModified, "ORowSet::insertRow: just updated, but _still_ modified?" );
     912                 :            : 
     913                 :            :     // - IsNew
     914         [ +  - ]:          2 :     if(m_bNew != bOld)
     915         [ +  - ]:          2 :         fireProperty(PROPERTY_ID_ISNEW,m_bNew,bOld);
     916                 :            : 
     917                 :            :     // - RowCount/IsRowCountFinal
     918 [ +  - ][ +  - ]:          2 :     fireRowcount();
         [ +  - ][ +  - ]
                 [ +  - ]
     919                 :          2 : }
     920                 :            : 
     921                 :         22 : sal_Int32 SAL_CALL ORowSet::getRow(  ) throw(SQLException, RuntimeException)
     922                 :            : {
     923         [ +  - ]:         22 :     ::osl::MutexGuard aGuard( *m_pMutex );
     924         [ +  - ]:         22 :     checkCache();
     925                 :            : 
     926                 :            :     // check if we are inserting a row
     927 [ +  - ][ +  - ]:         22 :     return (m_pCache && isInsertRow()) ? 0 : ORowSetBase::getRow();
         [ +  - ][ +  - ]
     928                 :            : }
     929                 :            : 
     930                 :          8 : void SAL_CALL ORowSet::updateRow(  ) throw(SQLException, RuntimeException)
     931                 :            : {
     932         [ +  - ]:          8 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     933                 :            :     // not allowed when standing on insert row
     934         [ +  - ]:          8 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
     935 [ +  - ][ +  - ]:          8 :     if ( !m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY || m_bNew || ((m_pCache->m_nPrivileges & Privilege::UPDATE ) != Privilege::UPDATE) )
         [ +  - ][ -  + ]
     936 [ #  # ][ #  # ]:          0 :         throwFunctionSequenceException(*this);
     937                 :            : 
     938                 :            : 
     939         [ +  - ]:          8 :     if(m_bModified)
     940                 :            :     {
     941                 :          8 :         ORowSetRow aOldValues;
     942 [ +  - ][ +  - ]:          8 :         if ( !m_aCurrentRow.isNull() )
     943 [ +  - ][ +  - ]:          8 :             aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) );
                 [ +  - ]
     944                 :            : 
     945         [ +  - ]:          8 :         Sequence<Any> aChangedBookmarks;
     946 [ +  - ][ +  - ]:          8 :         RowsChangeEvent aEvt(*this,RowChangeAction::UPDATE,1,aChangedBookmarks);
     947         [ +  - ]:          8 :         notifyAllListenersRowBeforeChange(aGuard,aEvt);
     948                 :            : 
     949         [ +  - ]:          8 :         ::std::vector< Any > aBookmarks;
     950 [ +  - ][ +  - ]:          8 :         m_pCache->updateRow(m_aCurrentRow.operator ->(),aBookmarks);
     951         [ -  + ]:          8 :         if ( !aBookmarks.empty() )
     952 [ #  # ][ #  # ]:          0 :             aEvt.Bookmarks = Sequence<Any>(&(*aBookmarks.begin()),aBookmarks.size());
                 [ #  # ]
     953                 :          8 :         aEvt.Rows += aBookmarks.size();
     954         [ +  - ]:          8 :         m_aBookmark     = m_pCache->getBookmark();
     955         [ +  - ]:          8 :         m_aCurrentRow   = m_pCache->m_aMatrixIter;
     956                 :          8 :         m_bIsInsertRow  = sal_False;
     957 [ +  - ][ +  - ]:          8 :         if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && (*m_pCache->m_aMatrixIter).is() )
         [ +  - ][ +  - ]
     958                 :            :         {
     959 [ +  - ][ -  + ]:          8 :             if ( m_pCache->isResultSetChanged() )
     960                 :            :             {
     961         [ #  # ]:          0 :                 impl_rebuild_throw(aGuard);
     962                 :            :             }
     963                 :            :             else
     964                 :            :             {
     965 [ +  - ][ +  - ]:          8 :                 m_aOldRow->setRow(new ORowSetValueVector(*(*m_aCurrentRow)));
         [ +  - ][ +  - ]
                 [ +  - ]
     966                 :            : 
     967                 :            :                 // notification order
     968                 :            :                 // - column values
     969         [ +  - ]:          8 :                 ORowSetBase::firePropertyChange(aOldValues);
     970                 :            :             }
     971                 :            :             // - rowChanged
     972         [ +  - ]:          8 :             notifyAllListenersRowChanged(aGuard,aEvt);
     973                 :            : 
     974                 :            :             // - IsModified
     975         [ +  - ]:          8 :             if(!m_bModified)
     976         [ +  - ]:          8 :                 fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
     977                 :            :             OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" );
     978                 :            : 
     979                 :            :             // - RowCount/IsRowCountFinal
     980         [ +  - ]:          8 :             fireRowcount();
     981                 :            :         }
     982         [ #  # ]:          0 :         else if ( !m_bAfterLast ) // the update went rong
     983                 :            :         {
     984 [ #  # ][ #  # ]:          0 :             ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this );
                 [ #  # ]
     985 [ +  - ][ +  - ]:          8 :         }
                 [ +  - ]
     986         [ +  - ]:          8 :     }
     987                 :          8 : }
     988                 :            : 
     989                 :          2 : void SAL_CALL ORowSet::deleteRow(  ) throw(SQLException, RuntimeException)
     990                 :            : {
     991         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
     992                 :            : 
     993         [ +  - ]:          2 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
     994         [ +  - ]:          2 :     checkCache();
     995                 :            : 
     996 [ +  - ][ -  + ]:          2 :     if ( m_bBeforeFirst || m_bAfterLast )
     997 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_BEFORE_AFTER ), SQL_INVALID_CURSOR_POSITION, *this );
                 [ #  # ]
     998         [ -  + ]:          2 :     if ( m_bNew )
     999 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_INSERT_ROW ), SQL_INVALID_CURSOR_POSITION, *this );
                 [ #  # ]
    1000         [ -  + ]:          2 :     if  ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
    1001 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
                 [ #  # ]
    1002         [ -  + ]:          2 :     if ( ( m_pCache->m_nPrivileges & Privilege::DELETE ) != Privilege::DELETE )
    1003 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_DELETE_PRIVILEGE ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
                 [ #  # ]
    1004 [ +  - ][ -  + ]:          2 :     if ( rowDeleted() )
    1005 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
                 [ #  # ]
    1006                 :            : 
    1007                 :            :     // this call position the cache indirect
    1008                 :          2 :     Any aBookmarkToDelete( m_aBookmark );
    1009         [ +  - ]:          2 :     positionCache( MOVE_NONE_REFRESH_ONLY );
    1010         [ +  - ]:          2 :     sal_Int32 nDeletePosition = m_pCache->getRow();
    1011                 :            : 
    1012         [ +  - ]:          2 :     notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
    1013                 :            : 
    1014                 :          2 :     ORowSetRow aOldValues;
    1015 [ +  - ][ +  - ]:          2 :     if ( m_pCache->m_aMatrixIter != m_pCache->getEnd() && m_pCache->m_aMatrixIter->is() )
         [ +  - ][ +  - ]
    1016 [ +  - ][ +  - ]:          2 :         aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) );
    1017                 :            : 
    1018         [ +  - ]:          2 :     Sequence<Any> aChangedBookmarks;
    1019 [ +  - ][ +  - ]:          2 :     RowsChangeEvent aEvt(*this,RowChangeAction::DELETE,1,aChangedBookmarks);
    1020         [ +  - ]:          2 :     notifyAllListenersRowBeforeChange(aGuard,aEvt);
    1021                 :            : 
    1022         [ +  - ]:          2 :     m_pCache->deleteRow();
    1023         [ +  - ]:          2 :     notifyRowSetAndClonesRowDeleted( aBookmarkToDelete, nDeletePosition );
    1024                 :            : 
    1025         [ +  - ]:          2 :     ORowSetNotifier aNotifier( this );
    1026                 :            :         // this will call cancelRowModification on the cache if necessary
    1027                 :            : 
    1028                 :            :     // notification order
    1029                 :            :     // - rowChanged
    1030         [ +  - ]:          2 :     notifyAllListenersRowChanged(aGuard,aEvt);
    1031                 :            : 
    1032                 :            :     // - IsModified
    1033                 :            :     // - IsNew
    1034         [ +  - ]:          2 :     aNotifier.fire( );
    1035                 :            : 
    1036                 :            :     // - RowCount/IsRowCountFinal
    1037 [ +  - ][ +  - ]:          2 :     fireRowcount();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1038                 :          2 : }
    1039                 :            : 
    1040                 :          2 : void ORowSet::implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( SQLException, RuntimeException ) )
    1041                 :            : {
    1042         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1043                 :            : 
    1044         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1045 [ +  - ][ +  - ]:          2 :     if ( m_bBeforeFirst || m_bAfterLast || rowDeleted() )
         [ +  - ][ -  + ]
                 [ -  + ]
    1046                 :          2 :         return; // nothing to do so return
    1047                 :            : 
    1048         [ +  - ]:          2 :     checkCache();
    1049                 :            :     // cancelRowUpdates is not allowed when:
    1050                 :            :     // - standing on the insert row
    1051                 :            :     // - the concurrency is read only
    1052                 :            :     // - the current row is deleted
    1053 [ +  - ][ -  + ]:          2 :     if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
    1054 [ #  # ][ #  # ]:          0 :         throwFunctionSequenceException(*this);
    1055                 :            : 
    1056         [ +  - ]:          2 :     positionCache( MOVE_NONE_REFRESH_ONLY );
    1057                 :            : 
    1058                 :          2 :     ORowSetRow aOldValues;
    1059 [ #  # ][ #  # ]:          2 :     if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
         [ #  # ][ -  + ]
                 [ -  + ]
    1060 [ #  # ][ #  # ]:          0 :         aOldValues = new ORowSetValueVector( *(*m_aCurrentRow) );
                 [ #  # ]
    1061                 :            : 
    1062         [ +  - ]:          2 :     m_pCache->cancelRowUpdates();
    1063                 :            : 
    1064         [ +  - ]:          2 :     m_aBookmark     = m_pCache->getBookmark();
    1065         [ +  - ]:          2 :     m_aCurrentRow   = m_pCache->m_aMatrixIter;
    1066                 :          2 :     m_bIsInsertRow  = sal_False;
    1067         [ +  - ]:          2 :     m_aCurrentRow.setBookmark(m_aBookmark);
    1068                 :            : 
    1069                 :            :     // notification order
    1070                 :            :     // IsModified
    1071 [ +  - ][ -  + ]:          2 :     if( !m_bModified && _bNotifyModified )
    1072                 :            :     {
    1073                 :            :         // - column values
    1074         [ #  # ]:          0 :         ORowSetBase::firePropertyChange(aOldValues);
    1075         [ #  # ]:          0 :         fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
    1076 [ +  - ][ +  - ]:          2 :     }
                 [ +  - ]
    1077                 :            : }
    1078                 :            : 
    1079                 :          0 : void SAL_CALL ORowSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
    1080                 :            : {
    1081                 :          0 :     implCancelRowUpdates( sal_True );
    1082                 :          0 : }
    1083                 :            : 
    1084                 :         48 : void SAL_CALL ORowSet::addRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException)
    1085                 :            : {
    1086         [ +  - ]:         48 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1087                 :            : 
    1088         [ +  - ]:         48 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    1089         [ +  - ]:         48 :     if(listener.is())
    1090 [ +  - ][ +  - ]:         48 :         m_aRowsetListeners.addInterface(listener);
    1091                 :         48 : }
    1092                 :            : 
    1093                 :        317 : void SAL_CALL ORowSet::removeRowSetListener( const Reference< XRowSetListener >& listener ) throw(RuntimeException)
    1094                 :            : {
    1095         [ +  - ]:        317 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1096                 :            : 
    1097         [ +  - ]:        317 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    1098         [ +  - ]:        317 :     if(listener.is())
    1099 [ +  - ][ +  - ]:        317 :         m_aRowsetListeners.removeInterface(listener);
    1100                 :        317 : }
    1101                 :            : 
    1102                 :         40 : void ORowSet::notifyAllListeners(::osl::ResettableMutexGuard& _rGuard)
    1103                 :            : {
    1104 [ +  - ][ +  - ]:         40 :     EventObject aEvt(*m_pMySelf);
    1105         [ +  - ]:         40 :     _rGuard.clear();
    1106         [ +  - ]:         40 :     m_aRowsetListeners.notifyEach( &XRowSetListener::rowSetChanged, aEvt );
    1107 [ +  - ][ +  - ]:         40 :     _rGuard.reset();
    1108                 :         40 : }
    1109                 :            : 
    1110                 :        196 : void ORowSet::notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard)
    1111                 :            : {
    1112 [ +  - ][ +  - ]:        196 :     EventObject aEvt(*m_pMySelf);
    1113         [ +  - ]:        196 :     _rGuard.clear();
    1114         [ +  - ]:        196 :     m_aRowsetListeners.notifyEach( &XRowSetListener::cursorMoved, aEvt );
    1115 [ +  - ][ +  - ]:        196 :     _rGuard.reset();
    1116                 :        196 : }
    1117                 :            : 
    1118                 :         12 : void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard, const RowsChangeEvent& aEvt)
    1119                 :            : {
    1120                 :         12 :     _rGuard.clear();
    1121         [ +  - ]:         12 :     m_aRowsetListeners.notifyEach( &XRowSetListener::rowChanged, (EventObject)aEvt );
    1122                 :         12 :     m_aRowsChangeListener.notifyEach( &XRowsChangeListener::rowsChanged, aEvt );
    1123                 :         12 :     _rGuard.reset();
    1124                 :         12 : }
    1125                 :            : 
    1126                 :        218 : sal_Bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard)
    1127                 :            : {
    1128 [ +  - ][ +  - ]:        218 :     EventObject aEvt(*m_pMySelf);
                 [ #  # ]
    1129 [ +  - ][ +  - ]:        238 :     NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove);
         [ +  - ][ +  + ]
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
                 [ +  + ]
           [ +  -  #  # ]
                 [ +  - ]
    1130 [ +  - ][ +  - ]:        218 :     return bCheck;
    1131                 :            : }
    1132                 :            : 
    1133                 :         12 : void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt)
    1134                 :            : {
    1135 [ +  - ][ +  - ]:         16 :     NOTIFY_LISTERNERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange);
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  + ][ +  + ]
         [ +  - ][ +  + ]
           [ +  -  #  # ]
    1136         [ -  + ]:         12 :     if ( !bCheck )
    1137 [ #  # ][ #  # ]:         12 :         m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ +  - ]
    1138         [ #  # ]:         12 : }
    1139                 :            : 
    1140                 :        232 : void ORowSet::fireRowcount()
    1141                 :            : {
    1142         [ +  - ]:        232 :     sal_Int32 nCurrentRowCount( impl_getRowCount() );
    1143                 :        232 :     sal_Bool bCurrentRowCountFinal( m_pCache->m_bRowCountFinal );
    1144                 :            : 
    1145         [ +  + ]:        232 :     if ( m_nLastKnownRowCount != nCurrentRowCount )
    1146                 :            :     {
    1147                 :         36 :         sal_Int32 nHandle = PROPERTY_ID_ROWCOUNT;
    1148                 :         36 :         Any aNew,aOld;
    1149 [ +  - ][ +  - ]:         36 :         aNew <<= nCurrentRowCount; aOld <<= m_nLastKnownRowCount;
    1150         [ +  - ]:         36 :         fire(&nHandle,&aNew,&aOld,1,sal_False);
    1151                 :         36 :         m_nLastKnownRowCount = nCurrentRowCount;
    1152                 :            :     }
    1153 [ +  + ][ +  - ]:        232 :     if ( !m_bLastKnownRowCountFinal && ( m_bLastKnownRowCountFinal != bCurrentRowCountFinal ) )
    1154                 :            :     {
    1155                 :         36 :         sal_Int32 nHandle = PROPERTY_ID_ISROWCOUNTFINAL;
    1156                 :         36 :         Any aNew,aOld;
    1157         [ +  - ]:         36 :         aNew <<= bCurrentRowCountFinal;
    1158         [ +  - ]:         36 :         aOld <<= m_bLastKnownRowCountFinal;
    1159         [ +  - ]:         36 :         fire(&nHandle,&aNew,&aOld,1,sal_False);
    1160                 :         36 :         m_bLastKnownRowCountFinal = bCurrentRowCountFinal;
    1161                 :            :     }
    1162                 :        232 : }
    1163                 :            : 
    1164                 :          2 : void SAL_CALL ORowSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
    1165                 :            : {
    1166         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1167                 :            : 
    1168         [ +  - ]:          2 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
    1169         [ +  - ]:          2 :     checkPositioningAllowed();
    1170         [ -  + ]:          2 :     if ( ( m_pCache->m_nPrivileges & Privilege::INSERT ) != Privilege::INSERT )
    1171 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_INSERT_PRIVILEGE ), SQL_GENERAL_ERROR, *this );
                 [ #  # ]
    1172                 :            : 
    1173 [ +  - ][ +  - ]:          2 :     if ( notifyAllListenersCursorBeforeMove( aGuard ) )
    1174                 :            :     {
    1175                 :            :         // remember old value for fire
    1176                 :          2 :         ORowSetRow aOldValues;
    1177 [ -  + ][ +  - ]:          2 :         if ( rowDeleted() )
    1178                 :            :         {
    1179         [ #  # ]:          0 :             positionCache( MOVE_FORWARD );
    1180         [ #  # ]:          0 :             m_pCache->next();
    1181         [ #  # ]:          0 :             setCurrentRow( sal_True, sal_False, aOldValues, aGuard);
    1182                 :            :         }
    1183                 :            :         else
    1184         [ +  - ]:          2 :             positionCache( MOVE_NONE_REFRESH_ONLY );
    1185                 :            : 
    1186                 :            :         // check before because the resultset could be empty
    1187 [ -  + ][ #  # ]:          2 :         if  (   !m_bBeforeFirst
           [ #  #  #  # ]
                 [ -  + ]
    1188                 :          0 :             &&  !m_bAfterLast
    1189         [ #  # ]:          0 :             &&  m_pCache->m_aMatrixIter != m_pCache->getEnd()
    1190                 :          0 :             &&  m_pCache->m_aMatrixIter->is()
    1191                 :            :             )
    1192 [ #  # ][ #  # ]:          0 :             aOldValues = new ORowSetValueVector( *(*(m_pCache->m_aMatrixIter)) );
    1193                 :            : 
    1194                 :          2 :         const sal_Bool bNewState = m_bNew;
    1195                 :          2 :         const sal_Bool bModState = m_bModified;
    1196                 :            : 
    1197         [ +  - ]:          2 :         m_pCache->moveToInsertRow();
    1198         [ +  - ]:          2 :         m_aCurrentRow = m_pCache->m_aInsertRow;
    1199                 :          2 :         m_bIsInsertRow  = sal_True;
    1200                 :            : 
    1201                 :            :         // set read-only flag to false
    1202         [ +  - ]:          2 :         impl_setDataColumnsWriteable_throw();
    1203                 :            : 
    1204                 :            :         // notification order
    1205                 :            :         // - column values
    1206         [ +  - ]:          2 :         ORowSetBase::firePropertyChange(aOldValues);
    1207                 :            : 
    1208                 :            :         // - cursorMoved
    1209         [ +  - ]:          2 :         notifyAllListenersCursorMoved(aGuard);
    1210                 :            : 
    1211                 :            :         // - IsModified
    1212         [ -  + ]:          2 :         if ( bModState != m_bModified )
    1213         [ #  # ]:          0 :             fireProperty( PROPERTY_ID_ISMODIFIED, m_bModified, bModState );
    1214                 :            : 
    1215                 :            :         // - IsNew
    1216         [ +  - ]:          2 :         if ( bNewState != m_bNew )
    1217         [ +  - ]:          2 :             fireProperty( PROPERTY_ID_ISNEW, m_bNew, bNewState );
    1218                 :            : 
    1219                 :            :         // - RowCount/IsRowCountFinal
    1220 [ +  - ][ +  - ]:          2 :         fireRowcount();
    1221         [ +  - ]:          2 :     }
    1222                 :          2 : }
    1223                 :            : 
    1224                 :          2 : void ORowSet::impl_setDataColumnsWriteable_throw()
    1225                 :            : {
    1226         [ +  - ]:          2 :     impl_restoreDataColumnsWriteable_throw();
    1227                 :          2 :     TDataColumns::iterator aIter = m_aDataColumns.begin();
    1228         [ +  - ]:          2 :     m_aReadOnlyDataColumns.resize(m_aDataColumns.size(),false);
    1229                 :          2 :     ::std::vector<bool, std::allocator<bool> >::iterator aReadIter = m_aReadOnlyDataColumns.begin();
    1230 [ +  - ][ +  + ]:         64 :     for(;aIter != m_aDataColumns.end();++aIter,++aReadIter)
    1231                 :            :     {
    1232                 :         62 :         sal_Bool bReadOnly = sal_False;
    1233 [ +  - ][ +  - ]:         62 :         (*aIter)->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly;
    1234                 :         62 :         *aReadIter = bReadOnly;
    1235                 :            : 
    1236 [ +  - ][ +  - ]:         62 :         (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny(sal_False));
                 [ +  - ]
    1237                 :            :     }
    1238                 :          2 : }
    1239                 :            : 
    1240                 :          4 : void ORowSet::impl_restoreDataColumnsWriteable_throw()
    1241                 :            : {
    1242                 :          4 :     TDataColumns::iterator aIter = m_aDataColumns.begin();
    1243                 :          4 :     ::std::vector<bool, std::allocator<bool> >::iterator aReadIter = m_aReadOnlyDataColumns.begin();
    1244         [ +  + ]:         66 :     for(;aReadIter != m_aReadOnlyDataColumns.end();++aIter,++aReadIter)
    1245                 :            :     {
    1246 [ +  - ][ +  - ]:         62 :         (*aIter)->setPropertyValue(PROPERTY_ISREADONLY,makeAny((sal_Bool)*aReadIter ));
                 [ +  - ]
    1247                 :            :     }
    1248                 :          4 :     m_aReadOnlyDataColumns.clear();
    1249                 :          4 : }
    1250                 :            : 
    1251                 :          2 : void SAL_CALL ORowSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
    1252                 :            : {
    1253         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1254                 :            : 
    1255         [ +  - ]:          2 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
    1256         [ +  - ]:          2 :     checkPositioningAllowed();
    1257                 :            : 
    1258 [ +  - ][ +  - ]:          2 :     if ( !m_pCache->m_bNew && !m_bModified )
    1259                 :            :         // nothing to do if we're not on the insertion row, and not modified otherwise
    1260                 :          2 :         return;
    1261                 :            : 
    1262 [ #  # ][ #  # ]:          0 :     if ( rowDeleted() )
    1263                 :            :         // this would perhaps even justify a RuntimeException ....
    1264                 :            :         // if the current row is deleted, then no write access to this row should be possible. So,
    1265                 :            :         // m_bModified should be true. Also, as soon as somebody calls moveToInsertRow,
    1266                 :            :         // our current row should not be deleted anymore. So, we should not have survived the above
    1267                 :            :         // check "if ( !m_pCache->m_bNew && !m_bModified )"
    1268 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
                 [ #  # ]
    1269                 :            : 
    1270 [ #  # ][ #  # ]:          0 :     if ( notifyAllListenersCursorBeforeMove( aGuard ) )
    1271                 :            :     {
    1272         [ #  # ]:          0 :         positionCache( MOVE_NONE_REFRESH_ONLY );
    1273                 :            : 
    1274         [ #  # ]:          0 :         ORowSetNotifier aNotifier( this );
    1275                 :            : 
    1276                 :            :         // notification order
    1277                 :            :         // - cursorMoved
    1278         [ #  # ]:          0 :         notifyAllListenersCursorMoved(aGuard);
    1279                 :            : 
    1280                 :            :         // - IsModified
    1281                 :            :         // - IsNew
    1282 [ #  # ][ #  # ]:          0 :         aNotifier.fire();
    1283 [ +  - ][ -  + ]:          2 :     }
    1284                 :            : }
    1285                 :            : 
    1286                 :            : // XRow
    1287                 :        998 : sal_Bool SAL_CALL ORowSet::wasNull(  ) throw(SQLException, RuntimeException)
    1288                 :            : {
    1289         [ +  - ]:        998 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1290         [ +  - ]:        998 :     checkCache();
    1291                 :            : 
    1292 [ +  - ][ -  + ]:        998 :     return ( m_pCache && isInsertRow() ) ? ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex].isNull() : ORowSetBase::wasNull();
         [ #  # ][ +  - ]
                 [ +  - ]
    1293                 :            : }
    1294                 :            : 
    1295                 :       1456 : const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex)
    1296                 :            : {
    1297                 :       1456 :     checkCache();
    1298                 :            : 
    1299 [ +  + ][ +  + ]:       1456 :     if ( m_pCache && isInsertRow() )
                 [ +  - ]
    1300                 :          2 :         return  ((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex];
    1301                 :            : 
    1302                 :       1456 :     return getValue(columnIndex);
    1303                 :            : }
    1304                 :            : 
    1305                 :       1456 : ::rtl::OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1306                 :            : {
    1307         [ +  - ]:       1456 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1308 [ +  - ][ +  - ]:       1456 :     return getInsertValue(columnIndex);
                 [ +  - ]
    1309                 :            : }
    1310                 :            : 
    1311                 :          0 : sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1312                 :            : {
    1313         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1314 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1315                 :            : }
    1316                 :            : 
    1317                 :          0 : sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1318                 :            : {
    1319         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1320 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1321                 :            : }
    1322                 :            : 
    1323                 :          0 : sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1324                 :            : {
    1325         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1326 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1327                 :            : }
    1328                 :            : 
    1329                 :          0 : sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1330                 :            : {
    1331         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1332 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1333                 :            : }
    1334                 :            : 
    1335                 :          0 : sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1336                 :            : {
    1337         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1338 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1339                 :            : }
    1340                 :            : 
    1341                 :          0 : float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1342                 :            : {
    1343         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1344 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1345                 :            : }
    1346                 :            : 
    1347                 :          0 : double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1348                 :            : {
    1349         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1350 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1351                 :            : }
    1352                 :            : 
    1353                 :          0 : Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1354                 :            : {
    1355         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1356 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1357                 :            : }
    1358                 :            : 
    1359                 :          0 : ::com::sun::star::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1360                 :            : {
    1361         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1362 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1363                 :            : }
    1364                 :            : 
    1365                 :          0 : ::com::sun::star::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1366                 :            : {
    1367         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1368 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1369                 :            : }
    1370                 :            : 
    1371                 :          0 : ::com::sun::star::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1372                 :            : {
    1373         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1374 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex);
                 [ #  # ]
    1375                 :            : }
    1376                 :            : 
    1377                 :          0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1378                 :            : {
    1379         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1380 [ #  # ][ #  # ]:          0 :     if ( m_pCache && isInsertRow() )
                 [ #  # ]
    1381                 :            :     {
    1382         [ #  # ]:          0 :         checkCache();
    1383 [ #  # ][ #  # ]:          0 :         return new ::comphelper::SequenceInputStream(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1384                 :            :     }
    1385                 :            : 
    1386 [ #  # ][ #  # ]:          0 :     return ORowSetBase::getBinaryStream(columnIndex);
    1387                 :            : }
    1388                 :            : 
    1389                 :          0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL ORowSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1390                 :            : {
    1391         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1392 [ #  # ][ #  # ]:          0 :     if(m_pCache && isInsertRow() )
                 [ #  # ]
    1393                 :            :     {
    1394         [ #  # ]:          0 :         checkCache();
    1395 [ #  # ][ #  # ]:          0 :         return new ::comphelper::SequenceInputStream(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1396                 :            :     }
    1397                 :            : 
    1398 [ #  # ][ #  # ]:          0 :     return ORowSetBase::getCharacterStream(columnIndex);
    1399                 :            : }
    1400                 :            : 
    1401                 :          0 : Any SAL_CALL ORowSet::getObject( sal_Int32 columnIndex, const Reference< XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
    1402                 :            : {
    1403         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1404 [ #  # ][ #  # ]:          0 :     return getInsertValue(columnIndex).makeAny();
                 [ #  # ]
    1405                 :            : }
    1406                 :            : 
    1407                 :          0 : Reference< XRef > SAL_CALL ORowSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
    1408                 :            : {
    1409                 :          0 :     return Reference< XRef >();
    1410                 :            : }
    1411                 :            : 
    1412                 :          0 : Reference< XBlob > SAL_CALL ORowSet::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1413                 :            : {
    1414 [ #  # ][ #  # ]:          0 :     if ( m_pCache && isInsertRow() )
                 [ #  # ]
    1415                 :            :     {
    1416                 :          0 :         checkCache();
    1417 [ #  # ][ #  # ]:          0 :         return new ::connectivity::BlobHelper(((*m_pCache->m_aInsertRow)->get())[m_nLastColumnIndex = columnIndex].getSequence());
                 [ #  # ]
    1418                 :            :     }
    1419                 :          0 :     return ORowSetBase::getBlob(columnIndex);
    1420                 :            : }
    1421                 :            : 
    1422                 :          0 : Reference< XClob > SAL_CALL ORowSet::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
    1423                 :            : {
    1424         [ #  # ]:          0 :     return Reference< XClob >(getInsertValue(columnIndex).makeAny(),UNO_QUERY);
    1425                 :            : }
    1426                 :            : 
    1427                 :          0 : Reference< XArray > SAL_CALL ORowSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
    1428                 :            : {
    1429                 :          0 :     return Reference< XArray >();
    1430                 :            : }
    1431                 :            : 
    1432                 :          8 : void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException)
    1433                 :            : {
    1434         [ -  + ]:          8 :     if (!_rxHandler.is())
    1435         [ #  # ]:          0 :         execute();
    1436                 :            : 
    1437         [ +  - ]:          8 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1438                 :            : 
    1439                 :            :     // tell everybody that we will change the result set
    1440         [ +  - ]:          8 :     approveExecution();
    1441                 :            : 
    1442         [ +  - ]:          8 :     ResettableMutexGuard aGuard( m_aMutex );
    1443                 :            : 
    1444                 :            :     try
    1445                 :            :     {
    1446         [ +  - ]:          8 :         freeResources( m_bCommandFacetsDirty );
    1447                 :            : 
    1448                 :            :         // calc the connection to be used
    1449 [ +  + ][ -  + ]:          8 :         if (m_xActiveConnection.is() && m_bRebuildConnOnExecute)
                 [ -  + ]
    1450                 :            :         {
    1451                 :            :             // there was a setProperty(ActiveConnection), but a setProperty(DataSource) _after_ that, too
    1452                 :          0 :             Reference< XConnection > xXConnection;
    1453         [ #  # ]:          0 :             setActiveConnection( xXConnection );
    1454                 :            :         }
    1455         [ +  - ]:          8 :         calcConnection( _rxHandler );
    1456                 :          8 :         m_bRebuildConnOnExecute = sal_False;
    1457                 :            : 
    1458 [ +  - ][ +  - ]:          8 :         Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext.getLegacyServiceFactory() );
                 [ +  - ]
    1459         [ +  - ]:          8 :         Reference<XParametersSupplier>  xParameters(xComposer, UNO_QUERY);
    1460                 :            : 
    1461 [ +  - ][ +  - ]:          8 :         Reference<XIndexAccess>  xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
                 [ +  - ]
    1462 [ +  - ][ +  - ]:          8 :         const sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
                 [ +  - ]
    1463         [ +  + ]:          8 :         if ( m_aParametersSet.size() < (size_t)nParamCount )
    1464         [ +  - ]:          2 :             m_aParametersSet.resize( nParamCount ,false);
    1465                 :            : 
    1466 [ +  - ][ +  - ]:          8 :         ::dbtools::askForParameters( xComposer, this, m_xActiveConnection, _rxHandler,m_aParametersSet );
    1467                 :            :     }
    1468                 :            :     // ensure that only the allowed exceptions leave this block
    1469                 :          0 :     catch(SQLException&)
    1470                 :            :     {
    1471                 :          0 :         throw;
    1472                 :            :     }
    1473   [ #  #  #  # ]:          0 :     catch(RuntimeException&)
    1474                 :            :     {
    1475                 :          0 :         throw;
    1476                 :            :     }
    1477         [ #  # ]:          0 :     catch(Exception&)
    1478                 :            :     {
    1479                 :            :         OSL_FAIL("ORowSet::executeWithCompletion: caught an unexpected exception type while filling in the parameters!");
    1480                 :            :     }
    1481                 :            : 
    1482                 :            :     // we're done with the parameters, now for the real execution
    1483                 :            : 
    1484                 :            :     //  do the real execute
    1485 [ +  - ][ +  - ]:          8 :     execute_NoApprove_NoNewConn(aGuard);
    1486                 :          8 : }
    1487                 :            : 
    1488                 :          0 : Reference< XIndexAccess > SAL_CALL ORowSet::getParameters(  ) throw (RuntimeException)
    1489                 :            : {
    1490         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( *m_pMutex );
    1491         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1492                 :            : 
    1493         [ #  # ]:          0 :     if ( m_bCommandFacetsDirty )
    1494                 :            :         // need to rebuild the parameters, since some property which contributes to the
    1495                 :            :         // complete command, and thus the parameters, changed
    1496         [ #  # ]:          0 :         impl_disposeParametersContainer_nothrow();
    1497                 :            : 
    1498 [ #  # ][ #  # ]:          0 :     if ( !m_pParameters.get() && !m_aCommand.isEmpty() )
                 [ #  # ]
    1499                 :            :     {
    1500                 :            :         try
    1501                 :            :         {
    1502                 :          0 :             ::rtl::OUString sNotInterestedIn;
    1503 [ #  # ][ #  # ]:          0 :             impl_initComposer_throw( sNotInterestedIn );
    1504                 :            :         }
    1505         [ #  # ]:          0 :         catch( const Exception& )
    1506                 :            :         {
    1507                 :            :             // silence it
    1508                 :            :         }
    1509                 :            :     }
    1510                 :            : 
    1511 [ #  # ][ #  # ]:          0 :     return m_pParameters.get();
                 [ #  # ]
    1512                 :            : }
    1513                 :            : 
    1514                 :         62 : void ORowSet::approveExecution() throw (RowSetVetoException, RuntimeException)
    1515                 :            : {
    1516         [ +  - ]:         62 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    1517 [ +  - ][ +  - ]:         62 :     EventObject aEvt(*this);
    1518                 :            : 
    1519         [ +  - ]:         62 :     OInterfaceIteratorHelper aApproveIter( m_aApproveListeners );
    1520         [ +  + ]:         64 :     while ( aApproveIter.hasMoreElements() )
    1521                 :            :     {
    1522 [ +  - ][ +  - ]:          2 :         Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aApproveIter.next() ) );
    1523                 :            :         try
    1524                 :            :         {
    1525 [ +  - ][ +  - ]:          2 :             if ( xListener.is() && !xListener->approveRowSetChange( aEvt ) )
         [ +  - ][ -  + ]
                 [ -  + ]
    1526         [ #  # ]:          0 :                 throw RowSetVetoException();
    1527                 :            :         }
    1528         [ #  # ]:          0 :         catch ( const DisposedException& e )
    1529                 :            :         {
    1530   [ #  #  #  # ]:          0 :             if ( e.Context == xListener )
    1531         [ #  # ]:          0 :                 aApproveIter.remove();
    1532                 :            :         }
    1533                 :          0 :         catch ( const RuntimeException& ) { throw; }
    1534   [ #  #  #  #  :          0 :         catch ( const RowSetVetoException& ) { throw; }
                      # ]
    1535         [ #  # ]:          0 :         catch ( const Exception& )
    1536                 :            :         {
    1537                 :            :             DBG_UNHANDLED_EXCEPTION();
    1538                 :            :         }
    1539 [ +  - ][ +  - ]:         64 :     }
                 [ +  - ]
    1540                 :         62 : }
    1541                 :            : 
    1542                 :            : // XRowSet
    1543                 :         54 : void SAL_CALL ORowSet::execute(  ) throw(SQLException, RuntimeException)
    1544                 :            : {
    1545         [ +  - ]:         54 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    1546                 :            : 
    1547                 :            :     // tell everybody that we will change the result set
    1548         [ +  - ]:         54 :     approveExecution();
    1549                 :            : 
    1550         [ +  - ]:         54 :     ResettableMutexGuard aGuard( m_aMutex );
    1551         [ +  - ]:         54 :     freeResources( m_bCommandFacetsDirty );
    1552                 :            : 
    1553                 :            :     // calc the connection to be used
    1554 [ +  + ][ -  + ]:         54 :     if (m_xActiveConnection.is() && m_bRebuildConnOnExecute) {
                 [ -  + ]
    1555                 :            :         // there was a setProperty(ActiveConnection), but a setProperty(DataSource) _after_ that, too
    1556                 :          0 :         Reference< XConnection> xXConnection;
    1557         [ #  # ]:          0 :         setActiveConnection( xXConnection );
    1558                 :            :     }
    1559                 :            : 
    1560 [ +  - ][ +  - ]:         54 :     calcConnection(NULL);
    1561                 :         54 :     m_bRebuildConnOnExecute = sal_False;
    1562                 :            : 
    1563                 :            :     // do the real execute
    1564 [ +  - ][ +  + ]:         54 :     execute_NoApprove_NoNewConn(aGuard);
    1565                 :         32 : }
    1566                 :            : 
    1567                 :         40 : void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxStatement, sal_Int32 _nDesiredResultSetType, sal_Int32 _nDesiredResultSetConcurrency )
    1568                 :            : {
    1569                 :            :     OSL_ENSURE( _rxStatement.is(), "ORowSet::setStatementResultSetType: invalid statement - this will crash!" );
    1570                 :            : 
    1571                 :         40 :     sal_Int32 nResultSetType( _nDesiredResultSetType );
    1572                 :         40 :     sal_Int32 nResultSetConcurrency( _nDesiredResultSetConcurrency );
    1573                 :            : 
    1574                 :            :     // there *might* be a data source setting which tells use to be more defensive with those settings
    1575                 :            :     // #i15113#
    1576                 :         40 :     sal_Bool bRespectDriverRST = sal_False;
    1577                 :         40 :     Any aSetting;
    1578 [ +  - ][ +  - ]:         40 :     if ( getDataSourceSetting( ::dbaccess::getDataSource( m_xActiveConnection ), "RespectDriverResultSetType", aSetting ) )
                 [ +  - ]
    1579                 :            :     {
    1580                 :         40 :         OSL_VERIFY( aSetting >>= bRespectDriverRST );
    1581                 :            :     }
    1582                 :            : 
    1583         [ -  + ]:         40 :     if ( bRespectDriverRST )
    1584                 :            :     {
    1585                 :            :         // try type/concurrency settings with decreasing usefullness, and rely on what the connection claims
    1586                 :            :         // to support
    1587 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData > xMeta( m_xActiveConnection->getMetaData() );
    1588                 :            : 
    1589                 :            :         sal_Int32 nCharacteristics[5][2] =
    1590                 :            :         {   { ResultSetType::SCROLL_SENSITIVE, ResultSetConcurrency::UPDATABLE },
    1591                 :            :             { ResultSetType::SCROLL_INSENSITIVE, ResultSetConcurrency::UPDATABLE },
    1592                 :            :             { ResultSetType::SCROLL_SENSITIVE, ResultSetConcurrency::READ_ONLY },
    1593                 :            :             { ResultSetType::SCROLL_INSENSITIVE, ResultSetConcurrency::READ_ONLY },
    1594                 :            :             { ResultSetType::FORWARD_ONLY, ResultSetConcurrency::READ_ONLY }
    1595                 :          0 :         };
    1596                 :          0 :         sal_Int32 i=0;
    1597 [ #  # ][ #  # ]:          0 :         if ( m_xActiveConnection->getMetaData()->isReadOnly() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1598                 :          0 :             i = 2; // if the database is read-only we only should use read-only concurrency
    1599                 :            : 
    1600         [ #  # ]:          0 :         for ( ; i<5; ++i )
    1601                 :            :         {
    1602                 :          0 :             nResultSetType = nCharacteristics[i][0];
    1603                 :          0 :             nResultSetConcurrency = nCharacteristics[i][1];
    1604                 :            : 
    1605                 :            :             // don't try type/concurrency pairs which are more featured than what our caller requested
    1606         [ #  # ]:          0 :             if ( nResultSetType > _nDesiredResultSetType )
    1607                 :          0 :                 continue;
    1608         [ #  # ]:          0 :             if ( nResultSetConcurrency > _nDesiredResultSetConcurrency )
    1609                 :          0 :                 continue;
    1610                 :            : 
    1611 [ #  # ][ #  # ]:          0 :             if ( xMeta.is() && xMeta->supportsResultSetConcurrency( nResultSetType, nResultSetConcurrency ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1612                 :          0 :                 break;
    1613                 :          0 :         }
    1614                 :            :     }
    1615                 :            : 
    1616 [ +  - ][ +  - ]:         40 :     _rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, makeAny( nResultSetType ) );
         [ +  - ][ +  - ]
    1617 [ +  - ][ +  - ]:         40 :     _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
         [ +  - ][ +  - ]
    1618                 :         40 : }
    1619                 :            : 
    1620                 :         62 : Reference< XResultSet > ORowSet::impl_prepareAndExecute_throw()
    1621                 :            : {
    1622                 :         62 :     ::rtl::OUString sCommandToExecute;
    1623         [ +  + ]:         62 :     sal_Bool bUseEscapeProcessing = impl_initComposer_throw( sCommandToExecute );
    1624                 :            : 
    1625                 :         40 :     Reference< XResultSet> xResultSet;
    1626                 :            :     try
    1627                 :            :     {
    1628 [ +  - ][ +  - ]:         40 :         m_xStatement = m_xActiveConnection->prepareStatement( sCommandToExecute );
                 [ +  - ]
    1629         [ -  + ]:         40 :         if ( !m_xStatement.is() )
    1630                 :            :         {
    1631 [ #  # ][ #  # ]:          0 :             ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INTERNAL_ERROR ), SQL_GENERAL_ERROR, *this );
                 [ #  # ]
    1632                 :            :         }
    1633                 :            : 
    1634         [ +  - ]:         40 :         Reference< XPropertySet > xStatementProps( m_xStatement, UNO_QUERY_THROW );
    1635                 :            :         // set the result set type and concurrency
    1636                 :            :         try
    1637                 :            :         {
    1638 [ +  - ][ +  - ]:         40 :             xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( sal_True ) );
         [ +  - ][ +  - ]
    1639 [ +  - ][ +  - ]:         40 :             xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) );
         [ +  - ][ #  # ]
                 [ +  - ]
    1640                 :            : 
    1641         [ +  - ]:         40 :             setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency );
    1642                 :            :         }
    1643         [ #  # ]:          0 :         catch ( const Exception& )
    1644                 :            :         {
    1645                 :            :             // this exception doesn't matter here because when we catch an exception
    1646                 :            :             // then the driver doesn't support this feature
    1647                 :            :         }
    1648         [ +  - ]:         40 :         m_aParameterValueForCache.get().resize(1);
    1649         [ +  - ]:         40 :         Reference< XParameters > xParam( m_xStatement, UNO_QUERY_THROW );
    1650         [ +  - ]:         40 :         size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
    1651         [ +  + ]:         52 :         for ( size_t i=1; i<=nParamCount; ++i )
    1652                 :            :         {
    1653         [ +  - ]:         12 :             ORowSetValue& rParamValue( getParameterStorage( (sal_Int32)i ) );
    1654 [ +  - ][ +  - ]:         12 :             ::dbtools::setObjectWithInfo( xParam, i, rParamValue.makeAny(), rParamValue.getTypeKind() );
    1655         [ +  - ]:         12 :             m_aParameterValueForCache.get().push_back(rParamValue);
    1656                 :            :         }
    1657                 :            : 
    1658 [ +  - ][ +  - ]:         40 :         xResultSet = m_xStatement->executeQuery();
                 [ +  - ]
    1659                 :            :     }
    1660   [ #  #  #  # ]:          0 :     catch( const SQLException& )
    1661                 :            :     {
    1662   [ #  #  #  # ]:          0 :         SQLExceptionInfo aError( ::cppu::getCaughtException() );
    1663                 :            :         OSL_ENSURE( aError.isValid(), "ORowSet::impl_prepareAndExecute_throw: caught an SQLException which we cannot analyze!" );
    1664                 :            : 
    1665                 :            :         // append information about what we were actually going to execute
    1666                 :            :         try
    1667                 :            :         {
    1668   [ #  #  #  #  :          0 :             String sQuery = bUseEscapeProcessing && m_xComposer.is() ? m_xComposer->getQuery() : m_aActiveCommand;
          #  #  #  #  #  
                      # ]
    1669   [ #  #  #  #  :          0 :             String sInfo( DBA_RES_PARAM( RID_STR_COMMAND_LEADING_TO_ERROR, "$command$", sQuery ) );
                   #  # ]
    1670   [ #  #  #  #  :          0 :             aError.append( SQLExceptionInfo::SQL_CONTEXT, sInfo );
          #  #  #  #  #  
                      # ]
    1671                 :            :         }
    1672         [ #  # ]:          0 :         catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
    1673                 :            : 
    1674                 :            :         // propagate
    1675   [ #  #  #  # ]:          0 :         aError.doThrow();
    1676                 :            :     }
    1677                 :            : 
    1678                 :         62 :     return xResultSet;
    1679                 :            : }
    1680                 :            : 
    1681                 :        880 : void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertySet >& _rxTemplateColumn, const Reference< XPropertySet >& _rxRowSetColumn )
    1682                 :            : {
    1683                 :            :     OSL_ENSURE( _rxTemplateColumn.is() && _rxRowSetColumn.is(),
    1684                 :            :         "ORowSet::impl_initializeColumnSettings_nothrow: this will crash!" );
    1685                 :            : 
    1686                 :        880 :     bool bHaveAnyColumnSetting = false;
    1687                 :            :     try
    1688                 :            :     {
    1689 [ +  - ][ +  - ]:        880 :         Reference< XPropertySetInfo > xInfo( _rxTemplateColumn->getPropertySetInfo(), UNO_QUERY_THROW );
                 [ +  - ]
    1690                 :            : 
    1691                 :            :         // a number of properties is plain copied
    1692                 :            :         const ::rtl::OUString aPropertyNames[] = {
    1693                 :            :             PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL,
    1694                 :            :             PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT
    1695 [ +  - ][ +  - ]:       7040 :         };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ #  #  #  # ]
                 [ +  - ]
    1696         [ +  + ]:       7040 :         for ( size_t i=0; i<sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
    1697                 :            :         {
    1698 [ +  - ][ +  - ]:       6160 :             if ( xInfo->hasPropertyByName( aPropertyNames[i] ) )
                 [ +  + ]
    1699                 :            :             {
    1700 [ +  - ][ +  - ]:       3080 :                 _rxRowSetColumn->setPropertyValue( aPropertyNames[i], _rxTemplateColumn->getPropertyValue( aPropertyNames[i] ) );
         [ +  - ][ +  - ]
    1701                 :       3080 :                 bHaveAnyColumnSetting = true;
    1702                 :            :             }
    1703                 :            :         }
    1704                 :            : 
    1705                 :            :         // the format key is slightly more complex
    1706                 :        880 :         sal_Int32 nFormatKey = 0;
    1707 [ +  - ][ +  - ]:        880 :         if( xInfo->hasPropertyByName( PROPERTY_NUMBERFORMAT ) )
         [ +  - ][ +  + ]
    1708                 :            :         {
    1709 [ +  - ][ +  - ]:        440 :             _rxTemplateColumn->getPropertyValue( PROPERTY_NUMBERFORMAT ) >>= nFormatKey;
                 [ +  - ]
    1710                 :        440 :             bHaveAnyColumnSetting = true;
    1711                 :            :         }
    1712 [ +  - ][ +  - ]:        880 :         if ( !nFormatKey && m_xNumberFormatTypes.is() )
                 [ +  - ]
    1713 [ +  - ][ +  - ]:        880 :             nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLocaleData().getLocale() );
         [ +  - ][ +  - ]
                 [ +  - ]
    1714 [ +  - ][ +  - ]:       7040 :         _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, makeAny( nFormatKey ) );
         [ +  - ][ +  - ]
                 [ +  + ]
           [ #  #  #  # ]
    1715                 :            :     }
    1716                 :          0 :     catch(Exception&)
    1717                 :            :     {
    1718                 :            :         DBG_UNHANDLED_EXCEPTION();
    1719                 :            :         return;
    1720                 :            :     }
    1721                 :            : 
    1722         [ +  + ]:        880 :     if ( bHaveAnyColumnSetting )
    1723                 :        440 :         return;
    1724                 :            : 
    1725                 :            :     // the template column could not provide *any* setting. Okay, probably it's a parser column, which
    1726                 :            :     // does not offer those. However, perhaps the template column referes to a table column, which we
    1727                 :            :     // can use as new template column
    1728                 :            :     try
    1729                 :            :     {
    1730 [ +  - ][ +  - ]:        440 :         Reference< XPropertySetInfo > xInfo( _rxTemplateColumn->getPropertySetInfo(), UNO_QUERY_THROW );
                 [ +  - ]
    1731 [ +  - ][ +  - ]:        440 :         if ( !xInfo->hasPropertyByName( PROPERTY_TABLENAME ) )
         [ -  + ][ +  - ]
    1732                 :            :             // no chance
    1733                 :            :             return;
    1734                 :            : 
    1735                 :        440 :         ::rtl::OUString sTableName;
    1736 [ +  - ][ +  - ]:        440 :         OSL_VERIFY( _rxTemplateColumn->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName );
                 [ +  - ]
    1737                 :            : 
    1738 [ +  - ][ +  - ]:        440 :         Reference< XNameAccess > xTables( impl_getTables_throw(), UNO_QUERY_THROW );
    1739 [ +  - ][ -  + ]:        440 :         if ( !xTables->hasByName( sTableName ) )
                 [ +  - ]
    1740                 :            :             // no chance
    1741                 :            :             return;
    1742                 :            : 
    1743 [ +  - ][ +  - ]:        440 :         Reference< XColumnsSupplier > xTableColSup( xTables->getByName( sTableName ), UNO_QUERY_THROW );
                 [ +  - ]
    1744 [ +  - ][ +  - ]:        440 :         Reference< XNameAccess > xTableCols( xTableColSup->getColumns(), UNO_QUERY_THROW );
                 [ +  - ]
    1745                 :            : 
    1746                 :        440 :         ::rtl::OUString sTableColumnName;
    1747                 :            : 
    1748                 :            :         // get the "Name" or (preferred) "RealName" property of the column
    1749         [ +  - ]:        440 :         ::rtl::OUString sNamePropertyName( PROPERTY_NAME );
    1750 [ +  - ][ +  - ]:        440 :         if ( xInfo->hasPropertyByName( PROPERTY_REALNAME ) )
         [ +  - ][ +  - ]
    1751         [ +  - ]:        440 :             sNamePropertyName = PROPERTY_REALNAME;
    1752 [ +  - ][ +  - ]:        440 :         OSL_VERIFY( _rxTemplateColumn->getPropertyValue( sNamePropertyName ) >>= sTableColumnName );
    1753                 :            : 
    1754 [ +  - ][ -  + ]:        440 :         if ( !xTableCols->hasByName( sTableColumnName ) )
                 [ +  - ]
    1755                 :            :             return;
    1756                 :            : 
    1757 [ +  - ][ +  - ]:        440 :         Reference< XPropertySet > xTableColumn( xTableCols->getByName( sTableColumnName ), UNO_QUERY_THROW );
                 [ +  - ]
    1758 [ -  + ][ -  + ]:        880 :         impl_initializeColumnSettings_nothrow( xTableColumn, _rxRowSetColumn );
         [ -  + ][ -  + ]
         [ -  + ][ -  + ]
         [ +  - ][ #  # ]
                 [ +  - ]
    1759                 :            :     }
    1760                 :          0 :     catch( const Exception& )
    1761                 :            :     {
    1762                 :            :         DBG_UNHANDLED_EXCEPTION();
    1763                 :            :     }
    1764                 :            : }
    1765                 :            : 
    1766                 :         62 : void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotification)
    1767                 :            : {
    1768                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn" );
    1769                 :            : 
    1770                 :            :     // now we can dispose our old connection
    1771                 :         62 :     ::comphelper::disposeComponent(m_xOldConnection);
    1772                 :         62 :     m_xOldConnection = NULL;
    1773                 :            : 
    1774                 :            :     // do we need a new statement
    1775         [ +  - ]:         62 :     if ( m_bCommandFacetsDirty )
    1776                 :            :     {
    1777         [ +  - ]:         62 :         m_xStatement    = NULL;
    1778         [ +  - ]:         62 :         m_xComposer     = NULL;
    1779                 :            : 
    1780         [ +  + ]:         62 :         Reference< XResultSet > xResultSet( impl_prepareAndExecute_throw() );
    1781                 :            : 
    1782                 :            :         // let our warnings container forget the reference to the (possibly disposed) old result set
    1783 [ +  - ][ +  - ]:         40 :         m_aWarnings.setExternalWarnings( NULL );
    1784                 :            :         // clear all current warnings
    1785         [ +  - ]:         40 :         m_aWarnings.clearWarnings();
    1786                 :            :         // let the warnings container know about the new "external warnings"
    1787 [ +  - ][ +  - ]:         40 :         m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
    1788                 :            : 
    1789                 :         40 :         ::rtl::OUString aComposedUpdateTableName;
    1790         [ -  + ]:         40 :         if ( !m_aUpdateTableName.isEmpty() )
    1791 [ #  # ][ #  # ]:          0 :             aComposedUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), m_aUpdateCatalogName, m_aUpdateSchemaName, m_aUpdateTableName, sal_False, ::dbtools::eInDataManipulation );
                 [ #  # ]
    1792                 :            : 
    1793                 :            :         {
    1794                 :            :             RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" );
    1795 [ +  - ][ +  - ]:         40 :             m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter,m_nMaxRows );
         [ +  - ][ +  - ]
    1796         [ -  + ]:         40 :             if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
    1797                 :            :             {
    1798                 :          0 :                 m_nPrivileges = Privilege::SELECT;
    1799                 :          0 :                 m_pCache->m_nPrivileges = Privilege::SELECT;
    1800                 :            :             }
    1801         [ +  - ]:         40 :             m_pCache->setFetchSize(m_nFetchSize);
    1802 [ +  - ][ +  - ]:         40 :             m_aCurrentRow   = m_pCache->createIterator(this);
    1803                 :         40 :             m_bIsInsertRow  = sal_False;
    1804 [ +  - ][ +  - ]:         40 :             m_aOldRow       = m_pCache->registerOldRow();
                 [ +  - ]
    1805                 :            :         }
    1806                 :            : 
    1807                 :            :         // get the locale
    1808 [ +  - ][ +  - ]:         40 :         Locale aLocale = SvtSysLocale().GetLocaleData().getLocale();
         [ +  - ][ +  - ]
    1809                 :            : 
    1810                 :            :         // get the numberformatTypes
    1811                 :            :         OSL_ENSURE(m_xActiveConnection.is(),"No ActiveConnection");
    1812                 :         40 :         Reference< XNumberFormatTypes> xNumberFormatTypes;
    1813         [ +  - ]:         40 :         Reference< XNumberFormatsSupplier> xNumberFormat = ::dbtools::getNumberFormats(m_xActiveConnection);
    1814         [ +  - ]:         40 :         if ( xNumberFormat.is() )
    1815 [ +  - ][ +  - ]:         40 :             m_xNumberFormatTypes.set(xNumberFormat->getNumberFormats(),UNO_QUERY);
                 [ +  - ]
    1816                 :            : 
    1817 [ +  - ][ +  - ]:         40 :         ::rtl::Reference< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns();
    1818         [ +  - ]:         40 :         ::std::vector< ::rtl::OUString> aNames;
    1819                 :         40 :         ::rtl::OUString aDescription;
    1820                 :            : 
    1821                 :         40 :         const ::std::map<sal_Int32,sal_Int32>& rKeyColumns = m_pCache->getKeyColumns();
    1822         [ -  + ]:         40 :         if(!m_xColumns.is())
    1823                 :            :         {
    1824                 :            :             RTL_LOGFILE_CONTEXT_AUTHOR( aColumnCreateLog, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn::creating columns" );
    1825                 :            :             // use the meta data
    1826         [ #  # ]:          0 :             Reference<XResultSetMetaDataSupplier> xMetaSup(m_xStatement,UNO_QUERY);
    1827                 :            :             try
    1828                 :            :             {
    1829 [ #  # ][ #  # ]:          0 :                 Reference<XResultSetMetaData> xMetaData = xMetaSup->getMetaData();
    1830         [ #  # ]:          0 :                 if ( xMetaData.is() )
    1831                 :            :                 {
    1832 [ #  # ][ #  # ]:          0 :                     sal_Int32 nCount = xMetaData->getColumnCount();
    1833         [ #  # ]:          0 :                     m_aDataColumns.reserve(nCount+1);
    1834         [ #  # ]:          0 :                     aColumns->get().reserve(nCount+1);
    1835                 :            :                     DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
    1836         [ #  # ]:          0 :                     StringMap aColumnMap;
    1837         [ #  # ]:          0 :                     for (sal_Int32 i = 0 ; i < nCount; ++i)
    1838                 :            :                     {
    1839                 :            :                         // retrieve the name of the column
    1840 [ #  # ][ #  # ]:          0 :                         ::rtl::OUString sName = xMetaData->getColumnName(i + 1);
    1841                 :            :                         // check for duplicate entries
    1842 [ #  # ][ #  # ]:          0 :                         if(aColumnMap.find(sName) != aColumnMap.end())
    1843                 :            :                         {
    1844                 :          0 :                             ::rtl::OUString sAlias(sName);
    1845                 :          0 :                             sal_Int32 searchIndex=1;
    1846 [ #  # ][ #  # ]:          0 :                             while(aColumnMap.find(sAlias) != aColumnMap.end())
    1847                 :            :                             {
    1848                 :          0 :                                 (sAlias = sName) += ::rtl::OUString::valueOf(searchIndex++);
    1849                 :            :                             }
    1850                 :          0 :                             sName = sAlias;
    1851                 :            :                         }
    1852                 :          0 :                         ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
    1853                 :            :                                                                             this,
    1854                 :            :                                                                             this,
    1855                 :            :                                                                             i+1,
    1856         [ #  # ]:          0 :                                                                             m_xActiveConnection->getMetaData(),
    1857                 :            :                                                                             aDescription,
    1858                 :            :                                                                             ::rtl::OUString(),
    1859 [ #  # ][ #  # ]:          0 :                                                                             m_aCurrentRow);
         [ #  # ][ #  # ]
                 [ #  # ]
    1860         [ #  # ]:          0 :                         aColumnMap.insert(StringMap::value_type(sName,0));
    1861 [ #  # ][ #  # ]:          0 :                         aColumns->get().push_back(pColumn);
                 [ #  # ]
    1862         [ #  # ]:          0 :                         pColumn->setName(sName);
    1863         [ #  # ]:          0 :                         aNames.push_back(sName);
    1864         [ #  # ]:          0 :                         m_aDataColumns.push_back(pColumn);
    1865                 :            : 
    1866 [ #  # ][ #  # ]:          0 :                         pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i+1) != rKeyColumns.end()));
         [ #  # ][ #  # ]
    1867                 :            : 
    1868                 :            :                         try
    1869                 :            :                         {
    1870                 :          0 :                             sal_Int32 nFormatKey = 0;
    1871         [ #  # ]:          0 :                             if(m_xNumberFormatTypes.is())
    1872 [ #  # ][ #  # ]:          0 :                                 nFormatKey = ::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale);
                 [ #  # ]
    1873                 :            : 
    1874                 :            : 
    1875 [ #  # ][ #  # ]:          0 :                             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
    1876 [ #  # ][ #  # ]:          0 :                             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,makeAny(sal_Int32(i+1)));
    1877 [ #  # ][ #  # ]:          0 :                             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,makeAny(sal_Int32(227)));
    1878 [ #  # ][ #  # ]:          0 :                             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny((sal_Int32)0));
    1879 [ #  # ][ #  # ]:          0 :                             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,::cppu::bool2any(sal_False));
                 [ #  # ]
    1880                 :            :                         }
    1881         [ #  # ]:          0 :                         catch(Exception&)
    1882                 :            :                         {
    1883                 :            :                         }
    1884                 :          0 :                     }
    1885         [ #  # ]:          0 :                 }
    1886                 :            :             }
    1887         [ #  # ]:          0 :             catch (SQLException&)
    1888                 :            :             {
    1889                 :          0 :             }
    1890                 :            :         }
    1891                 :            :         else
    1892                 :            :         {
    1893                 :            :             // create the rowset columns
    1894 [ +  - ][ +  - ]:         40 :             Reference< XResultSetMetaData > xMeta( getMetaData(), UNO_QUERY_THROW );
    1895 [ +  - ][ +  - ]:         40 :             sal_Int32 nCount = xMeta->getColumnCount();
    1896         [ +  - ]:         40 :             m_aDataColumns.reserve(nCount+1);
    1897         [ +  - ]:         40 :             aColumns->get().reserve(nCount+1);
    1898         [ +  - ]:         40 :             ::std::set< Reference< XPropertySet > > aAllColumns;
    1899                 :            : 
    1900         [ +  + ]:        480 :             for(sal_Int32 i=1; i <= nCount ;++i)
    1901                 :            :             {
    1902 [ +  - ][ +  - ]:        440 :                 ::rtl::OUString sName = xMeta->getColumnName(i);
    1903 [ +  - ][ +  - ]:        440 :                 ::rtl::OUString sColumnLabel = xMeta->getColumnLabel(i);
    1904                 :            : 
    1905                 :            :                 // retrieve the column number |i|
    1906                 :        440 :                 Reference<XPropertySet> xColumn;
    1907                 :            :                 {
    1908                 :        440 :                     sal_Bool bReFetchName = sal_False;
    1909 [ +  - ][ +  - ]:        440 :                     if (m_xColumns->hasByName(sColumnLabel))
                 [ +  - ]
    1910 [ +  - ][ +  - ]:        440 :                         m_xColumns->getByName(sColumnLabel) >>= xColumn;
                 [ +  - ]
    1911 [ -  + ][ #  # ]:        440 :                     if (!xColumn.is() && m_xColumns->hasByName(sName))
         [ #  # ][ #  # ]
                 [ -  + ]
    1912 [ #  # ][ #  # ]:          0 :                         m_xColumns->getByName(sName) >>= xColumn;
                 [ #  # ]
    1913                 :            : 
    1914                 :            :                     // check if column already in the list we need another
    1915 [ +  - ][ -  + ]:        440 :                     if ( aAllColumns.find( xColumn ) != aAllColumns.end() )
    1916                 :            :                     {
    1917         [ #  # ]:          0 :                         xColumn = NULL;
    1918                 :          0 :                         bReFetchName = sal_True;
    1919                 :          0 :                         sColumnLabel = ::rtl::OUString();
    1920                 :            :                     }
    1921         [ -  + ]:        440 :                     if(!xColumn.is())
    1922                 :            :                     {
    1923                 :            :                         // no column found so we could look at the position i
    1924         [ #  # ]:          0 :                         Reference<XIndexAccess> xIndexAccess(m_xColumns,UNO_QUERY);
    1925 [ #  # ][ #  # ]:          0 :                         if(xIndexAccess.is() && i <= xIndexAccess->getCount())
         [ #  # ][ #  # ]
                 [ #  # ]
    1926                 :            :                         {
    1927 [ #  # ][ #  # ]:          0 :                             xIndexAccess->getByIndex(i-1) >>= xColumn;
                 [ #  # ]
    1928                 :            :                         }
    1929                 :            :                         else
    1930                 :            :                         {
    1931 [ #  # ][ #  # ]:          0 :                             Sequence< ::rtl::OUString> aSeq = m_xColumns->getElementNames();
    1932         [ #  # ]:          0 :                             if( i <= aSeq.getLength())
    1933                 :            :                             {
    1934 [ #  # ][ #  # ]:          0 :                                 m_xColumns->getByName(aSeq.getConstArray()[i-1]) >>= xColumn;
                 [ #  # ]
    1935         [ #  # ]:          0 :                             }
    1936                 :          0 :                         }
    1937                 :            :                     }
    1938 [ -  + ][ #  # ]:        440 :                     if(bReFetchName && xColumn.is())
                 [ -  + ]
    1939 [ #  # ][ #  # ]:          0 :                         xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
                 [ #  # ]
    1940         [ +  - ]:        440 :                     aAllColumns.insert( xColumn );
    1941                 :            :                 }
    1942                 :            : 
    1943                 :            :                 // create a RowSetDataColumn
    1944                 :            :                 {
    1945 [ +  - ][ +  - ]:        440 :                     Reference<XPropertySetInfo> xInfo = xColumn.is() ? xColumn->getPropertySetInfo() : Reference<XPropertySetInfo>();
                 [ +  - ]
    1946 [ +  - ][ +  - ]:        440 :                     if(xInfo.is() && xInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
           [ +  -  #  # ]
    1947 [ +  - ][ +  - ]:        440 :                         aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
         [ +  - ][ +  - ]
    1948                 :            : 
    1949                 :        440 :                     ::rtl::OUString sParseLabel;
    1950         [ +  - ]:        440 :                     if ( xColumn.is() )
    1951                 :            :                     {
    1952 [ +  - ][ +  - ]:        440 :                         xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
                 [ +  - ]
    1953                 :            :                     }
    1954                 :        440 :                     ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
    1955                 :            :                                                                         this,
    1956                 :            :                                                                         this,
    1957                 :            :                                                                         i,
    1958         [ +  - ]:        440 :                                                                         m_xActiveConnection->getMetaData(),
    1959                 :            :                                                                         aDescription,
    1960                 :            :                                                                         sParseLabel,
    1961 [ +  - ][ +  - ]:        880 :                                                                         m_aCurrentRow);
         [ +  - ][ +  - ]
                 [ +  - ]
    1962 [ +  - ][ +  - ]:        440 :                     aColumns->get().push_back(pColumn);
                 [ +  - ]
    1963                 :            : 
    1964 [ +  - ][ +  - ]:        440 :                     pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i) != rKeyColumns.end()));
         [ +  - ][ +  - ]
    1965                 :            : 
    1966         [ -  + ]:        440 :                     if(sColumnLabel.isEmpty())
    1967                 :            :                     {
    1968         [ #  # ]:          0 :                         if(xColumn.is())
    1969 [ #  # ][ #  # ]:          0 :                             xColumn->getPropertyValue(PROPERTY_NAME) >>= sColumnLabel;
                 [ #  # ]
    1970                 :            :                         else
    1971         [ #  # ]:          0 :                             sColumnLabel = DBACORE_RESSTRING( RID_STR_EXPRESSION1 );
    1972                 :            :                     }
    1973         [ +  - ]:        440 :                     pColumn->setName(sColumnLabel);
    1974         [ +  - ]:        440 :                     aNames.push_back(sColumnLabel);
    1975         [ +  - ]:        440 :                     m_aDataColumns.push_back(pColumn);
    1976                 :            : 
    1977         [ +  - ]:        440 :                     if ( xColumn.is() )
    1978 [ +  - ][ +  - ]:        440 :                         impl_initializeColumnSettings_nothrow( xColumn, pColumn );
                 [ +  - ]
    1979                 :            :                 }
    1980                 :        480 :             }
    1981                 :            :         }
    1982                 :            :         // now create the columns we need
    1983         [ +  + ]:         40 :         if(m_pColumns)
    1984         [ +  - ]:         12 :             m_pColumns->assign(aColumns,aNames);
    1985                 :            :         else
    1986                 :            :         {
    1987 [ +  - ][ +  - ]:         28 :             Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData();
    1988 [ +  - ][ +  - ]:         56 :             m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),
    1989 [ +  - ][ +  - ]:         56 :                                                 aColumns,*this,m_aColumnsMutex,aNames);
         [ +  - ][ +  - ]
    1990         [ +  - ]:         62 :         }
    1991                 :            :     }
    1992                 :         40 :     checkCache();
    1993                 :            :     // notify the rowset listeners
    1994                 :         40 :     notifyAllListeners(_rClearForNotification);
    1995                 :         40 : }
    1996                 :            : 
    1997                 :            : // XRowSetApproveBroadcaster
    1998                 :          2 : void SAL_CALL ORowSet::addRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException)
    1999                 :            : {
    2000         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2001                 :            : 
    2002         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2003                 :            : 
    2004 [ +  - ][ +  - ]:          2 :     m_aApproveListeners.addInterface(listener);
    2005                 :          2 : }
    2006                 :            : 
    2007                 :          2 : void SAL_CALL ORowSet::removeRowSetApproveListener( const Reference< XRowSetApproveListener >& listener ) throw(RuntimeException)
    2008                 :            : {
    2009         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2010                 :            : 
    2011         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2012                 :            : 
    2013 [ +  - ][ +  - ]:          2 :     m_aApproveListeners.removeInterface(listener);
    2014                 :          2 : }
    2015                 :            : // XRowsChangeBroadcaster
    2016                 :          2 : void SAL_CALL ORowSet::addRowsChangeListener( const Reference< XRowsChangeListener >& listener ) throw(RuntimeException)
    2017                 :            : {
    2018         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2019                 :            : 
    2020         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2021                 :            : 
    2022 [ +  - ][ +  - ]:          2 :     m_aRowsChangeListener.addInterface(listener);
    2023                 :          2 : }
    2024                 :            : 
    2025                 :          0 : void SAL_CALL ORowSet::removeRowsChangeListener( const Reference< XRowsChangeListener >& listener ) throw(RuntimeException)
    2026                 :            : {
    2027         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2028                 :            : 
    2029         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2030                 :            : 
    2031 [ #  # ][ #  # ]:          0 :     m_aRowsChangeListener.removeInterface(listener);
    2032                 :          0 : }
    2033                 :            : 
    2034                 :            : // XResultSetAccess
    2035                 :          4 : Reference< XResultSet > SAL_CALL ORowSet::createResultSet(  ) throw(SQLException, RuntimeException)
    2036                 :            : {
    2037         [ +  - ]:          4 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2038                 :            : 
    2039         [ +  - ]:          4 :     if(m_xStatement.is())
    2040                 :            :     {
    2041         [ +  - ]:          4 :         ORowSetClone* pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
    2042 [ +  - ][ +  - ]:          4 :         Reference< XResultSet > xRet(pClone);
    2043 [ +  - ][ +  - ]:          4 :         m_aClones.push_back(WeakReferenceHelper(xRet));
                 [ +  - ]
    2044                 :          4 :         return xRet;
    2045                 :            :     }
    2046         [ +  - ]:          4 :     return Reference< XResultSet >();
    2047                 :            : }
    2048                 :            : 
    2049                 :            : // ::com::sun::star::util::XCancellable
    2050                 :          2 : void SAL_CALL ORowSet::cancel(  ) throw(RuntimeException)
    2051                 :            : {
    2052                 :          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2053                 :          2 : }
    2054                 :            : 
    2055                 :            : // ::com::sun::star::sdbcx::XDeleteRows
    2056                 :          0 : Sequence< sal_Int32 > SAL_CALL ORowSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException)
    2057                 :            : {
    2058         [ #  # ]:          0 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2059                 :            : 
    2060 [ #  # ][ #  # ]:          0 :     if(!m_pCache || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
    2061 [ #  # ][ #  # ]:          0 :         throwFunctionSequenceException(*this);
    2062                 :            : 
    2063         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard( *m_pMutex );
    2064                 :            : 
    2065         [ #  # ]:          0 :     Sequence<Any> aChangedBookmarks;
    2066 [ #  # ][ #  # ]:          0 :     RowsChangeEvent aEvt(*this,RowChangeAction::DELETE,rows.getLength(),aChangedBookmarks);
    2067                 :            :     // notify the rowset listeners
    2068         [ #  # ]:          0 :     notifyAllListenersRowBeforeChange(aGuard,aEvt);
    2069                 :            : 
    2070         [ #  # ]:          0 :     Sequence< sal_Int32 > aResults( rows.getLength() );
    2071                 :          0 :     const Any* row = rows.getConstArray();
    2072                 :          0 :     const Any* rowEnd = rows.getConstArray() + rows.getLength();
    2073         [ #  # ]:          0 :     sal_Int32* result = aResults.getArray();
    2074         [ #  # ]:          0 :     for ( ; row != rowEnd; ++row, ++result )
    2075                 :            :     {
    2076                 :          0 :         *result = 0;
    2077 [ #  # ][ #  # ]:          0 :         if ( !m_pCache->moveToBookmark( *row ) )
    2078                 :          0 :             continue;
    2079         [ #  # ]:          0 :         sal_Int32 nDeletePosition = m_pCache->getRow();
    2080                 :            : 
    2081                 :            :         // first notify the clones so that they can save their position
    2082         [ #  # ]:          0 :         notifyRowSetAndClonesRowDelete( *row );
    2083                 :            : 
    2084                 :            :         // now delete the row
    2085 [ #  # ][ #  # ]:          0 :         if ( !m_pCache->deleteRow() )
    2086                 :          0 :             continue;
    2087                 :          0 :         *result = 1;
    2088                 :            :         // now notify that we have deleted
    2089         [ #  # ]:          0 :         notifyRowSetAndClonesRowDeleted( *row, nDeletePosition );
    2090                 :            :     }
    2091                 :          0 :     aEvt.Rows = aResults.getLength();
    2092                 :            : 
    2093                 :            :     // we have to check if we stand on the insert row and if so we have to reset it
    2094         [ #  # ]:          0 :     ORowSetNotifier aNotifier( this );
    2095                 :            :         // this will call cancelRowModification on the cache if necessary
    2096                 :            :     // notification order
    2097                 :            :     // - rowChanged
    2098         [ #  # ]:          0 :     notifyAllListenersRowChanged(aGuard,aEvt);
    2099                 :            : 
    2100                 :            :     // - IsModified
    2101                 :            :     // - IsNew
    2102         [ #  # ]:          0 :     aNotifier.fire();
    2103                 :            : 
    2104                 :            :     // - RowCount/IsRowCountFinal
    2105         [ #  # ]:          0 :     fireRowcount();
    2106                 :            : 
    2107 [ #  # ][ #  # ]:          0 :     return aResults;
         [ #  # ][ #  # ]
    2108                 :            : }
    2109                 :            : 
    2110                 :          2 : void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
    2111                 :            : {
    2112                 :            :     // notify ourself
    2113         [ +  - ]:          2 :     onDeleteRow( _rBookmark );
    2114                 :            :     // notify the clones
    2115                 :          2 :     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
    2116 [ +  - ][ -  + ]:          2 :     for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i)
                 [ #  # ]
    2117                 :            :     {
    2118 [ #  # ][ #  # ]:          0 :         Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
                 [ #  # ]
    2119         [ #  # ]:          0 :         if(xTunnel.is())
    2120                 :            :         {
    2121 [ #  # ][ #  # ]:          0 :             ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId()));
         [ #  # ][ #  # ]
    2122         [ #  # ]:          0 :             if(pClone)
    2123         [ #  # ]:          0 :                 pClone->onDeleteRow( _rBookmark );
    2124                 :            :         }
    2125                 :          0 :     }
    2126                 :          2 : }
    2127                 :            : 
    2128                 :          2 : void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 _nPos )
    2129                 :            : {
    2130                 :            :     // notify ourself
    2131         [ +  - ]:          2 :     onDeletedRow( _rBookmark, _nPos );
    2132                 :            :     // notify the clones
    2133                 :          2 :     connectivity::OWeakRefArray::iterator aEnd = m_aClones.end();
    2134 [ +  - ][ -  + ]:          2 :     for (connectivity::OWeakRefArray::iterator i = m_aClones.begin(); aEnd != i; ++i)
                 [ #  # ]
    2135                 :            :     {
    2136 [ #  # ][ #  # ]:          0 :         Reference< XUnoTunnel > xTunnel(i->get(),UNO_QUERY);
                 [ #  # ]
    2137         [ #  # ]:          0 :         if(xTunnel.is())
    2138                 :            :         {
    2139 [ #  # ][ #  # ]:          0 :             ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId()));
         [ #  # ][ #  # ]
    2140         [ #  # ]:          0 :             if(pClone)
    2141         [ #  # ]:          0 :                 pClone->onDeletedRow( _rBookmark, _nPos );
    2142                 :            :         }
    2143                 :          0 :     }
    2144                 :          2 : }
    2145                 :            : 
    2146                 :         62 : Reference< XConnection >  ORowSet::calcConnection(const Reference< XInteractionHandler >& _rxHandler) throw( SQLException, RuntimeException )
    2147                 :            : {
    2148         [ +  - ]:         62 :     MutexGuard aGuard(m_aMutex);
    2149         [ +  + ]:         62 :     if (!m_xActiveConnection.is())
    2150                 :            :     {
    2151                 :         24 :         Reference< XConnection > xNewConn;
    2152         [ +  - ]:         24 :         if ( !m_aDataSourceName.isEmpty() )
    2153                 :            :         {
    2154                 :            :             Reference< XNameAccess > xDatabaseContext(
    2155                 :            :                 m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ),
    2156 [ +  - ][ +  - ]:         24 :                 UNO_QUERY_THROW );
                 [ +  - ]
    2157                 :            :             try
    2158                 :            :             {
    2159 [ +  - ][ +  - ]:         24 :                 Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW );
                 [ +  - ]
    2160                 :            : 
    2161                 :            :                 // try connecting with the interaction handler
    2162         [ +  - ]:         24 :                 Reference< XCompletedConnection > xComplConn( xDataSource, UNO_QUERY );
    2163 [ +  + ][ +  - ]:         24 :                 if ( _rxHandler.is() && xComplConn.is() )
                 [ +  + ]
    2164                 :            :                 {
    2165 [ +  - ][ +  - ]:          6 :                     xNewConn = xComplConn->connectWithCompletion( _rxHandler );
                 [ +  - ]
    2166                 :            :                 }
    2167                 :            :                 else
    2168                 :            :                 {
    2169 [ +  - ][ +  - ]:         18 :                     xNewConn = xDataSource->getConnection( m_aUser, m_aPassword );
                 [ +  - ]
    2170                 :         24 :                 }
    2171                 :            :             }
    2172                 :          0 :             catch ( const SQLException& )
    2173                 :            :             {
    2174                 :          0 :                 throw;
    2175                 :            :             }
    2176   [ #  #  #  #  :          0 :             catch ( const Exception& )
                      # ]
    2177                 :            :             {
    2178         [ #  # ]:          0 :                 Any aError = ::cppu::getCaughtException();
    2179                 :            :                 ::rtl::OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE,
    2180   [ #  #  #  # ]:          0 :                     "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) );
    2181   [ #  #  #  # ]:          0 :                 ::dbtools::throwGenericSQLException( sMessage, *this );
    2182                 :         24 :             }
    2183                 :            :         }
    2184         [ +  - ]:         24 :         setActiveConnection(xNewConn);
    2185                 :         24 :         m_bOwnConnection = sal_True;
    2186                 :            :     }
    2187         [ +  - ]:         62 :     return m_xActiveConnection;
    2188                 :            : }
    2189                 :            : 
    2190                 :        484 : Reference< XNameAccess > ORowSet::impl_getTables_throw()
    2191                 :            : {
    2192                 :        484 :     Reference< XNameAccess > xTables;
    2193                 :            : 
    2194         [ +  - ]:        484 :     Reference< XTablesSupplier >  xTablesAccess( m_xActiveConnection, UNO_QUERY );
    2195         [ +  - ]:        484 :     if ( xTablesAccess.is() )
    2196                 :            :     {
    2197 [ +  - ][ +  - ]:        484 :         xTables.set( xTablesAccess->getTables(), UNO_QUERY_THROW );
                 [ +  - ]
    2198                 :            :     }
    2199         [ #  # ]:          0 :     else if ( m_pTables )
    2200                 :            :     {
    2201 [ #  # ][ #  # ]:          0 :         xTables = m_pTables;
    2202                 :            :     }
    2203                 :            :     else
    2204                 :            :     {
    2205         [ #  # ]:          0 :         if ( !m_xActiveConnection.is() )
    2206 [ #  # ][ #  # ]:          0 :             throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() );
         [ #  # ][ #  # ]
    2207                 :            : 
    2208                 :          0 :         sal_Bool bCase = sal_True;
    2209                 :            :         try
    2210                 :            :         {
    2211 [ #  # ][ #  # ]:          0 :             Reference<XDatabaseMetaData> xMeta = m_xActiveConnection->getMetaData();
    2212 [ #  # ][ #  # ]:          0 :             bCase = xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers();
         [ #  # ][ #  # ]
                 [ #  # ]
    2213                 :            :         }
    2214         [ #  # ]:          0 :         catch(SQLException&)
    2215                 :            :         {
    2216                 :            :             DBG_UNHANDLED_EXCEPTION();
    2217                 :            :         }
    2218                 :            : 
    2219 [ #  # ][ #  # ]:          0 :         m_pTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,NULL,NULL,NULL,m_nInAppend);
                 [ #  # ]
    2220 [ #  # ][ #  # ]:          0 :         xTables = m_pTables;
    2221         [ #  # ]:          0 :         Sequence< ::rtl::OUString> aTableFilter(1);
    2222         [ #  # ]:          0 :         aTableFilter[0] = ::rtl::OUString("%");
    2223 [ #  # ][ #  # ]:          0 :         m_pTables->construct(aTableFilter,Sequence< ::rtl::OUString>());
         [ #  # ][ #  # ]
    2224                 :            :     }
    2225                 :            : 
    2226                 :        484 :     return xTables;
    2227                 :            : }
    2228                 :            : 
    2229                 :        482 : void ORowSet::impl_resetTables_nothrow()
    2230                 :            : {
    2231         [ +  - ]:        482 :     if ( !m_pTables )
    2232         [ #  # ]:        482 :         return;
    2233                 :            : 
    2234                 :            :     try
    2235                 :            :     {
    2236         [ #  # ]:          0 :         m_pTables->dispose();
    2237                 :            :     }
    2238                 :          0 :     catch( const Exception& )
    2239                 :            :     {
    2240                 :            :         DBG_UNHANDLED_EXCEPTION();
    2241                 :            :     }
    2242                 :            : 
    2243         [ #  # ]:          0 :     DELETEZ( m_pTables );
    2244                 :            : }
    2245                 :            : 
    2246                 :         62 : sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute )
    2247                 :            : {
    2248         [ +  + ]:         62 :     sal_Bool bUseEscapeProcessing = impl_buildActiveCommand_throw( );
    2249                 :         40 :     _out_rCommandToExecute = m_aActiveCommand;
    2250         [ -  + ]:         40 :     if ( !bUseEscapeProcessing )
    2251                 :          0 :         return bUseEscapeProcessing;
    2252                 :            : 
    2253         [ +  - ]:         40 :     Reference< XMultiServiceFactory > xFactory( m_xActiveConnection, UNO_QUERY );
    2254         [ +  - ]:         40 :     if ( xFactory.is() )
    2255                 :            :     {
    2256                 :            :         try
    2257                 :            :         {
    2258         [ +  - ]:         40 :             ::comphelper::disposeComponent( m_xComposer );
    2259 [ +  - ][ +  - ]:         40 :             m_xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY_THROW );
         [ +  - ][ +  - ]
    2260                 :            :         }
    2261   [ #  #  #  #  :          0 :         catch (const Exception& ) { m_xComposer = NULL; }
                   #  # ]
    2262                 :            :     }
    2263         [ -  + ]:         40 :     if ( !m_xComposer.is() )
    2264 [ #  # ][ #  # ]:          0 :         m_xComposer = new OSingleSelectQueryComposer( impl_getTables_throw(), m_xActiveConnection, m_aContext );
         [ #  # ][ #  # ]
    2265                 :            : 
    2266 [ +  - ][ +  - ]:         40 :     m_xComposer->setCommand( m_aCommand,m_nCommandType );
    2267 [ +  - ][ +  - ]:         40 :     m_aActiveCommand = m_xComposer->getQuery();
    2268                 :            : 
    2269 [ +  + ][ +  - ]:         40 :     m_xComposer->setFilter( m_bApplyFilter ? m_aFilter : ::rtl::OUString() );
                 [ +  - ]
    2270 [ +  + ][ +  - ]:         40 :     m_xComposer->setHavingClause( m_bApplyFilter ? m_aHavingClause : ::rtl::OUString() );
                 [ +  - ]
    2271                 :            : 
    2272         [ -  + ]:         40 :     if ( m_bIgnoreResult )
    2273                 :            :     {   // append a "0=1" filter
    2274                 :            :         // don't simply overwrite an existent filter, this would lead to problems if this existent
    2275                 :            :         // filter contains parameters (since a keyset may add parameters itself)
    2276 [ #  # ][ #  # ]:          0 :         m_xComposer->setElementaryQuery( m_xComposer->getQuery( ) );
         [ #  # ][ #  # ]
    2277 [ #  # ][ #  # ]:          0 :         m_xComposer->setFilter( ::rtl::OUString("0 = 1"  ) );
    2278                 :            :     }
    2279                 :            : 
    2280 [ +  - ][ +  - ]:         40 :     m_xComposer->setOrder( m_aOrder );
    2281 [ +  - ][ +  - ]:         40 :     m_xComposer->setGroup( m_aGroupBy );
    2282                 :            : 
    2283         [ +  - ]:         40 :     if ( !m_xColumns.is() )
    2284                 :            :     {
    2285         [ +  - ]:         40 :         Reference< XColumnsSupplier > xCols( m_xComposer, UNO_QUERY_THROW );
    2286 [ +  - ][ +  - ]:         40 :         m_xColumns = xCols->getColumns();
                 [ +  - ]
    2287                 :            :     }
    2288                 :            : 
    2289         [ +  - ]:         40 :     impl_initParametersContainer_nothrow();
    2290                 :            : 
    2291 [ +  - ][ +  - ]:         40 :     _out_rCommandToExecute = m_xComposer->getQueryWithSubstitution();
    2292                 :            : 
    2293                 :         62 :     return bUseEscapeProcessing;
    2294                 :            : }
    2295                 :            : 
    2296                 :         62 : sal_Bool ORowSet::impl_buildActiveCommand_throw()
    2297                 :            : {
    2298                 :            :     // create the sql command
    2299                 :            :     // from a table name or get the command out of a query (not a view)
    2300                 :            :     // the last use the command as it is
    2301                 :         62 :     sal_Bool bDoEscapeProcessing = m_bUseEscapeProcessing;
    2302                 :            : 
    2303                 :         62 :     m_aActiveCommand = ::rtl::OUString();
    2304                 :         62 :     ::rtl::OUString sCommand;
    2305                 :            : 
    2306         [ -  + ]:         62 :     if ( m_aCommand.isEmpty() )
    2307                 :          0 :         return bDoEscapeProcessing;
    2308                 :            : 
    2309      [ +  -  + ]:         62 :     switch (m_nCommandType)
    2310                 :            :     {
    2311                 :            :         case CommandType::TABLE:
    2312                 :            :         {
    2313         [ +  - ]:         44 :             impl_resetTables_nothrow();
    2314         [ +  - ]:         44 :             if ( bDoEscapeProcessing )
    2315                 :            :             {
    2316         [ +  - ]:         44 :                 Reference< XNameAccess > xTables( impl_getTables_throw() );
    2317 [ +  - ][ +  - ]:         44 :                 if ( xTables->hasByName(m_aCommand) )
                 [ +  + ]
    2318                 :            :                 {
    2319                 :            :                 }
    2320                 :            :                 else
    2321                 :            :                 {
    2322 [ +  - ][ +  - ]:         22 :                     String sMessage( DBACORE_RESSTRING( RID_STR_TABLE_DOES_NOT_EXIST ) );
    2323 [ +  - ][ +  - ]:         22 :                     sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
                 [ +  - ]
    2324 [ +  - ][ +  - ]:         22 :                     throwGenericSQLException(sMessage,*this);
         [ -  + ][ #  # ]
    2325                 :         44 :                 }
    2326                 :            :             }
    2327                 :            :             else
    2328                 :            :             {
    2329                 :          0 :                 sCommand = rtl::OUString("SELECT * FROM ");
    2330                 :          0 :                 ::rtl::OUString sCatalog, sSchema, sTable;
    2331 [ #  # ][ #  # ]:          0 :                 ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
                 [ #  # ]
    2332         [ #  # ]:          0 :                 sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable );
    2333                 :            :             }
    2334                 :            :         }
    2335                 :         22 :         break;
    2336                 :            : 
    2337                 :            :         case CommandType::QUERY:
    2338                 :            :         {
    2339         [ #  # ]:          0 :             Reference< XQueriesSupplier >  xQueriesAccess(m_xActiveConnection, UNO_QUERY);
    2340         [ #  # ]:          0 :             if (xQueriesAccess.is())
    2341                 :            :             {
    2342 [ #  # ][ #  # ]:          0 :                 Reference< ::com::sun::star::container::XNameAccess >  xQueries(xQueriesAccess->getQueries());
    2343 [ #  # ][ #  # ]:          0 :                 if (xQueries->hasByName(m_aCommand))
                 [ #  # ]
    2344                 :            :                 {
    2345 [ #  # ][ #  # ]:          0 :                     Reference< XPropertySet > xQuery(xQueries->getByName(m_aCommand),UNO_QUERY);
                 [ #  # ]
    2346                 :            :                     OSL_ENSURE(xQuery.is(),"ORowSet::impl_buildActiveCommand_throw: Query is NULL!");
    2347         [ #  # ]:          0 :                     if ( xQuery.is() )
    2348                 :            :                     {
    2349 [ #  # ][ #  # ]:          0 :                         xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
                 [ #  # ]
    2350 [ #  # ][ #  # ]:          0 :                         xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bDoEscapeProcessing;
                 [ #  # ]
    2351         [ #  # ]:          0 :                         if ( bDoEscapeProcessing != m_bUseEscapeProcessing )
    2352                 :            :                         {
    2353                 :          0 :                             sal_Bool bOldValue = m_bUseEscapeProcessing;
    2354                 :          0 :                             m_bUseEscapeProcessing = bDoEscapeProcessing;
    2355         [ #  # ]:          0 :                             fireProperty(PROPERTY_ID_ESCAPE_PROCESSING,bOldValue,bDoEscapeProcessing);
    2356                 :            :                         }
    2357                 :            : 
    2358                 :          0 :                         ::rtl::OUString aCatalog,aSchema,aTable;
    2359 [ #  # ][ #  # ]:          0 :                         xQuery->getPropertyValue(PROPERTY_UPDATE_CATALOGNAME)   >>= aCatalog;
                 [ #  # ]
    2360 [ #  # ][ #  # ]:          0 :                         xQuery->getPropertyValue(PROPERTY_UPDATE_SCHEMANAME)    >>= aSchema;
                 [ #  # ]
    2361 [ #  # ][ #  # ]:          0 :                         xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME)     >>= aTable;
                 [ #  # ]
    2362         [ #  # ]:          0 :                         if(!aTable.isEmpty())
    2363 [ #  # ][ #  # ]:          0 :                             m_aUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, sal_False, ::dbtools::eInDataManipulation );
                 [ #  # ]
    2364                 :          0 :                     }
    2365                 :            :                 }
    2366                 :            :                 else
    2367                 :            :                 {
    2368 [ #  # ][ #  # ]:          0 :                     String sMessage( DBACORE_RESSTRING( RID_STR_QUERY_DOES_NOT_EXIST ) );
    2369 [ #  # ][ #  # ]:          0 :                     sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
                 [ #  # ]
    2370 [ #  # ][ #  # ]:          0 :                     throwGenericSQLException(sMessage,*this);
         [ #  # ][ #  # ]
    2371                 :          0 :                 }
    2372                 :            :             }
    2373                 :            :             else
    2374 [ #  # ][ #  # ]:          0 :                 throw SQLException(DBA_RES(RID_STR_NO_XQUERIESSUPPLIER),*this,::rtl::OUString(),0,Any());
                 [ #  # ]
    2375                 :            :         }
    2376                 :          0 :         break;
    2377                 :            : 
    2378                 :            :         default:
    2379                 :         18 :             sCommand = m_aCommand;
    2380                 :         18 :             break;
    2381                 :            :     }
    2382                 :            : 
    2383                 :         40 :     m_aActiveCommand = sCommand;
    2384                 :            : 
    2385 [ -  + ][ -  + ]:         40 :     if ( m_aActiveCommand.isEmpty() && !bDoEscapeProcessing )
                 [ +  + ]
    2386 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
                 [ #  # ]
    2387                 :            : 
    2388                 :         62 :     return bDoEscapeProcessing;
    2389                 :            : }
    2390                 :            : 
    2391                 :         40 : void ORowSet::impl_initParametersContainer_nothrow()
    2392                 :            : {
    2393                 :            :     OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" );
    2394                 :            : 
    2395 [ +  - ][ +  - ]:         40 :     m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() );
    2396                 :            :     // copy the premature parameters into the final ones
    2397         [ +  - ]:         40 :     size_t nParamCount( ::std::min( m_pParameters->size(), m_aPrematureParamValues.get().size() ) );
    2398         [ +  + ]:         52 :     for ( size_t i=0; i<nParamCount; ++i )
    2399                 :            :     {
    2400                 :         12 :         (*m_pParameters)[i] = m_aPrematureParamValues.get()[i];
    2401                 :            :     }
    2402                 :         40 : }
    2403                 :            : 
    2404                 :        454 : void ORowSet::impl_disposeParametersContainer_nothrow()
    2405                 :            : {
    2406         [ +  + ]:        454 :     if ( !m_pParameters.is() )
    2407                 :        454 :         return;
    2408                 :            : 
    2409                 :            :     // copy the actual values to our "premature" ones, to preserve them for later use
    2410                 :         40 :     size_t nParamCount( m_pParameters->size() );
    2411                 :         40 :     m_aPrematureParamValues.get().resize( nParamCount );
    2412         [ +  + ]:         52 :     for ( size_t i=0; i<nParamCount; ++i )
    2413                 :            :     {
    2414                 :         12 :         m_aPrematureParamValues.get()[i] = (*m_pParameters)[i];
    2415                 :            :     }
    2416                 :            : 
    2417                 :         40 :     m_pParameters->dispose();
    2418                 :         40 :     m_pParameters = NULL;
    2419                 :            : }
    2420                 :            : 
    2421                 :         24 : ORowSetValue& ORowSet::getParameterStorage(sal_Int32 parameterIndex)
    2422                 :            : {
    2423                 :         24 :     ::connectivity::checkDisposed( ORowSet_BASE1::rBHelper.bDisposed );
    2424         [ -  + ]:         24 :     if ( parameterIndex < 1 )
    2425 [ #  # ][ #  # ]:          0 :         throwInvalidIndexException( *this );
    2426                 :            : 
    2427         [ +  + ]:         24 :     if ( m_aParametersSet.size() < (size_t)parameterIndex )
    2428                 :          4 :         m_aParametersSet.resize( parameterIndex ,false);
    2429                 :         24 :     m_aParametersSet[parameterIndex - 1] = true;
    2430                 :            : 
    2431         [ -  + ]:         24 :     if ( m_aParametersSet.size() < (size_t)parameterIndex )
    2432                 :          0 :         m_aParametersSet.resize( parameterIndex ,false);
    2433                 :         24 :     m_aParametersSet[parameterIndex - 1] = true;
    2434                 :            : 
    2435         [ +  + ]:         24 :     if ( m_pParameters.is() )
    2436                 :            :     {
    2437         [ +  - ]:         16 :         if ( m_bCommandFacetsDirty )
    2438                 :            :         // need to rebuild the parameters, since some property which contributes to the
    2439                 :            :         // complete command, and thus the parameters, changed
    2440                 :         16 :             impl_disposeParametersContainer_nothrow();
    2441         [ -  + ]:         16 :         if ( m_pParameters.is() )
    2442                 :            :         {
    2443         [ #  # ]:          0 :             if ( (size_t)parameterIndex > m_pParameters->size() )
    2444 [ #  # ][ #  # ]:          0 :                 throwInvalidIndexException( *this );
    2445                 :          0 :             return (*m_pParameters)[ parameterIndex - 1 ];
    2446                 :            :         }
    2447                 :            :     }
    2448                 :            : 
    2449         [ +  + ]:         24 :     if ( m_aPrematureParamValues.get().size() < (size_t)parameterIndex )
    2450                 :          6 :         m_aPrematureParamValues.get().resize( parameterIndex );
    2451                 :         24 :     return m_aPrematureParamValues.get()[ parameterIndex - 1 ];
    2452                 :            : }
    2453                 :            : 
    2454                 :            : // XParameters
    2455                 :          0 : void SAL_CALL ORowSet::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
    2456                 :            : {
    2457         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2458                 :            : 
    2459 [ #  # ][ #  # ]:          0 :     getParameterStorage( parameterIndex ).setNull();
                 [ #  # ]
    2460                 :          0 : }
    2461                 :            : 
    2462                 :          0 : void SAL_CALL ORowSet::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
    2463                 :            : {
    2464                 :          0 :     setNull( parameterIndex, sqlType );
    2465                 :          0 : }
    2466                 :            : 
    2467                 :         10 : void ORowSet::setParameter(sal_Int32 parameterIndex, const ORowSetValue& x)
    2468                 :            : {
    2469         [ +  - ]:         10 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2470                 :            : 
    2471 [ +  - ][ +  - ]:         10 :     getParameterStorage( parameterIndex ) = x;
                 [ +  - ]
    2472                 :         10 : }
    2473                 :            : 
    2474                 :          0 : void SAL_CALL ORowSet::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
    2475                 :            : {
    2476         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2477                 :          0 : }
    2478                 :            : 
    2479                 :          0 : void SAL_CALL ORowSet::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
    2480                 :            : {
    2481         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2482                 :          0 : }
    2483                 :            : 
    2484                 :          0 : void SAL_CALL ORowSet::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
    2485                 :            : {
    2486         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2487                 :          0 : }
    2488                 :            : 
    2489                 :          0 : void SAL_CALL ORowSet::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
    2490                 :            : {
    2491         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2492                 :          0 : }
    2493                 :            : 
    2494                 :          0 : void SAL_CALL ORowSet::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
    2495                 :            : {
    2496         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2497                 :          0 : }
    2498                 :            : 
    2499                 :          0 : void SAL_CALL ORowSet::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
    2500                 :            : {
    2501         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2502                 :          0 : }
    2503                 :            : 
    2504                 :          0 : void SAL_CALL ORowSet::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
    2505                 :            : {
    2506         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2507                 :          0 : }
    2508                 :            : 
    2509                 :         10 : void SAL_CALL ORowSet::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
    2510                 :            : {
    2511         [ +  - ]:         10 :     setParameter(parameterIndex,x);
    2512                 :         10 : }
    2513                 :            : 
    2514                 :          0 : void SAL_CALL ORowSet::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
    2515                 :            : {
    2516         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2517                 :          0 : }
    2518                 :            : 
    2519                 :          0 : void SAL_CALL ORowSet::setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
    2520                 :            : {
    2521         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2522                 :          0 : }
    2523                 :            : 
    2524                 :          0 : void SAL_CALL ORowSet::setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
    2525                 :            : {
    2526         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2527                 :          0 : }
    2528                 :            : 
    2529                 :          0 : void SAL_CALL ORowSet::setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
    2530                 :            : {
    2531         [ #  # ]:          0 :     setParameter(parameterIndex,x);
    2532                 :          0 : }
    2533                 :            : 
    2534                 :          0 : void SAL_CALL ORowSet::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
    2535                 :            : {
    2536         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2537         [ #  # ]:          0 :     ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
    2538                 :            : 
    2539                 :            :     try
    2540                 :            :     {
    2541         [ #  # ]:          0 :         Sequence <sal_Int8> aData;
    2542 [ #  # ][ #  # ]:          0 :         x->readBytes(aData, length);
    2543         [ #  # ]:          0 :         rParamValue = aData;
    2544 [ #  # ][ #  # ]:          0 :         x->closeInput();
                 [ #  # ]
    2545                 :            :     }
    2546         [ #  # ]:          0 :     catch( Exception& )
    2547                 :            :     {
    2548         [ #  # ]:          0 :         throw SQLException();
    2549         [ #  # ]:          0 :     }
    2550                 :          0 : }
    2551                 :            : 
    2552                 :          0 : void SAL_CALL ORowSet::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
    2553                 :            : {
    2554         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2555         [ #  # ]:          0 :     ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
    2556                 :            :     try
    2557                 :            :     {
    2558         [ #  # ]:          0 :         Sequence <sal_Int8> aData;
    2559                 :          0 :         rtl::OUString aDataStr;
    2560                 :            :         // the data is given as character data and the length defines the character length
    2561 [ #  # ][ #  # ]:          0 :         sal_Int32 nSize = x->readBytes(aData, length * sizeof(sal_Unicode));
    2562         [ #  # ]:          0 :         if (nSize / sizeof(sal_Unicode))
    2563                 :          0 :             aDataStr = rtl::OUString((sal_Unicode*)aData.getConstArray(), nSize / sizeof(sal_Unicode));
    2564         [ #  # ]:          0 :         rParamValue = aDataStr;
    2565         [ #  # ]:          0 :         rParamValue.setTypeKind( DataType::LONGVARCHAR );
    2566 [ #  # ][ #  # ]:          0 :         x->closeInput();
                 [ #  # ]
    2567                 :            :     }
    2568         [ #  # ]:          0 :     catch( Exception& )
    2569                 :            :     {
    2570         [ #  # ]:          0 :         throw SQLException();
    2571         [ #  # ]:          0 :     }
    2572                 :          0 : }
    2573                 :            : 
    2574                 :          2 : void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
    2575                 :            : {
    2576 [ +  - ][ -  + ]:          2 :     if ( !::dbtools::implSetObject( this, parameterIndex, x ) )
    2577                 :            :     {   // there is no other setXXX call which can handle the value in x
    2578         [ #  # ]:          0 :         throw SQLException();
    2579                 :            :     }
    2580                 :          2 : }
    2581                 :            : 
    2582                 :          2 : void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
    2583                 :            : {
    2584         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2585         [ +  - ]:          2 :     ORowSetValue& rParamValue( getParameterStorage( parameterIndex ) );
    2586         [ +  - ]:          2 :     setObject( parameterIndex, x );
    2587 [ +  - ][ +  - ]:          2 :     rParamValue.setTypeKind( targetSqlType );
    2588                 :          2 : }
    2589                 :            : 
    2590                 :          0 : void SAL_CALL ORowSet::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
    2591                 :            : {
    2592         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XParameters::setRef", *this );
    2593                 :          0 : }
    2594                 :            : 
    2595                 :          0 : void SAL_CALL ORowSet::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
    2596                 :            : {
    2597         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XParameters::setBlob", *this );
    2598                 :          0 : }
    2599                 :            : 
    2600                 :          0 : void SAL_CALL ORowSet::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
    2601                 :            : {
    2602         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XParameters::setClob", *this );
    2603                 :          0 : }
    2604                 :            : 
    2605                 :          0 : void SAL_CALL ORowSet::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
    2606                 :            : {
    2607         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XParameters::setArray", *this );
    2608                 :          0 : }
    2609                 :            : 
    2610                 :          2 : void SAL_CALL ORowSet::clearParameters(  ) throw(SQLException, RuntimeException)
    2611                 :            : {
    2612         [ +  - ]:          2 :     ::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
    2613                 :            : 
    2614         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aColumnsMutex );
    2615                 :            : 
    2616         [ +  - ]:          2 :     size_t nParamCount( m_pParameters.is() ? m_pParameters->size() : m_aPrematureParamValues.get().size() );
    2617         [ -  + ]:          2 :     for ( size_t i=1; i<=nParamCount; ++i )
    2618 [ #  # ][ #  # ]:          0 :         getParameterStorage( (sal_Int32)i ).setNull();
    2619         [ +  - ]:          2 :     m_aParametersSet.clear();
    2620                 :          2 : }
    2621                 :            : 
    2622                 :          4 : Any SAL_CALL ORowSet::getWarnings(  ) throw (SQLException, RuntimeException)
    2623                 :            : {
    2624                 :          4 :     return m_aWarnings.getWarnings();
    2625                 :            : }
    2626                 :            : 
    2627                 :          4 : void SAL_CALL ORowSet::clearWarnings(  ) throw (SQLException, RuntimeException)
    2628                 :            : {
    2629                 :          4 :     m_aWarnings.clearWarnings();
    2630                 :          4 : }
    2631                 :            : 
    2632                 :        216 : void ORowSet::doCancelModification( )
    2633                 :            : {
    2634         [ -  + ]:        216 :     if ( isModification() )
    2635                 :            :     {
    2636                 :            :         // read-only flag restored
    2637                 :          0 :         impl_restoreDataColumnsWriteable_throw();
    2638                 :          0 :         m_pCache->cancelRowModification();
    2639                 :            :     }
    2640                 :        216 :     m_bModified = sal_False;
    2641                 :        216 :     m_bIsInsertRow = sal_False;
    2642                 :        216 : }
    2643                 :            : 
    2644                 :        436 : sal_Bool ORowSet::isModification( )
    2645                 :            : {
    2646                 :        436 :     return isNew();
    2647                 :            : }
    2648                 :            : 
    2649                 :        222 : sal_Bool ORowSet::isModified( )
    2650                 :            : {
    2651                 :        222 :     return m_bModified;
    2652                 :            : }
    2653                 :            : 
    2654                 :        656 : sal_Bool ORowSet::isNew( )
    2655                 :            : {
    2656                 :        656 :     return m_bNew;
    2657                 :            : }
    2658                 :            : 
    2659                 :        226 : sal_Bool ORowSet::isPropertyChangeNotificationEnabled() const
    2660                 :            : {
    2661                 :        226 :     return m_bPropChangeNotifyEnabled;
    2662                 :            : }
    2663                 :            : 
    2664                 :         12 : void ORowSet::checkUpdateIterator()
    2665                 :            : {
    2666         [ +  + ]:         12 :     if(!m_bIsInsertRow)
    2667                 :            :     {
    2668         [ +  - ]:         10 :         m_pCache->setUpdateIterator(m_aCurrentRow);
    2669                 :         10 :         m_aCurrentRow = m_pCache->m_aInsertRow;
    2670                 :         10 :         m_bIsInsertRow = sal_True;
    2671                 :            :     }
    2672                 :         12 : }
    2673                 :            : 
    2674                 :         12 : void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
    2675                 :            : {
    2676                 :         12 :     checkCache();
    2677         [ -  + ]:         12 :     if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY)
    2678 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_RESULT_IS_READONLY ), SQL_GENERAL_ERROR, *this );
    2679                 :            : 
    2680         [ -  + ]:         12 :     if ( rowDeleted() )
    2681 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_ROW_ALREADY_DELETED ), SQL_INVALID_CURSOR_POSITION, *this );
    2682                 :            : 
    2683         [ -  + ]:         12 :     if ( m_aCurrentRow.isNull() )
    2684 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_CURSOR_STATE ), SQL_INVALID_CURSOR_STATE, *this );
    2685                 :            : 
    2686 [ +  - ][ -  + ]:         12 :     if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->get().size()) <= columnIndex )
                 [ -  + ]
    2687 [ #  # ][ #  # ]:          0 :         ::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_INVALID_INDEX ), SQL_INVALID_DESCRIPTOR_INDEX, *this );
    2688                 :         12 : }
    2689                 :            : 
    2690                 :          2 : void SAL_CALL ORowSet::refreshRow(  ) throw(SQLException, RuntimeException)
    2691                 :            : {
    2692                 :            : 
    2693         [ +  - ]:          2 :     ORowSetNotifier aNotifier( this );
    2694                 :            :         // this will call cancelRowModification on the cache if necessary
    2695                 :            : 
    2696                 :            :     // notification order:
    2697 [ +  - ][ +  - ]:          2 :     if ( m_bModified && m_pCache )
    2698         [ +  - ]:          2 :         implCancelRowUpdates( sal_False ); // do _not_ notify the IsModify - will do this ourself below
    2699                 :            : 
    2700                 :            :     // - column values
    2701         [ +  - ]:          2 :     ORowSetBase::refreshRow();
    2702                 :            : 
    2703                 :            :     // - IsModified
    2704                 :            :     // - IsNew
    2705 [ +  - ][ +  - ]:          2 :     aNotifier.fire( );
    2706                 :          2 : }
    2707                 :            : 
    2708                 :          0 : void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
    2709                 :            : {
    2710 [ #  # ][ #  # ]:          0 :     Reference< XResultSet > xResultSet( m_xStatement->executeQuery() );
    2711 [ #  # ][ #  # ]:          0 :     m_aWarnings.setExternalWarnings( Reference< XWarningsSupplier >( xResultSet, UNO_QUERY ) );
    2712         [ #  # ]:          0 :     m_pCache->reset(xResultSet);
    2713         [ #  # ]:          0 :     notifyAllListeners(_rGuard);
    2714                 :          0 : }
    2715                 :            : // ***********************************************************
    2716                 :            : //  ORowSetClone
    2717                 :            : // ***********************************************************
    2718                 :            : DBG_NAME(ORowSetClone);
    2719                 :            : 
    2720                 :          4 : ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex )
    2721                 :            :              :OSubComponent(m_aMutex, rParent)
    2722                 :            :              ,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex )
    2723                 :            :              ,m_pParent(&rParent)
    2724                 :            :              ,m_nFetchDirection(rParent.m_nFetchDirection)
    2725                 :            :              ,m_nFetchSize(rParent.m_nFetchSize)
    2726 [ +  - ][ +  - ]:          4 :              ,m_bIsBookmarkable(sal_True)
         [ +  - ][ +  - ]
    2727                 :            : {
    2728                 :            :     DBG_CTOR(ORowSetClone, NULL);
    2729                 :            : 
    2730                 :          4 :     m_nResultSetType        = rParent.m_nResultSetType;
    2731                 :          4 :     m_nResultSetConcurrency = ResultSetConcurrency::READ_ONLY;
    2732                 :          4 :     m_pMySelf               = this;
    2733                 :          4 :     m_bClone                = sal_True;
    2734                 :          4 :     m_bBeforeFirst          = rParent.m_bBeforeFirst;
    2735                 :          4 :     m_bAfterLast            = rParent.m_bAfterLast;
    2736                 :          4 :     m_pCache                = rParent.m_pCache;
    2737                 :          4 :     m_aBookmark             = rParent.m_aBookmark;
    2738 [ +  - ][ +  - ]:          4 :     m_aCurrentRow           = m_pCache->createIterator(this);
    2739         [ +  - ]:          4 :     m_xNumberFormatTypes    = rParent.m_xNumberFormatTypes;
    2740                 :            : 
    2741 [ +  - ][ +  - ]:          4 :     m_aOldRow = m_pCache->registerOldRow();
                 [ +  - ]
    2742                 :            : 
    2743 [ +  - ][ +  - ]:          4 :     ::rtl::Reference< ::connectivity::OSQLColumns> aColumns = new ::connectivity::OSQLColumns();
    2744         [ +  - ]:          4 :     ::std::vector< ::rtl::OUString> aNames;
    2745                 :            : 
    2746                 :          4 :     ::rtl::OUString aDescription;
    2747 [ +  - ][ +  - ]:          4 :     Locale aLocale = SvtSysLocale().GetLocaleData().getLocale();
         [ +  - ][ +  - ]
    2748                 :            : 
    2749         [ +  - ]:          4 :     if ( rParent.m_pColumns )
    2750                 :            :     {
    2751         [ +  - ]:          4 :         Sequence< ::rtl::OUString> aSeq = rParent.m_pColumns->getElementNames();
    2752                 :          4 :         const ::rtl::OUString* pIter    = aSeq.getConstArray();
    2753                 :          4 :         const ::rtl::OUString* pEnd     = pIter + aSeq.getLength();
    2754         [ +  - ]:          4 :         aColumns->get().reserve(aSeq.getLength()+1);
    2755         [ +  + ]:         88 :         for(sal_Int32 i=1;pIter != pEnd ;++pIter,++i)
    2756                 :            :         {
    2757                 :         84 :             Reference<XPropertySet> xColumn;
    2758 [ +  - ][ +  - ]:         84 :             rParent.m_pColumns->getByName(*pIter) >>= xColumn;
    2759 [ +  - ][ +  - ]:         84 :             if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    2760 [ +  - ][ +  - ]:         84 :                 aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
         [ +  - ][ +  - ]
    2761                 :            : 
    2762                 :         84 :             ::rtl::OUString sParseLabel;
    2763 [ +  - ][ +  - ]:         84 :             xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
                 [ +  - ]
    2764                 :         84 :             ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
    2765                 :            :                                                                 this,
    2766                 :            :                                                                 i,
    2767         [ +  - ]:         84 :                                                                 rParent.m_xActiveConnection->getMetaData(),
    2768                 :            :                                                                 aDescription,
    2769                 :            :                                                                 sParseLabel,
    2770 [ +  - ][ +  - ]:        168 :                                                                 m_aCurrentRow);
         [ +  - ][ +  - ]
    2771 [ +  - ][ +  - ]:         84 :             aColumns->get().push_back(pColumn);
                 [ +  - ]
    2772         [ +  - ]:         84 :             pColumn->setName(*pIter);
    2773         [ +  - ]:         84 :             aNames.push_back(*pIter);
    2774         [ +  - ]:         84 :             m_aDataColumns.push_back(pColumn);
    2775                 :            : 
    2776 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN));
         [ +  - ][ +  - ]
    2777                 :         84 :             sal_Int32 nFormatKey = 0;
    2778 [ +  - ][ +  - ]:         84 :             xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT) >>= nFormatKey;
                 [ +  - ]
    2779 [ #  # ][ #  # ]:         84 :             if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is())
         [ -  + ][ -  + ]
    2780         [ #  # ]:          0 :                 nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale);
    2781 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
    2782 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION));
         [ +  - ][ +  - ]
    2783 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH));
         [ +  - ][ +  - ]
    2784 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN));
         [ +  - ][ +  - ]
    2785 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLMODEL,xColumn->getPropertyValue(PROPERTY_CONTROLMODEL));
         [ +  - ][ +  - ]
    2786 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HELPTEXT,xColumn->getPropertyValue(PROPERTY_HELPTEXT));
         [ +  - ][ +  - ]
    2787 [ +  - ][ +  - ]:         84 :             pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_CONTROLDEFAULT,xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT));
         [ +  - ][ +  - ]
    2788                 :            : 
    2789         [ +  - ]:         88 :         }
    2790                 :            :     }
    2791 [ +  - ][ +  - ]:          4 :     Reference<XDatabaseMetaData> xMeta = rParent.m_xActiveConnection->getMetaData();
    2792 [ +  - ][ +  - ]:          8 :     m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(),
    2793 [ +  - ][ +  - ]:          8 :                                         aColumns,*this,m_aMutex,aNames);
         [ +  - ][ +  - ]
    2794                 :            : 
    2795                 :          4 :     sal_Int32 nRT   = PropertyAttribute::READONLY   | PropertyAttribute::TRANSIENT;
    2796                 :            : 
    2797                 :            :     // sdb.RowSet Properties
    2798 [ +  - ][ +  - ]:          4 :     registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY,   &rParent.m_aActiveConnection,   ::getCppuType(static_cast< Reference< XConnection >* >(0)));
                 [ +  - ]
    2799 [ +  - ][ +  - ]:          4 :     registerProperty(PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY,   PropertyAttribute::READONLY,    &m_nResultSetConcurrency,::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
    2800 [ +  - ][ +  - ]:          4 :     registerProperty(PROPERTY_RESULTSETTYPE,        PROPERTY_ID_RESULTSETTYPE,          PropertyAttribute::READONLY,    &m_nResultSetType,      ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
    2801 [ +  - ][ +  - ]:          4 :     registerProperty(PROPERTY_FETCHDIRECTION,       PROPERTY_ID_FETCHDIRECTION,         PropertyAttribute::TRANSIENT,   &m_nFetchDirection,     ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
    2802 [ +  - ][ +  - ]:          4 :     registerProperty(PROPERTY_FETCHSIZE,            PROPERTY_ID_FETCHSIZE,              PropertyAttribute::TRANSIENT,   &m_nFetchSize,          ::getCppuType(static_cast< sal_Int32*>(0)));
                 [ +  - ]
    2803 [ +  - ][ +  - ]:          4 :     registerProperty(PROPERTY_ISBOOKMARKABLE,       PROPERTY_ID_ISBOOKMARKABLE,         nRT,                            &m_bIsBookmarkable,      ::getBooleanCppuType());
         [ +  - ][ +  - ]
    2804                 :          4 : }
    2805                 :            : 
    2806 [ +  - ][ +  - ]:          4 : ORowSetClone::~ORowSetClone()
                 [ +  - ]
    2807                 :            : {
    2808                 :            :     DBG_DTOR(ORowSetClone, NULL);
    2809         [ -  + ]:          8 : }
    2810                 :            : 
    2811                 :            : // com::sun::star::XTypeProvider
    2812                 :          0 : Sequence< Type > ORowSetClone::getTypes() throw (RuntimeException)
    2813                 :            : {
    2814 [ #  # ][ #  # ]:          0 :     return ::comphelper::concatSequences(OSubComponent::getTypes(),ORowSetBase::getTypes());
                 [ #  # ]
    2815                 :            : }
    2816                 :            : 
    2817                 :            : // com::sun::star::XInterface
    2818                 :         26 : Any ORowSetClone::queryInterface( const Type & rType ) throw (RuntimeException)
    2819                 :            : {
    2820                 :         26 :     Any aRet = ORowSetBase::queryInterface(rType);
    2821         [ +  + ]:         26 :     if(!aRet.hasValue())
    2822         [ +  - ]:         14 :         aRet = OSubComponent::queryInterface(rType);
    2823                 :         26 :     return aRet;
    2824                 :            : }
    2825                 :            : 
    2826                 :        318 : void ORowSetClone::acquire() throw()
    2827                 :            : {
    2828                 :        318 :     OSubComponent::acquire();
    2829                 :        318 : }
    2830                 :            : 
    2831                 :        314 : void ORowSetClone::release() throw()
    2832                 :            : {
    2833                 :        314 :     OSubComponent::release();
    2834                 :        314 : }
    2835                 :            : 
    2836                 :            : // XServiceInfo
    2837                 :          0 : rtl::OUString ORowSetClone::getImplementationName(  ) throw(RuntimeException)
    2838                 :            : {
    2839                 :          0 :     return rtl::OUString("com.sun.star.sdb.ORowSetClone");
    2840                 :            : }
    2841                 :            : 
    2842                 :          0 : sal_Bool ORowSetClone::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
    2843                 :            : {
    2844 [ #  # ][ #  # ]:          0 :     return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0;
    2845                 :            : }
    2846                 :            : 
    2847                 :          0 : Sequence< ::rtl::OUString > ORowSetClone::getSupportedServiceNames(  ) throw (RuntimeException)
    2848                 :            : {
    2849                 :          0 :     Sequence< ::rtl::OUString > aSNS( 2 );
    2850 [ #  # ][ #  # ]:          0 :     aSNS[0] = SERVICE_SDBC_RESULTSET;
    2851 [ #  # ][ #  # ]:          0 :     aSNS[1] = SERVICE_SDB_RESULTSET;
    2852                 :          0 :     return aSNS;
    2853                 :            : }
    2854                 :            : 
    2855                 :            : // OComponentHelper
    2856                 :          4 : void ORowSetClone::disposing()
    2857                 :            : {
    2858         [ +  - ]:          4 :     MutexGuard aGuard( m_aMutex );
    2859         [ +  - ]:          4 :     ORowSetBase::disposing();
    2860                 :            : 
    2861                 :          4 :     m_pParent   = NULL;
    2862                 :          4 :     m_pMutex    = &m_aMutex; // this must be done here because someone could hold a ref to us and try to do something
    2863 [ +  - ][ +  - ]:          4 :     OSubComponent::disposing();
    2864                 :          4 : }
    2865                 :            : 
    2866                 :            : // XCloseable
    2867                 :          0 : void ORowSetClone::close(void) throw( SQLException, RuntimeException )
    2868                 :            : {
    2869                 :            :     {
    2870         [ #  # ]:          0 :         MutexGuard aGuard( m_aMutex );
    2871         [ #  # ]:          0 :         if (OComponentHelper::rBHelper.bDisposed)
    2872 [ #  # ][ #  # ]:          0 :             throw DisposedException();
    2873                 :            :     }
    2874                 :          0 :     dispose();
    2875                 :          0 : }
    2876                 :            : 
    2877                 :            : // comphelper::OPropertyArrayUsageHelper
    2878                 :          2 : ::cppu::IPropertyArrayHelper* ORowSetClone::createArrayHelper( ) const
    2879                 :            : {
    2880         [ +  - ]:          2 :     Sequence< Property > aProps;
    2881         [ +  - ]:          2 :     describeProperties(aProps);
    2882 [ +  - ][ +  - ]:          2 :     return new ::cppu::OPropertyArrayHelper(aProps);
    2883                 :            : }
    2884                 :            : 
    2885                 :            : // cppu::OPropertySetHelper
    2886                 :          4 : ::cppu::IPropertyArrayHelper& SAL_CALL ORowSetClone::getInfoHelper()
    2887                 :            : {
    2888                 :            :     typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetClone> ORowSetClone_PROP;
    2889                 :          4 :     return *ORowSetClone_PROP::getArrayHelper();
    2890                 :            : }
    2891                 :            : 
    2892                 :          0 : Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId()
    2893                 :            : {
    2894                 :            :     static ::cppu::OImplementationId * pId = 0;
    2895         [ #  # ]:          0 :     if (! pId)
    2896                 :            :     {
    2897 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
    2898         [ #  # ]:          0 :         if (! pId)
    2899                 :            :         {
    2900 [ #  # ][ #  # ]:          0 :             static ::cppu::OImplementationId aId;
    2901                 :          0 :             pId = &aId;
    2902         [ #  # ]:          0 :         }
    2903                 :            :     }
    2904                 :          0 :     return pId->getImplementationId();
    2905                 :            : }
    2906                 :            : 
    2907                 :            : // com::sun::star::XUnoTunnel
    2908                 :          0 : sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
    2909                 :            : {
    2910 [ #  # ][ #  # ]:          0 :     if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    2911                 :          0 :         return reinterpret_cast<sal_Int64>(this);
    2912                 :            : 
    2913                 :          0 :     return 0;
    2914                 :            : }
    2915                 :            : 
    2916                 :          0 : void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception)
    2917                 :            : {
    2918         [ #  # ]:          0 :     if ( nHandle == PROPERTY_ID_FETCHSIZE )
    2919                 :            :     {
    2920         [ #  # ]:          0 :         if ( m_pParent )
    2921                 :          0 :             m_pParent->setFastPropertyValue_NoBroadcast( nHandle, rValue );
    2922                 :            :     }
    2923                 :            : 
    2924                 :          0 :     OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue);
    2925                 :          0 : }
    2926                 :            : 
    2927                 :         16 : void ORowSetClone::doCancelModification( )
    2928                 :            : {
    2929                 :         16 : }
    2930                 :            : 
    2931                 :         16 : sal_Bool ORowSetClone::isModification( )
    2932                 :            : {
    2933                 :         16 :     return sal_False;
    2934                 :            : }
    2935                 :            : 
    2936                 :         16 : sal_Bool ORowSetClone::isModified( )
    2937                 :            : {
    2938                 :         16 :     return sal_False;
    2939                 :            : }
    2940                 :            : 
    2941                 :         16 : sal_Bool ORowSetClone::isNew( )
    2942                 :            : {
    2943                 :         16 :     return sal_False;
    2944                 :            : }
    2945                 :            : 
    2946                 :          0 : void SAL_CALL ORowSetClone::execute(  ) throw(SQLException, RuntimeException)
    2947                 :            : {
    2948         [ #  # ]:          0 :     throwFunctionNotSupportedException( "RowSetClone::XRowSet::execute", *this );
    2949                 :          0 : }
    2950                 :            : 
    2951                 :          0 : void SAL_CALL ORowSetClone::addRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException)
    2952                 :            : {
    2953         [ #  # ]:          0 :     throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this );
    2954                 :          0 : }
    2955                 :            : 
    2956                 :          0 : void SAL_CALL ORowSetClone::removeRowSetListener( const Reference< XRowSetListener >& ) throw(RuntimeException)
    2957                 :            : {
    2958         [ #  # ]:          0 :     throwFunctionNotSupportedException( "RowSetClone::XRowSet", *this );
    2959                 :          0 : }
    2960                 :            : 
    2961                 :            : } // dbaccess
    2962                 :            : 
    2963                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10