LCOV - code coverage report
Current view: top level - ucbhelper/source/provider - resultset.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 112 597 18.8 %
Date: 2012-08-25 Functions: 22 91 24.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 83 896 9.3 %

           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                 :            : /**************************************************************************
      22                 :            :                                 TODO
      23                 :            :  **************************************************************************
      24                 :            : 
      25                 :            :  *************************************************************************/
      26                 :            : #include <cppuhelper/interfacecontainer.hxx>
      27                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      28                 :            : #include <ucbhelper/resultset.hxx>
      29                 :            : #include <ucbhelper/resultsetmetadata.hxx>
      30                 :            : 
      31                 :            : using namespace com::sun::star;
      32                 :            : 
      33                 :            : //=========================================================================
      34                 :            : 
      35                 :            : namespace ucbhelper_impl
      36                 :            : {
      37                 :            : 
      38                 :            : struct PropertyInfo
      39                 :            : {
      40                 :            :     const char* pName;
      41                 :            :     sal_Int32   nHandle;
      42                 :            :     sal_Int16   nAttributes;
      43                 :            :     const uno::Type& (*pGetCppuType)();
      44                 :            : };
      45                 :            : 
      46                 :          0 : static const uno::Type& sal_Int32_getCppuType()
      47                 :            : {
      48                 :          0 :     return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
      49                 :            : }
      50                 :            : 
      51                 :          0 : static const uno::Type& sal_Bool_getCppuType()
      52                 :            : {
      53                 :          0 :     return getCppuBooleanType();
      54                 :            : }
      55                 :            : 
      56                 :            : static const PropertyInfo aPropertyTable[] =
      57                 :            : {
      58                 :            :     { "IsRowCountFinal",
      59                 :            :       1000,
      60                 :            :       beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
      61                 :            :       &sal_Bool_getCppuType
      62                 :            :     },
      63                 :            :     { "RowCount",
      64                 :            :       1001,
      65                 :            :       beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
      66                 :            :       &sal_Int32_getCppuType
      67                 :            :     },
      68                 :            :     { 0,
      69                 :            :       0,
      70                 :            :       0,
      71                 :            :       0
      72                 :            :     }
      73                 :            : };
      74                 :            : 
      75                 :            : #define RESULTSET_PROPERTY_COUNT 2
      76                 :            : 
      77                 :            : //=========================================================================
      78                 :            : //
      79                 :            : // class PropertySetInfo
      80                 :            : //
      81                 :            : //=========================================================================
      82                 :            : 
      83                 :            : class PropertySetInfo :
      84                 :            :         public cppu::OWeakObject,
      85                 :            :         public lang::XTypeProvider,
      86                 :            :         public beans::XPropertySetInfo
      87                 :            : {
      88                 :            :     uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
      89                 :            :     uno::Sequence< beans::Property >*            m_pProps;
      90                 :            : 
      91                 :            : private:
      92                 :            :     sal_Bool queryProperty(
      93                 :            :         const rtl::OUString& aName, beans::Property& rProp );
      94                 :            : 
      95                 :            : public:
      96                 :            :     PropertySetInfo(
      97                 :            :         const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
      98                 :            :         const PropertyInfo* pProps,
      99                 :            :         sal_Int32 nProps );
     100                 :            :     virtual ~PropertySetInfo();
     101                 :            : 
     102                 :            :     // XInterface
     103                 :            :     XINTERFACE_DECL()
     104                 :            : 
     105                 :            :     // XTypeProvider
     106                 :            :     XTYPEPROVIDER_DECL()
     107                 :            : 
     108                 :            :     // XPropertySetInfo
     109                 :            :     virtual uno::Sequence< beans::Property > SAL_CALL getProperties()
     110                 :            :         throw( uno::RuntimeException );
     111                 :            :     virtual beans::Property SAL_CALL getPropertyByName(
     112                 :            :             const rtl::OUString& aName )
     113                 :            :         throw( beans::UnknownPropertyException, uno::RuntimeException );
     114                 :            :     virtual sal_Bool SAL_CALL hasPropertyByName( const rtl::OUString& Name )
     115                 :            :         throw( uno::RuntimeException );
     116                 :            : };
     117                 :            : 
     118                 :            : //=========================================================================
     119                 :            : //
     120                 :            : // PropertyChangeListenerContainer.
     121                 :            : //
     122                 :            : //=========================================================================
     123                 :            : 
     124                 :            : struct equalStr_Impl
     125                 :            : {
     126                 :          0 :     bool operator()( const rtl::OUString& s1, const rtl::OUString& s2 ) const
     127                 :            :       {
     128                 :          0 :         return !!( s1 == s2 );
     129                 :            :     }
     130                 :            : };
     131                 :            : 
     132                 :            : struct hashStr_Impl
     133                 :            : {
     134                 :            :     size_t operator()( const rtl::OUString& rName ) const
     135                 :            :     {
     136                 :            :         return rName.hashCode();
     137                 :            :     }
     138                 :            : };
     139                 :            : 
     140                 :            : typedef cppu::OMultiTypeInterfaceContainerHelperVar
     141                 :            : <
     142                 :            :     rtl::OUString,
     143                 :            :     hashStr_Impl,
     144                 :            :     equalStr_Impl
     145                 :            : > PropertyChangeListenerContainer;
     146                 :            : 
     147                 :            : //=========================================================================
     148                 :            : //
     149                 :            : // class PropertyChangeListeners.
     150                 :            : //
     151                 :            : //=========================================================================
     152                 :            : 
     153                 :          0 : class PropertyChangeListeners : public PropertyChangeListenerContainer
     154                 :            : {
     155                 :            : public:
     156                 :          0 :     PropertyChangeListeners( osl::Mutex& rMtx )
     157                 :          0 :     : PropertyChangeListenerContainer( rMtx ) {}
     158                 :            : };
     159                 :            : 
     160                 :            : } // namespace ucbhelper_impl
     161                 :            : 
     162                 :            : using namespace ucbhelper_impl;
     163                 :            : 
     164                 :            : namespace ucbhelper
     165                 :            : {
     166                 :            : 
     167                 :            : //=========================================================================
     168                 :            : //
     169                 :            : // struct ResultSet_Impl.
     170                 :            : //
     171                 :            : //=========================================================================
     172                 :            : 
     173                 :            : struct ResultSet_Impl
     174                 :            : {
     175                 :            :     uno::Reference< lang::XMultiServiceFactory >    m_xSMgr;
     176                 :            :     uno::Reference< com::sun::star::ucb::XCommandEnvironment >  m_xEnv;
     177                 :            :     uno::Reference< beans::XPropertySetInfo >       m_xPropSetInfo;
     178                 :            :     uno::Reference< sdbc::XResultSetMetaData >      m_xMetaData;
     179                 :            :     uno::Sequence< beans::Property >                m_aProperties;
     180                 :            :     rtl::Reference< ResultSetDataSupplier >         m_xDataSupplier;
     181                 :            :     osl::Mutex                          m_aMutex;
     182                 :            :     cppu::OInterfaceContainerHelper*    m_pDisposeEventListeners;
     183                 :            :     PropertyChangeListeners*            m_pPropertyChangeListeners;
     184                 :            :     sal_Int32                           m_nPos;
     185                 :            :     sal_Bool                            m_bWasNull;
     186                 :            :     sal_Bool                            m_bAfterLast;
     187                 :            : 
     188                 :            :     inline ResultSet_Impl(
     189                 :            :         const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
     190                 :            :         const uno::Sequence< beans::Property >& rProperties,
     191                 :            :         const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
     192                 :            :         const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
     193                 :            :             rxEnv );
     194                 :            :     inline ~ResultSet_Impl();
     195                 :            : };
     196                 :            : 
     197                 :         53 : inline ResultSet_Impl::ResultSet_Impl(
     198                 :            :     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
     199                 :            :     const uno::Sequence< beans::Property >& rProperties,
     200                 :            :     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
     201                 :            :     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
     202                 :            : : m_xSMgr( rxSMgr ),
     203                 :            :   m_xEnv( rxEnv ),
     204                 :            :   m_aProperties( rProperties ),
     205                 :            :   m_xDataSupplier( rDataSupplier ),
     206                 :            :   m_pDisposeEventListeners( 0 ),
     207                 :            :   m_pPropertyChangeListeners( 0 ),
     208                 :            :   m_nPos( 0 ), // Position is one-based. Zero means: before first element.
     209                 :            :   m_bWasNull( sal_False ),
     210 [ +  - ][ +  - ]:         53 :   m_bAfterLast( sal_False )
                 [ +  - ]
     211                 :            : {
     212                 :         53 : }
     213                 :            : 
     214                 :            : //=========================================================================
     215 [ +  - ][ +  - ]:         53 : inline ResultSet_Impl::~ResultSet_Impl()
                 [ +  - ]
     216                 :            : {
     217 [ -  + ][ #  # ]:         53 :     delete m_pDisposeEventListeners;
     218 [ -  + ][ #  # ]:         53 :     delete m_pPropertyChangeListeners;
     219                 :         53 : }
     220                 :            : 
     221                 :            : //=========================================================================
     222                 :            : //=========================================================================
     223                 :            : //
     224                 :            : // ResultSet Implementation.
     225                 :            : //
     226                 :            : //=========================================================================
     227                 :            : //=========================================================================
     228                 :            : 
     229                 :         10 : ResultSet::ResultSet(
     230                 :            :     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
     231                 :            :     const uno::Sequence< beans::Property >& rProperties,
     232                 :            :     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier )
     233                 :            : : m_pImpl( new ResultSet_Impl(
     234                 :            :                rxSMgr,
     235                 :            :                rProperties,
     236                 :            :                rDataSupplier,
     237 [ +  - ][ +  - ]:         10 :                uno::Reference< com::sun::star::ucb::XCommandEnvironment >() ) )
     238                 :            : {
     239                 :         10 :     rDataSupplier->m_pResultSet = this;
     240                 :         10 : }
     241                 :            : 
     242                 :            : //=========================================================================
     243                 :         43 : ResultSet::ResultSet(
     244                 :            :     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
     245                 :            :     const uno::Sequence< beans::Property >& rProperties,
     246                 :            :     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
     247                 :            :     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
     248 [ +  - ][ +  - ]:         43 : : m_pImpl( new ResultSet_Impl( rxSMgr, rProperties, rDataSupplier, rxEnv ) )
     249                 :            : {
     250                 :         43 :     rDataSupplier->m_pResultSet = this;
     251                 :         43 : }
     252                 :            : 
     253                 :            : //=========================================================================
     254                 :            : // virtual
     255                 :         53 : ResultSet::~ResultSet()
     256                 :            : {
     257 [ +  - ][ +  - ]:         53 :     delete m_pImpl;
     258         [ -  + ]:        106 : }
     259                 :            : 
     260                 :            : //=========================================================================
     261                 :            : //
     262                 :            : // XInterface methods.
     263                 :            : //
     264                 :            : //=========================================================================
     265                 :            : 
     266 [ +  - ][ +  - ]:       2412 : XINTERFACE_IMPL_9( ResultSet,
                 [ #  # ]
     267                 :            :                    lang::XTypeProvider,
     268                 :            :                    lang::XServiceInfo,
     269                 :            :                    lang::XComponent,
     270                 :            :                    com::sun::star::ucb::XContentAccess,
     271                 :            :                    sdbc::XResultSet,
     272                 :            :                    sdbc::XResultSetMetaDataSupplier,
     273                 :            :                    sdbc::XRow,
     274                 :            :                    sdbc::XCloseable,
     275                 :            :                    beans::XPropertySet );
     276                 :            : 
     277                 :            : //=========================================================================
     278                 :            : //
     279                 :            : // XTypeProvider methods.
     280                 :            : //
     281                 :            : //=========================================================================
     282                 :            : 
     283 [ #  # ][ #  # ]:          0 : XTYPEPROVIDER_IMPL_9( ResultSet,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     284                 :            :                       lang::XTypeProvider,
     285                 :            :                          lang::XServiceInfo,
     286                 :            :                       lang::XComponent,
     287                 :            :                       com::sun::star::ucb::XContentAccess,
     288                 :            :                       sdbc::XResultSet,
     289                 :            :                       sdbc::XResultSetMetaDataSupplier,
     290                 :            :                       sdbc::XRow,
     291                 :            :                       sdbc::XCloseable,
     292                 :            :                       beans::XPropertySet );
     293                 :            : 
     294                 :            : //=========================================================================
     295                 :            : //
     296                 :            : // XServiceInfo methods.
     297                 :            : //
     298                 :            : //=========================================================================
     299                 :            : 
     300 [ #  # ][ #  # ]:          0 : XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     301                 :            :                     rtl::OUString("ResultSet"),
     302                 :            :                     rtl::OUString(RESULTSET_SERVICE_NAME ) );
     303                 :            : 
     304                 :            : //=========================================================================
     305                 :            : //
     306                 :            : // XComponent methods.
     307                 :            : //
     308                 :            : //=========================================================================
     309                 :            : 
     310                 :            : // virtual
     311                 :          0 : void SAL_CALL ResultSet::dispose()
     312                 :            :     throw( uno::RuntimeException )
     313                 :            : {
     314         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     315                 :            : 
     316 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_pDisposeEventListeners &&
                 [ #  # ]
     317         [ #  # ]:          0 :          m_pImpl->m_pDisposeEventListeners->getLength() )
     318                 :            :     {
     319         [ #  # ]:          0 :         lang::EventObject aEvt;
     320         [ #  # ]:          0 :         aEvt.Source = static_cast< lang::XComponent * >( this );
     321 [ #  # ][ #  # ]:          0 :         m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
     322                 :            :     }
     323                 :            : 
     324         [ #  # ]:          0 :     if ( m_pImpl->m_pPropertyChangeListeners )
     325                 :            :     {
     326         [ #  # ]:          0 :         lang::EventObject aEvt;
     327         [ #  # ]:          0 :         aEvt.Source = static_cast< beans::XPropertySet * >( this );
     328 [ #  # ][ #  # ]:          0 :         m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
     329                 :            :     }
     330                 :            : 
     331 [ #  # ][ #  # ]:          0 :     m_pImpl->m_xDataSupplier->close();
     332                 :          0 : }
     333                 :            : 
     334                 :            : //=========================================================================
     335                 :            : // virtual
     336                 :          0 : void SAL_CALL ResultSet::addEventListener(
     337                 :            :         const uno::Reference< lang::XEventListener >& Listener )
     338                 :            :     throw( uno::RuntimeException )
     339                 :            : {
     340         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     341                 :            : 
     342         [ #  # ]:          0 :     if ( !m_pImpl->m_pDisposeEventListeners )
     343                 :            :         m_pImpl->m_pDisposeEventListeners =
     344         [ #  # ]:          0 :             new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex );
     345                 :            : 
     346 [ #  # ][ #  # ]:          0 :     m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
     347                 :          0 : }
     348                 :            : 
     349                 :            : //=========================================================================
     350                 :            : // virtual
     351                 :          0 : void SAL_CALL ResultSet::removeEventListener(
     352                 :            :         const uno::Reference< lang::XEventListener >& Listener )
     353                 :            :     throw( uno::RuntimeException )
     354                 :            : {
     355         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     356                 :            : 
     357         [ #  # ]:          0 :     if ( m_pImpl->m_pDisposeEventListeners )
     358 [ #  # ][ #  # ]:          0 :         m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
     359                 :          0 : }
     360                 :            : 
     361                 :            : //=========================================================================
     362                 :            : //
     363                 :            : // XResultSetMetaDataSupplier methods.
     364                 :            : //
     365                 :            : //=========================================================================
     366                 :            : 
     367                 :            : // virtual
     368                 :          8 : uno::Reference< sdbc::XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
     369                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     370                 :            : {
     371         [ +  - ]:          8 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     372                 :            : 
     373         [ +  - ]:          8 :     if ( !m_pImpl->m_xMetaData.is() )
     374                 :            :         m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr,
     375 [ +  - ][ +  - ]:          8 :                                                       m_pImpl->m_aProperties );
                 [ +  - ]
     376                 :            : 
     377         [ +  - ]:          8 :     return m_pImpl->m_xMetaData;
     378                 :            : }
     379                 :            : 
     380                 :            : //=========================================================================
     381                 :            : //
     382                 :            : // XResultSet methods.
     383                 :            : //
     384                 :            : //=========================================================================
     385                 :            : 
     386                 :            : // virtual
     387                 :         49 : sal_Bool SAL_CALL ResultSet::next()
     388                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     389                 :            : {
     390                 :            :     // Note: Cursor is initially positioned before the first row.
     391                 :            :     //       First call to 'next()' moves it to first row.
     392                 :            : 
     393         [ +  - ]:         49 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     394                 :            : 
     395         [ -  + ]:         49 :     if ( m_pImpl->m_bAfterLast )
     396                 :            :     {
     397         [ #  # ]:          0 :         m_pImpl->m_xDataSupplier->validate();
     398                 :          0 :         return sal_False;
     399                 :            :     }
     400                 :            : 
     401                 :            :     // getResult works zero-based!
     402 [ +  - ][ +  + ]:         49 :     if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
     403                 :            :     {
     404                 :         45 :         m_pImpl->m_bAfterLast = sal_True;
     405         [ +  - ]:         45 :         m_pImpl->m_xDataSupplier->validate();
     406                 :         45 :         return sal_False;
     407                 :            :     }
     408                 :            : 
     409                 :          4 :     m_pImpl->m_nPos++;
     410         [ +  - ]:          4 :     m_pImpl->m_xDataSupplier->validate();
     411         [ +  - ]:         49 :     return sal_True;
     412                 :            : }
     413                 :            : 
     414                 :            : //=========================================================================
     415                 :            : // virtual
     416                 :          0 : sal_Bool SAL_CALL ResultSet::isBeforeFirst()
     417                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     418                 :            : {
     419         [ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast )
     420                 :            :     {
     421                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     422                 :          0 :         return sal_False;
     423                 :            :     }
     424                 :            : 
     425                 :            :     // getResult works zero-based!
     426         [ #  # ]:          0 :     if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
     427                 :            :     {
     428                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     429                 :          0 :         return sal_False;
     430                 :            :     }
     431                 :            : 
     432                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     433                 :          0 :     return ( m_pImpl->m_nPos == 0 );
     434                 :            : }
     435                 :            : 
     436                 :            : //=========================================================================
     437                 :            : // virtual
     438                 :          0 : sal_Bool SAL_CALL ResultSet::isAfterLast()
     439                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     440                 :            : {
     441                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     442                 :          0 :     return m_pImpl->m_bAfterLast;
     443                 :            : }
     444                 :            : 
     445                 :            : //=========================================================================
     446                 :            : // virtual
     447                 :          0 : sal_Bool SAL_CALL ResultSet::isFirst()
     448                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     449                 :            : {
     450         [ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast )
     451                 :            :     {
     452                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     453                 :          0 :         return sal_False;
     454                 :            :     }
     455                 :            : 
     456                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     457                 :          0 :     return ( m_pImpl->m_nPos == 1 );
     458                 :            : }
     459                 :            : 
     460                 :            : //=========================================================================
     461                 :            : // virtual
     462                 :          0 : sal_Bool SAL_CALL ResultSet::isLast()
     463                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     464                 :            : {
     465         [ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast )
     466                 :            :     {
     467                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     468                 :          0 :         return sal_False;
     469                 :            :     }
     470                 :            : 
     471                 :          0 :     sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     472         [ #  # ]:          0 :     if ( !nCount )
     473                 :            :     {
     474                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     475                 :          0 :         return sal_False;
     476                 :            :     }
     477                 :            : 
     478                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     479                 :          0 :     return ( m_pImpl->m_nPos == nCount );
     480                 :            : }
     481                 :            : 
     482                 :            : //=========================================================================
     483                 :            : // virtual
     484                 :          0 : void SAL_CALL ResultSet::beforeFirst()
     485                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     486                 :            : {
     487         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     488                 :          0 :     m_pImpl->m_bAfterLast = sal_False;
     489                 :          0 :     m_pImpl->m_nPos = 0;
     490 [ #  # ][ #  # ]:          0 :     m_pImpl->m_xDataSupplier->validate();
     491                 :          0 : }
     492                 :            : 
     493                 :            : //=========================================================================
     494                 :            : // virtual
     495                 :          0 : void SAL_CALL ResultSet::afterLast()
     496                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     497                 :            : {
     498         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     499                 :          0 :     m_pImpl->m_bAfterLast = sal_True;
     500 [ #  # ][ #  # ]:          0 :     m_pImpl->m_xDataSupplier->validate();
     501                 :          0 : }
     502                 :            : 
     503                 :            : //=========================================================================
     504                 :            : // virtual
     505                 :          8 : sal_Bool SAL_CALL ResultSet::first()
     506                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     507                 :            : {
     508                 :            :     // getResult works zero-based!
     509         [ +  - ]:          8 :     if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
     510                 :            :     {
     511         [ +  - ]:          8 :         osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     512                 :          8 :         m_pImpl->m_bAfterLast = sal_False;
     513                 :          8 :         m_pImpl->m_nPos = 1;
     514         [ +  - ]:          8 :         m_pImpl->m_xDataSupplier->validate();
     515         [ +  - ]:          8 :         return sal_True;
     516                 :            :     }
     517                 :            : 
     518                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     519                 :          8 :     return sal_False;
     520                 :            : }
     521                 :            : 
     522                 :            : //=========================================================================
     523                 :            : // virtual
     524                 :          0 : sal_Bool SAL_CALL ResultSet::last()
     525                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     526                 :            : {
     527                 :          0 :     sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     528         [ #  # ]:          0 :     if ( nCount )
     529                 :            :     {
     530         [ #  # ]:          0 :         osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     531                 :          0 :         m_pImpl->m_bAfterLast = sal_False;
     532                 :          0 :         m_pImpl->m_nPos = nCount;
     533         [ #  # ]:          0 :         m_pImpl->m_xDataSupplier->validate();
     534         [ #  # ]:          0 :         return sal_True;
     535                 :            :     }
     536                 :            : 
     537                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     538                 :          0 :     return sal_False;
     539                 :            : }
     540                 :            : 
     541                 :            : //=========================================================================
     542                 :            : // virtual
     543                 :          0 : sal_Int32 SAL_CALL ResultSet::getRow()
     544                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     545                 :            : {
     546         [ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast )
     547                 :            :     {
     548                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     549                 :          0 :         return 0;
     550                 :            :     }
     551                 :            : 
     552                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     553                 :          0 :     return m_pImpl->m_nPos;
     554                 :            : }
     555                 :            : 
     556                 :            : //=========================================================================
     557                 :            : // virtual
     558                 :        168 : sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
     559                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     560                 :            : {
     561                 :            : /*
     562                 :            :     If the row number is positive, the cursor moves to the given row number
     563                 :            :     with respect to the beginning of the result set. The first row is row 1,
     564                 :            :     the second is row 2, and so on.
     565                 :            : 
     566                 :            :     If the given row number is negative, the cursor moves to an absolute row
     567                 :            :     position with respect to the end of the result set. For example, calling
     568                 :            :     absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
     569                 :            :     indicates the next-to-last row, and so on.
     570                 :            : 
     571                 :            :     An attempt to position the cursor beyond the first/last row in the result
     572                 :            :     set leaves the cursor before/after the first/last row, respectively.
     573                 :            : 
     574                 :            :     Calling absolute( 1 ) is the same as calling first().
     575                 :            : 
     576                 :            :     Calling absolute( -1 ) is the same as calling last().
     577                 :            : */
     578         [ -  + ]:        168 :     if ( row < 0 )
     579                 :            :     {
     580                 :          0 :         sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     581                 :            : 
     582         [ #  # ]:          0 :         if ( ( row * -1 ) > nCount )
     583                 :            :         {
     584         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     585                 :          0 :             m_pImpl->m_bAfterLast = sal_False;
     586                 :          0 :             m_pImpl->m_nPos = 0;
     587         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     588         [ #  # ]:          0 :             return sal_False;
     589                 :            :         }
     590                 :            :         else // |row| <= nCount
     591                 :            :         {
     592         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     593                 :          0 :             m_pImpl->m_bAfterLast = sal_False;
     594                 :          0 :             m_pImpl->m_nPos = ( nCount + row + 1 );
     595         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     596         [ #  # ]:          0 :             return sal_True;
     597                 :            :         }
     598                 :            :     }
     599         [ -  + ]:        168 :     else if ( row == 0 )
     600                 :            :     {
     601                 :            :         // @throws SQLException
     602                 :            :         //      ... if row is 0 ...
     603         [ #  # ]:          0 :         throw sdbc::SQLException();
     604                 :            :     }
     605                 :            :     else // row > 0
     606                 :            :     {
     607                 :        168 :         sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     608                 :            : 
     609         [ +  + ]:        168 :         if ( row <= nCount )
     610                 :            :         {
     611         [ +  - ]:        160 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     612                 :        160 :             m_pImpl->m_bAfterLast = sal_False;
     613                 :        160 :             m_pImpl->m_nPos = row;
     614         [ +  - ]:        160 :             m_pImpl->m_xDataSupplier->validate();
     615         [ +  - ]:        160 :             return sal_True;
     616                 :            :         }
     617                 :            :         else // row > nCount
     618                 :            :         {
     619         [ +  - ]:          8 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     620                 :          8 :             m_pImpl->m_bAfterLast = sal_True;
     621         [ +  - ]:          8 :             m_pImpl->m_xDataSupplier->validate();
     622         [ +  - ]:        168 :             return sal_False;
     623                 :            :         }
     624                 :            :     }
     625                 :            : 
     626                 :            :     // unreachable...
     627                 :            : }
     628                 :            : 
     629                 :            : //=========================================================================
     630                 :            : // virtual
     631                 :          0 : sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
     632                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     633                 :            : {
     634                 :            : /*
     635                 :            :     Attempting to move beyond the first/last row in the result set
     636                 :            :     positions the cursor before/after the the first/last row.
     637                 :            : 
     638                 :            :     Calling relative( 0 ) is valid, but does not change the cursor position.
     639                 :            : 
     640                 :            :     Calling relative( 1 ) is different from calling next() because it makes
     641                 :            :     sense to call next() when there is no current row, for example, when
     642                 :            :     the cursor is positioned before the first row or after the last row of
     643                 :            :     the result set.
     644                 :            : */
     645 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
     646                 :            :     {
     647                 :            :         // "No current row".
     648         [ #  # ]:          0 :         throw sdbc::SQLException();
     649                 :            :     }
     650                 :            : 
     651         [ #  # ]:          0 :     if ( rows < 0 )
     652                 :            :     {
     653         [ #  # ]:          0 :         if ( ( m_pImpl->m_nPos + rows ) > 0 )
     654                 :            :         {
     655         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     656                 :          0 :             m_pImpl->m_bAfterLast = sal_False;
     657                 :          0 :             m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
     658         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     659         [ #  # ]:          0 :             return sal_True;
     660                 :            :         }
     661                 :            :         else
     662                 :            :         {
     663         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     664                 :          0 :             m_pImpl->m_bAfterLast = sal_False;
     665                 :          0 :             m_pImpl->m_nPos = 0;
     666         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     667         [ #  # ]:          0 :             return sal_False;
     668                 :            :         }
     669                 :            :     }
     670         [ #  # ]:          0 :     else if ( rows == 0 )
     671                 :            :     {
     672                 :            :         // nop.
     673                 :          0 :         m_pImpl->m_xDataSupplier->validate();
     674                 :          0 :         return sal_True;
     675                 :            :     }
     676                 :            :     else // rows > 0
     677                 :            :     {
     678                 :          0 :         sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     679         [ #  # ]:          0 :         if ( ( m_pImpl->m_nPos + rows ) <= nCount )
     680                 :            :         {
     681         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     682                 :          0 :             m_pImpl->m_bAfterLast = sal_False;
     683                 :          0 :             m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
     684         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     685         [ #  # ]:          0 :             return sal_True;
     686                 :            :         }
     687                 :            :         else
     688                 :            :         {
     689         [ #  # ]:          0 :             osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     690                 :          0 :             m_pImpl->m_bAfterLast = sal_True;
     691         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     692         [ #  # ]:          0 :             return sal_False;
     693                 :            :         }
     694                 :            :     }
     695                 :            : 
     696                 :            :     // unreachable...
     697                 :            : }
     698                 :            : 
     699                 :            : //=========================================================================
     700                 :            : // virtual
     701                 :          0 : sal_Bool SAL_CALL ResultSet::previous()
     702                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     703                 :            : {
     704                 :            : /*
     705                 :            :     previous() is not the same as relative( -1 ) because it makes sense
     706                 :            :     to call previous() when there is no current row.
     707                 :            : */
     708         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     709                 :            : 
     710         [ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast )
     711                 :            :     {
     712                 :          0 :         m_pImpl->m_bAfterLast = sal_False;
     713         [ #  # ]:          0 :         sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
     714                 :          0 :         m_pImpl->m_nPos = nCount;
     715                 :            :     }
     716         [ #  # ]:          0 :     else if ( m_pImpl->m_nPos )
     717                 :          0 :         m_pImpl->m_nPos--;
     718                 :            : 
     719         [ #  # ]:          0 :     if ( m_pImpl->m_nPos )
     720                 :            :     {
     721         [ #  # ]:          0 :         m_pImpl->m_xDataSupplier->validate();
     722                 :          0 :         return sal_True;
     723                 :            :     }
     724                 :            : 
     725         [ #  # ]:          0 :     m_pImpl->m_xDataSupplier->validate();
     726         [ #  # ]:          0 :     return sal_False;
     727                 :            : }
     728                 :            : 
     729                 :            : //=========================================================================
     730                 :            : // virtual
     731                 :          0 : void SAL_CALL ResultSet::refreshRow()
     732                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     733                 :            : {
     734         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
     735 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
     736                 :          0 :         return;
     737                 :            : 
     738         [ #  # ]:          0 :     m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
     739 [ #  # ][ #  # ]:          0 :     m_pImpl->m_xDataSupplier->validate();
                 [ #  # ]
     740                 :            : }
     741                 :            : 
     742                 :            : //=========================================================================
     743                 :            : // virtual
     744                 :          0 : sal_Bool SAL_CALL ResultSet::rowUpdated()
     745                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     746                 :            : {
     747                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     748                 :          0 :     return sal_False;
     749                 :            : }
     750                 :            : 
     751                 :            : //=========================================================================
     752                 :            : // virtual
     753                 :          0 : sal_Bool SAL_CALL ResultSet::rowInserted()
     754                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     755                 :            : {
     756                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     757                 :          0 :     return sal_False;
     758                 :            : }
     759                 :            : 
     760                 :            : //=========================================================================
     761                 :            : // virtual
     762                 :          0 : sal_Bool SAL_CALL ResultSet::rowDeleted()
     763                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     764                 :            : {
     765                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     766                 :          0 :     return sal_False;
     767                 :            : }
     768                 :            : 
     769                 :            : //=========================================================================
     770                 :            : // virtual
     771                 :          0 : uno::Reference< uno::XInterface > SAL_CALL ResultSet::getStatement()
     772                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     773                 :            : {
     774                 :            : /*
     775                 :            :     returns the Statement that produced this ResultSet object. If the
     776                 :            :     result set was generated some other way, ... this method returns null.
     777                 :            : */
     778                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     779                 :          0 :     return uno::Reference< uno::XInterface >();
     780                 :            : }
     781                 :            : 
     782                 :            : //=========================================================================
     783                 :            : //
     784                 :            : // XRow methods.
     785                 :            : //
     786                 :            : //=========================================================================
     787                 :            : 
     788                 :            : // virtual
     789                 :         12 : sal_Bool SAL_CALL ResultSet::wasNull()
     790                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     791                 :            : {
     792                 :            :     // This method can not be implemented correctly!!! Imagine different
     793                 :            :     // threads doing a getXYZ - wasNull calling sequence on the same
     794                 :            :     // implementation object...
     795                 :            : 
     796 [ +  - ][ +  - ]:         12 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     797                 :            :     {
     798                 :            :         uno::Reference< sdbc::XRow > xValues
     799                 :         12 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     800         [ +  - ]:         12 :                                                         m_pImpl->m_nPos - 1 );
     801         [ +  - ]:         12 :         if ( xValues.is() )
     802                 :            :         {
     803         [ +  - ]:         12 :             m_pImpl->m_xDataSupplier->validate();
     804 [ +  - ][ +  - ]:         12 :             return xValues->wasNull();
     805         [ -  + ]:         12 :         }
     806                 :            :     }
     807                 :            : 
     808                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     809                 :         12 :     return m_pImpl->m_bWasNull;
     810                 :            : }
     811                 :            : 
     812                 :            : //=========================================================================
     813                 :            : // virtual
     814                 :         58 : rtl::OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
     815                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     816                 :            : {
     817 [ +  - ][ +  - ]:         58 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     818                 :            :     {
     819                 :            :         uno::Reference< sdbc::XRow > xValues
     820                 :         58 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     821         [ +  - ]:         58 :                                                         m_pImpl->m_nPos - 1 );
     822         [ +  - ]:         58 :         if ( xValues.is() )
     823                 :            :         {
     824                 :         58 :             m_pImpl->m_bWasNull = sal_False;
     825         [ +  - ]:         58 :             m_pImpl->m_xDataSupplier->validate();
     826 [ +  - ][ +  - ]:         58 :             return xValues->getString( columnIndex );
     827         [ -  + ]:         58 :         }
     828                 :            :     }
     829                 :            : 
     830                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     831                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     832                 :         58 :     return rtl::OUString();
     833                 :            : }
     834                 :            : 
     835                 :            : //=========================================================================
     836                 :            : // virtual
     837                 :         24 : sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
     838                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     839                 :            : {
     840 [ +  - ][ +  - ]:         24 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     841                 :            :     {
     842                 :            :         uno::Reference< sdbc::XRow > xValues
     843                 :         24 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     844         [ +  - ]:         24 :                                                         m_pImpl->m_nPos - 1 );
     845         [ +  - ]:         24 :         if ( xValues.is() )
     846                 :            :         {
     847                 :         24 :             m_pImpl->m_bWasNull = sal_False;
     848         [ +  - ]:         24 :             m_pImpl->m_xDataSupplier->validate();
     849 [ +  - ][ +  - ]:         24 :             return xValues->getBoolean( columnIndex );
     850         [ -  + ]:         24 :         }
     851                 :            :     }
     852                 :            : 
     853                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     854                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     855                 :         24 :     return sal_False;
     856                 :            : }
     857                 :            : 
     858                 :            : //=========================================================================
     859                 :            : // virtual
     860                 :          0 : sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
     861                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     862                 :            : {
     863 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     864                 :            :     {
     865                 :            :         uno::Reference< sdbc::XRow > xValues
     866                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     867         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     868         [ #  # ]:          0 :         if ( xValues.is() )
     869                 :            :         {
     870                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     871         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     872 [ #  # ][ #  # ]:          0 :             return xValues->getByte( columnIndex );
     873         [ #  # ]:          0 :         }
     874                 :            :     }
     875                 :            : 
     876                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     877                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     878                 :          0 :     return 0;
     879                 :            : }
     880                 :            : 
     881                 :            : //=========================================================================
     882                 :            : // virtual
     883                 :          0 : sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
     884                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     885                 :            : {
     886 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     887                 :            :     {
     888                 :            :         uno::Reference< sdbc::XRow > xValues
     889                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     890         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     891         [ #  # ]:          0 :         if ( xValues.is() )
     892                 :            :         {
     893                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     894         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     895 [ #  # ][ #  # ]:          0 :             return xValues->getShort( columnIndex );
     896         [ #  # ]:          0 :         }
     897                 :            :     }
     898                 :            : 
     899                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     900                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     901                 :          0 :     return 0;
     902                 :            : }
     903                 :            : 
     904                 :            : //=========================================================================
     905                 :            : // virtual
     906                 :          0 : sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
     907                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     908                 :            : {
     909 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     910                 :            :     {
     911                 :            :         uno::Reference< sdbc::XRow > xValues
     912                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     913         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     914         [ #  # ]:          0 :         if ( xValues.is() )
     915                 :            :         {
     916                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     917         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     918 [ #  # ][ #  # ]:          0 :             return xValues->getInt( columnIndex );
     919         [ #  # ]:          0 :         }
     920                 :            :     }
     921                 :            : 
     922                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     923                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     924                 :          0 :     return 0;
     925                 :            : }
     926                 :            : 
     927                 :            : //=========================================================================
     928                 :            : // virtual
     929                 :          0 : sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
     930                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     931                 :            : {
     932 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     933                 :            :     {
     934                 :            :         uno::Reference< sdbc::XRow > xValues
     935                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     936         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     937         [ #  # ]:          0 :         if ( xValues.is() )
     938                 :            :         {
     939                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     940         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     941 [ #  # ][ #  # ]:          0 :             return xValues->getLong( columnIndex );
     942         [ #  # ]:          0 :         }
     943                 :            :     }
     944                 :            : 
     945                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     946                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     947                 :          0 :     return 0;
     948                 :            : }
     949                 :            : 
     950                 :            : //=========================================================================
     951                 :            : // virtual
     952                 :          0 : float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
     953                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     954                 :            : {
     955 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     956                 :            :     {
     957                 :            :         uno::Reference< sdbc::XRow > xValues
     958                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     959         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     960         [ #  # ]:          0 :         if ( xValues.is() )
     961                 :            :         {
     962                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     963         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     964 [ #  # ][ #  # ]:          0 :             return xValues->getFloat( columnIndex );
     965         [ #  # ]:          0 :         }
     966                 :            :     }
     967                 :            : 
     968                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     969                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     970                 :          0 :     return 0;
     971                 :            : }
     972                 :            : 
     973                 :            : //=========================================================================
     974                 :            : // virtual
     975                 :          0 : double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
     976                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
     977                 :            : {
     978 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     979                 :            :     {
     980                 :            :         uno::Reference< sdbc::XRow > xValues
     981                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
     982         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
     983         [ #  # ]:          0 :         if ( xValues.is() )
     984                 :            :         {
     985                 :          0 :             m_pImpl->m_bWasNull = sal_False;
     986         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
     987 [ #  # ][ #  # ]:          0 :             return xValues->getDouble( columnIndex );
     988         [ #  # ]:          0 :         }
     989                 :            :     }
     990                 :            : 
     991                 :          0 :     m_pImpl->m_bWasNull = sal_True;
     992                 :          0 :     m_pImpl->m_xDataSupplier->validate();
     993                 :          0 :     return 0;
     994                 :            : }
     995                 :            : 
     996                 :            : //=========================================================================
     997                 :            : // virtual
     998                 :            : uno::Sequence< sal_Int8 > SAL_CALL
     999                 :          0 : ResultSet::getBytes( sal_Int32 columnIndex )
    1000                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1001                 :            : {
    1002 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1003                 :            :     {
    1004                 :            :         uno::Reference< sdbc::XRow > xValues
    1005                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1006         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1007         [ #  # ]:          0 :         if ( xValues.is() )
    1008                 :            :         {
    1009                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1010         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1011 [ #  # ][ #  # ]:          0 :             return xValues->getBytes( columnIndex );
    1012         [ #  # ]:          0 :         }
    1013                 :            :     }
    1014                 :            : 
    1015                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1016                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1017                 :          0 :     return uno::Sequence< sal_Int8 >();
    1018                 :            : }
    1019                 :            : 
    1020                 :            : //=========================================================================
    1021                 :            : // virtual
    1022                 :          0 : util::Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
    1023                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1024                 :            : {
    1025 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1026                 :            :     {
    1027                 :            :         uno::Reference< sdbc::XRow > xValues
    1028                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1029         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1030         [ #  # ]:          0 :         if ( xValues.is() )
    1031                 :            :         {
    1032                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1033         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1034 [ #  # ][ #  # ]:          0 :             return xValues->getDate( columnIndex );
    1035         [ #  # ]:          0 :         }
    1036                 :            :     }
    1037                 :            : 
    1038                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1039                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1040                 :          0 :     return util::Date();
    1041                 :            : }
    1042                 :            : 
    1043                 :            : //=========================================================================
    1044                 :            : // virtual
    1045                 :          0 : util::Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
    1046                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1047                 :            : {
    1048 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1049                 :            :     {
    1050                 :            :         uno::Reference< sdbc::XRow > xValues
    1051                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1052         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1053         [ #  # ]:          0 :         if ( xValues.is() )
    1054                 :            :         {
    1055                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1056         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1057 [ #  # ][ #  # ]:          0 :             return xValues->getTime( columnIndex );
    1058         [ #  # ]:          0 :         }
    1059                 :            :     }
    1060                 :            : 
    1061                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1062                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1063                 :          0 :     return util::Time();
    1064                 :            : }
    1065                 :            : 
    1066                 :            : //=========================================================================
    1067                 :            : // virtual
    1068                 :            : util::DateTime SAL_CALL
    1069                 :          0 : ResultSet::getTimestamp( sal_Int32 columnIndex )
    1070                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1071                 :            : {
    1072 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1073                 :            :     {
    1074                 :            :         uno::Reference< sdbc::XRow > xValues
    1075                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1076         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1077         [ #  # ]:          0 :         if ( xValues.is() )
    1078                 :            :         {
    1079                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1080         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1081 [ #  # ][ #  # ]:          0 :             return xValues->getTimestamp( columnIndex );
    1082         [ #  # ]:          0 :         }
    1083                 :            :     }
    1084                 :            : 
    1085                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1086                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1087                 :          0 :     return util::DateTime();
    1088                 :            : }
    1089                 :            : 
    1090                 :            : //=========================================================================
    1091                 :            : // virtual
    1092                 :            : uno::Reference< io::XInputStream > SAL_CALL
    1093                 :          0 : ResultSet::getBinaryStream( sal_Int32 columnIndex )
    1094                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1095                 :            : {
    1096 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1097                 :            :     {
    1098                 :            :         uno::Reference< sdbc::XRow > xValues
    1099                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1100         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1101         [ #  # ]:          0 :         if ( xValues.is() )
    1102                 :            :         {
    1103                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1104         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1105 [ #  # ][ #  # ]:          0 :             return xValues->getBinaryStream( columnIndex );
    1106         [ #  # ]:          0 :         }
    1107                 :            :     }
    1108                 :            : 
    1109                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1110                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1111                 :          0 :     return uno::Reference< io::XInputStream >();
    1112                 :            : }
    1113                 :            : 
    1114                 :            : //=========================================================================
    1115                 :            : // virtual
    1116                 :            : uno::Reference< io::XInputStream > SAL_CALL
    1117                 :          0 : ResultSet::getCharacterStream( sal_Int32 columnIndex )
    1118                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1119                 :            : {
    1120 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1121                 :            :     {
    1122                 :            :         uno::Reference< sdbc::XRow > xValues
    1123                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1124         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1125         [ #  # ]:          0 :         if ( xValues.is() )
    1126                 :            :         {
    1127                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1128         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1129 [ #  # ][ #  # ]:          0 :             return xValues->getCharacterStream( columnIndex );
    1130         [ #  # ]:          0 :         }
    1131                 :            :     }
    1132                 :            : 
    1133                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1134                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1135                 :          0 :     return uno::Reference< io::XInputStream >();
    1136                 :            : }
    1137                 :            : 
    1138                 :            : //=========================================================================
    1139                 :            : // virtual
    1140                 :        108 : uno::Any SAL_CALL ResultSet::getObject(
    1141                 :            :         sal_Int32 columnIndex,
    1142                 :            :         const uno::Reference< container::XNameAccess >& typeMap )
    1143                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1144                 :            : {
    1145 [ +  - ][ +  - ]:        108 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1146                 :            :     {
    1147                 :            :         uno::Reference< sdbc::XRow > xValues
    1148                 :        108 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1149         [ +  - ]:        108 :                                                         m_pImpl->m_nPos - 1 );
    1150         [ +  - ]:        108 :         if ( xValues.is() )
    1151                 :            :         {
    1152                 :        108 :             m_pImpl->m_bWasNull = sal_False;
    1153         [ +  - ]:        108 :             m_pImpl->m_xDataSupplier->validate();
    1154 [ +  - ][ +  - ]:        108 :             return xValues->getObject( columnIndex, typeMap );
    1155         [ -  + ]:        108 :         }
    1156                 :            :     }
    1157                 :            : 
    1158                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1159                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1160                 :        108 :     return uno::Any();
    1161                 :            : }
    1162                 :            : 
    1163                 :            : //=========================================================================
    1164                 :            : // virtual
    1165                 :            : uno::Reference< sdbc::XRef > SAL_CALL
    1166                 :          0 : ResultSet::getRef( sal_Int32 columnIndex )
    1167                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1168                 :            : {
    1169 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1170                 :            :     {
    1171                 :            :         uno::Reference< sdbc::XRow > xValues
    1172                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1173         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1174         [ #  # ]:          0 :         if ( xValues.is() )
    1175                 :            :         {
    1176                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1177         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1178 [ #  # ][ #  # ]:          0 :             return xValues->getRef( columnIndex );
    1179         [ #  # ]:          0 :         }
    1180                 :            :     }
    1181                 :            : 
    1182                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1183                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1184                 :          0 :     return uno::Reference< sdbc::XRef >();
    1185                 :            : }
    1186                 :            : 
    1187                 :            : //=========================================================================
    1188                 :            : // virtual
    1189                 :            : uno::Reference< sdbc::XBlob > SAL_CALL
    1190                 :          0 : ResultSet::getBlob( sal_Int32 columnIndex )
    1191                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1192                 :            : {
    1193 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1194                 :            :     {
    1195                 :            :         uno::Reference< sdbc::XRow > xValues
    1196                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1197         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1198         [ #  # ]:          0 :         if ( xValues.is() )
    1199                 :            :         {
    1200                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1201         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1202 [ #  # ][ #  # ]:          0 :             return xValues->getBlob( columnIndex );
    1203         [ #  # ]:          0 :         }
    1204                 :            :     }
    1205                 :            : 
    1206                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1207                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1208                 :          0 :     return uno::Reference< sdbc::XBlob >();
    1209                 :            : }
    1210                 :            : 
    1211                 :            : //=========================================================================
    1212                 :            : // virtual
    1213                 :            : uno::Reference< sdbc::XClob > SAL_CALL
    1214                 :          0 : ResultSet::getClob( sal_Int32 columnIndex )
    1215                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1216                 :            : {
    1217 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1218                 :            :     {
    1219                 :            :         uno::Reference< sdbc::XRow > xValues
    1220                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1221         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1222         [ #  # ]:          0 :         if ( xValues.is() )
    1223                 :            :         {
    1224                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1225         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1226 [ #  # ][ #  # ]:          0 :             return xValues->getClob( columnIndex );
    1227         [ #  # ]:          0 :         }
    1228                 :            :     }
    1229                 :            : 
    1230                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1231                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1232                 :          0 :     return uno::Reference< sdbc::XClob >();
    1233                 :            : }
    1234                 :            : 
    1235                 :            : //=========================================================================
    1236                 :            : // virtual
    1237                 :            : uno::Reference< sdbc::XArray > SAL_CALL
    1238                 :          0 : ResultSet::getArray( sal_Int32 columnIndex )
    1239                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1240                 :            : {
    1241 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1242                 :            :     {
    1243                 :            :         uno::Reference< sdbc::XRow > xValues
    1244                 :          0 :             = m_pImpl->m_xDataSupplier->queryPropertyValues(
    1245         [ #  # ]:          0 :                                                         m_pImpl->m_nPos - 1 );
    1246         [ #  # ]:          0 :         if ( xValues.is() )
    1247                 :            :         {
    1248                 :          0 :             m_pImpl->m_bWasNull = sal_False;
    1249         [ #  # ]:          0 :             m_pImpl->m_xDataSupplier->validate();
    1250 [ #  # ][ #  # ]:          0 :             return xValues->getArray( columnIndex );
    1251         [ #  # ]:          0 :         }
    1252                 :            :     }
    1253                 :            : 
    1254                 :          0 :     m_pImpl->m_bWasNull = sal_True;
    1255                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1256                 :          0 :     return uno::Reference< sdbc::XArray >();
    1257                 :            : }
    1258                 :            : 
    1259                 :            : //=========================================================================
    1260                 :            : //
    1261                 :            : // XCloseable methods.
    1262                 :            : //
    1263                 :            : //=========================================================================
    1264                 :            : 
    1265                 :            : // virtual
    1266                 :          0 : void SAL_CALL ResultSet::close()
    1267                 :            :     throw( sdbc::SQLException, uno::RuntimeException )
    1268                 :            : {
    1269                 :          0 :     m_pImpl->m_xDataSupplier->close();
    1270                 :          0 :     m_pImpl->m_xDataSupplier->validate();
    1271                 :          0 : }
    1272                 :            : 
    1273                 :            : //=========================================================================
    1274                 :            : //
    1275                 :            : // XContentAccess methods.
    1276                 :            : //
    1277                 :            : //=========================================================================
    1278                 :            : 
    1279                 :            : // virtual
    1280                 :          6 : rtl::OUString SAL_CALL ResultSet::queryContentIdentifierString()
    1281                 :            :     throw( uno::RuntimeException )
    1282                 :            : {
    1283 [ +  - ][ +  - ]:          6 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1284                 :          6 :         return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
    1285                 :          6 :                                                         m_pImpl->m_nPos - 1 );
    1286                 :            : 
    1287                 :          6 :     return rtl::OUString();
    1288                 :            : }
    1289                 :            : 
    1290                 :            : //=========================================================================
    1291                 :            : // virtual
    1292                 :            : uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
    1293                 :          0 : ResultSet::queryContentIdentifier()
    1294                 :            :     throw( uno::RuntimeException )
    1295                 :            : {
    1296 [ #  # ][ #  # ]:          0 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1297                 :          0 :         return m_pImpl->m_xDataSupplier->queryContentIdentifier(
    1298                 :          0 :                                                         m_pImpl->m_nPos - 1 );
    1299                 :            : 
    1300                 :          0 :     return uno::Reference< com::sun::star::ucb::XContentIdentifier >();
    1301                 :            : }
    1302                 :            : 
    1303                 :            : //=========================================================================
    1304                 :            : // virtual
    1305                 :            : uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
    1306                 :         12 : ResultSet::queryContent()
    1307                 :            :     throw( uno::RuntimeException )
    1308                 :            : {
    1309 [ +  - ][ +  - ]:         12 :     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
    1310                 :         12 :         return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
    1311                 :            : 
    1312                 :         12 :     return uno::Reference< com::sun::star::ucb::XContent >();
    1313                 :            : }
    1314                 :            : 
    1315                 :            : //=========================================================================
    1316                 :            : //
    1317                 :            : // XPropertySet methods.
    1318                 :            : //
    1319                 :            : //=========================================================================
    1320                 :            : 
    1321                 :            : // virtual
    1322                 :            : uno::Reference< beans::XPropertySetInfo > SAL_CALL
    1323                 :          0 : ResultSet::getPropertySetInfo()
    1324                 :            :     throw( uno::RuntimeException )
    1325                 :            : {
    1326         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
    1327                 :            : 
    1328         [ #  # ]:          0 :     if ( !m_pImpl->m_xPropSetInfo.is() )
    1329                 :            :         m_pImpl->m_xPropSetInfo
    1330                 :            :             = new PropertySetInfo( m_pImpl->m_xSMgr,
    1331                 :            :                                    aPropertyTable,
    1332 [ #  # ][ #  # ]:          0 :                                    RESULTSET_PROPERTY_COUNT );
                 [ #  # ]
    1333         [ #  # ]:          0 :     return m_pImpl->m_xPropSetInfo;
    1334                 :            : }
    1335                 :            : 
    1336                 :            : //=========================================================================
    1337                 :            : // virtual
    1338                 :          0 : void SAL_CALL ResultSet::setPropertyValue( const rtl::OUString& aPropertyName,
    1339                 :            :                                            const uno::Any& )
    1340                 :            :     throw( beans::UnknownPropertyException,
    1341                 :            :            beans::PropertyVetoException,
    1342                 :            :            lang::IllegalArgumentException,
    1343                 :            :            lang::WrappedTargetException,
    1344                 :            :            uno::RuntimeException )
    1345                 :            : {
    1346         [ #  # ]:          0 :     if ( aPropertyName.isEmpty() )
    1347         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1348                 :            : 
    1349         [ #  # ]:          0 :     if ( aPropertyName.equals(
    1350                 :          0 :                 rtl::OUString("RowCount") ) )
    1351                 :            :     {
    1352                 :            :         // property is read-only.
    1353         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
    1354                 :            :     }
    1355         [ #  # ]:          0 :     else if ( aPropertyName.equals(
    1356                 :          0 :                 rtl::OUString("IsRowCountFinal") ) )
    1357                 :            :     {
    1358                 :            :         // property is read-only.
    1359         [ #  # ]:          0 :         throw lang::IllegalArgumentException();
    1360                 :            :     }
    1361                 :            :     else
    1362                 :            :     {
    1363         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1364                 :            :     }
    1365                 :            : }
    1366                 :            : 
    1367                 :            : //=========================================================================
    1368                 :            : // virtual
    1369                 :          0 : uno::Any SAL_CALL ResultSet::getPropertyValue(
    1370                 :            :         const rtl::OUString& PropertyName )
    1371                 :            :     throw( beans::UnknownPropertyException,
    1372                 :            :            lang::WrappedTargetException,
    1373                 :            :            uno::RuntimeException )
    1374                 :            : {
    1375         [ #  # ]:          0 :     if ( PropertyName.isEmpty() )
    1376         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1377                 :            : 
    1378                 :          0 :     uno::Any aValue;
    1379                 :            : 
    1380         [ #  # ]:          0 :     if ( PropertyName.equals(
    1381                 :          0 :                 rtl::OUString("RowCount") ) )
    1382                 :            :     {
    1383 [ #  # ][ #  # ]:          0 :         aValue <<= m_pImpl->m_xDataSupplier->currentCount();
    1384                 :            :     }
    1385         [ #  # ]:          0 :     else if ( PropertyName.equals(
    1386                 :          0 :                 rtl::OUString("IsRowCountFinal") ) )
    1387                 :            :     {
    1388 [ #  # ][ #  # ]:          0 :         aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
    1389                 :            :     }
    1390                 :            :     else
    1391                 :            :     {
    1392         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1393                 :            :     }
    1394                 :            : 
    1395                 :          0 :     return aValue;
    1396                 :            : }
    1397                 :            : 
    1398                 :            : //=========================================================================
    1399                 :            : // virtual
    1400                 :          0 : void SAL_CALL ResultSet::addPropertyChangeListener(
    1401                 :            :         const rtl::OUString& aPropertyName,
    1402                 :            :         const uno::Reference< beans::XPropertyChangeListener >& xListener )
    1403                 :            :     throw( beans::UnknownPropertyException,
    1404                 :            :            lang::WrappedTargetException,
    1405                 :            :            uno::RuntimeException )
    1406                 :            : {
    1407                 :            :     // Note: An empty property name means a listener for "all" properties.
    1408                 :            : 
    1409         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
    1410                 :            : 
    1411   [ #  #  #  #  :          0 :     if ( !aPropertyName.isEmpty() &&
           #  # ][ #  # ]
    1412                 :            :          !aPropertyName.equals(
    1413 [ #  # ][ #  # ]:          0 :                 rtl::OUString("RowCount") ) &&
    1414                 :            :          !aPropertyName.equals(
    1415 [ #  # ][ #  # ]:          0 :                 rtl::OUString("IsRowCountFinal") ) )
    1416         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1417                 :            : 
    1418         [ #  # ]:          0 :     if ( !m_pImpl->m_pPropertyChangeListeners )
    1419                 :            :         m_pImpl->m_pPropertyChangeListeners
    1420         [ #  # ]:          0 :             = new PropertyChangeListeners( m_pImpl->m_aMutex );
    1421                 :            : 
    1422                 :            :     m_pImpl->m_pPropertyChangeListeners->addInterface(
    1423 [ #  # ][ #  # ]:          0 :                                                 aPropertyName, xListener );
    1424                 :          0 : }
    1425                 :            : 
    1426                 :            : //=========================================================================
    1427                 :            : // virtual
    1428                 :          0 : void SAL_CALL ResultSet::removePropertyChangeListener(
    1429                 :            :         const rtl::OUString& aPropertyName,
    1430                 :            :         const uno::Reference< beans::XPropertyChangeListener >& xListener )
    1431                 :            :     throw( beans::UnknownPropertyException,
    1432                 :            :            lang::WrappedTargetException,
    1433                 :            :            uno::RuntimeException )
    1434                 :            : {
    1435         [ #  # ]:          0 :     osl::MutexGuard aGuard( m_pImpl->m_aMutex );
    1436                 :            : 
    1437   [ #  #  #  #  :          0 :     if ( !aPropertyName.isEmpty() &&
           #  # ][ #  # ]
    1438                 :            :          !aPropertyName.equals(
    1439 [ #  # ][ #  # ]:          0 :                 rtl::OUString("RowCount") ) &&
    1440                 :            :          !aPropertyName.equals(
    1441 [ #  # ][ #  # ]:          0 :                 rtl::OUString("IsRowCountFinal") ) )
    1442         [ #  # ]:          0 :         throw beans::UnknownPropertyException();
    1443                 :            : 
    1444         [ #  # ]:          0 :     if ( m_pImpl->m_pPropertyChangeListeners )
    1445                 :            :         m_pImpl->m_pPropertyChangeListeners->removeInterface(
    1446 [ #  # ][ #  # ]:          0 :                                                     aPropertyName, xListener );
    1447                 :            : 
    1448                 :          0 : }
    1449                 :            : 
    1450                 :            : //=========================================================================
    1451                 :            : // virtual
    1452                 :          0 : void SAL_CALL ResultSet::addVetoableChangeListener(
    1453                 :            :         const rtl::OUString&,
    1454                 :            :         const uno::Reference< beans::XVetoableChangeListener >& )
    1455                 :            :     throw( beans::UnknownPropertyException,
    1456                 :            :            lang::WrappedTargetException,
    1457                 :            :            uno::RuntimeException )
    1458                 :            : {
    1459                 :            :     //  No constrained props, at the moment.
    1460                 :          0 : }
    1461                 :            : 
    1462                 :            : //=========================================================================
    1463                 :            : // virtual
    1464                 :          0 : void SAL_CALL ResultSet::removeVetoableChangeListener(
    1465                 :            :         const rtl::OUString&,
    1466                 :            :         const uno::Reference< beans::XVetoableChangeListener >& )
    1467                 :            :     throw( beans::UnknownPropertyException,
    1468                 :            :            lang::WrappedTargetException,
    1469                 :            :            uno::RuntimeException )
    1470                 :            : {
    1471                 :            :     //  No constrained props, at the moment.
    1472                 :          0 : }
    1473                 :            : 
    1474                 :            : //=========================================================================
    1475                 :            : //
    1476                 :            : // Non-interface methods.
    1477                 :            : //
    1478                 :            : //=========================================================================
    1479                 :            : 
    1480                 :          0 : void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt )
    1481                 :            : {
    1482         [ #  # ]:          0 :     if ( !m_pImpl->m_pPropertyChangeListeners )
    1483                 :          0 :         return;
    1484                 :            : 
    1485                 :            :     // Notify listeners interested especially in the changed property.
    1486                 :            :     cppu::OInterfaceContainerHelper* pPropsContainer
    1487                 :            :         = m_pImpl->m_pPropertyChangeListeners->getContainer(
    1488                 :          0 :                                                         rEvt.PropertyName );
    1489         [ #  # ]:          0 :     if ( pPropsContainer )
    1490                 :            :     {
    1491         [ #  # ]:          0 :         cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
    1492         [ #  # ]:          0 :         while ( aIter.hasMoreElements() )
    1493                 :            :         {
    1494                 :            :             uno::Reference< beans::XPropertyChangeListener > xListener(
    1495 [ #  # ][ #  # ]:          0 :                 aIter.next(), uno::UNO_QUERY );
    1496         [ #  # ]:          0 :             if ( xListener.is() )
    1497 [ #  # ][ #  # ]:          0 :                 xListener->propertyChange( rEvt );
    1498         [ #  # ]:          0 :         }
    1499                 :            :     }
    1500                 :            : 
    1501                 :            :     // Notify listeners interested in all properties.
    1502                 :            :     pPropsContainer
    1503         [ #  # ]:          0 :         = m_pImpl->m_pPropertyChangeListeners->getContainer( rtl::OUString() );
    1504         [ #  # ]:          0 :     if ( pPropsContainer )
    1505                 :            :     {
    1506         [ #  # ]:          0 :         cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
    1507         [ #  # ]:          0 :         while ( aIter.hasMoreElements() )
    1508                 :            :         {
    1509                 :            :             uno::Reference< beans::XPropertyChangeListener > xListener(
    1510 [ #  # ][ #  # ]:          0 :                 aIter.next(), uno::UNO_QUERY );
    1511         [ #  # ]:          0 :             if ( xListener.is() )
    1512 [ #  # ][ #  # ]:          0 :                 xListener->propertyChange( rEvt );
    1513         [ #  # ]:          0 :         }
    1514                 :            :     }
    1515                 :            : }
    1516                 :            : 
    1517                 :            : //=========================================================================
    1518                 :         16 : void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
    1519                 :            : {
    1520                 :            :     OSL_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
    1521                 :            : 
    1522         [ +  - ]:         16 :     if ( !m_pImpl->m_pPropertyChangeListeners )
    1523                 :         16 :         return;
    1524                 :            : 
    1525                 :            :     propertyChanged(
    1526                 :            :         beans::PropertyChangeEvent(
    1527                 :            :             static_cast< cppu::OWeakObject * >( this ),
    1528                 :            :             rtl::OUString("RowCount"),
    1529                 :            :             sal_False,
    1530                 :            :             1001,
    1531                 :            :             uno::makeAny( nOld ),     // old value
    1532 [ #  # ][ #  # ]:          0 :             uno::makeAny( nNew ) ) ); // new value
         [ #  # ][ #  # ]
                 [ #  # ]
    1533                 :            : }
    1534                 :            : 
    1535                 :            : //=========================================================================
    1536                 :         53 : void ResultSet::rowCountFinal()
    1537                 :            : {
    1538         [ +  - ]:         53 :     if ( !m_pImpl->m_pPropertyChangeListeners )
    1539                 :         53 :         return;
    1540                 :            : 
    1541                 :            :     propertyChanged(
    1542                 :            :         beans::PropertyChangeEvent(
    1543                 :            :             static_cast< cppu::OWeakObject * >( this ),
    1544                 :            :             rtl::OUString("IsRowCountFinal"),
    1545                 :            :             sal_False,
    1546                 :            :             1000,
    1547                 :            :             uno:: makeAny( sal_False ),   // old value
    1548 [ #  # ][ #  # ]:          0 :             uno::makeAny( sal_True ) ) ); // new value
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1549                 :            : }
    1550                 :            : 
    1551                 :            : //=========================================================================
    1552                 :         38 : const uno::Sequence< beans::Property >& ResultSet::getProperties()
    1553                 :            : {
    1554                 :         38 :     return m_pImpl->m_aProperties;
    1555                 :            : }
    1556                 :            : 
    1557                 :            : //=========================================================================
    1558                 :            : const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
    1559                 :          0 : ResultSet::getEnvironment()
    1560                 :            : {
    1561                 :          0 :     return m_pImpl->m_xEnv;
    1562                 :            : }
    1563                 :            : 
    1564                 :            : } // namespace ucbhelper
    1565                 :            : 
    1566                 :            : namespace ucbhelper_impl {
    1567                 :            : 
    1568                 :            : //=========================================================================
    1569                 :            : //=========================================================================
    1570                 :            : //
    1571                 :            : // PropertySetInfo Implementation.
    1572                 :            : //
    1573                 :            : //=========================================================================
    1574                 :            : //=========================================================================
    1575                 :            : 
    1576                 :          0 : PropertySetInfo::PropertySetInfo(
    1577                 :            :     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
    1578                 :            :     const PropertyInfo* pProps,
    1579                 :            :     sal_Int32 nProps )
    1580                 :          0 : : m_xSMgr( rxSMgr )
    1581                 :            : {
    1582         [ #  # ]:          0 :     m_pProps = new uno::Sequence< beans::Property >( nProps );
    1583                 :            : 
    1584         [ #  # ]:          0 :     if ( nProps )
    1585                 :            :     {
    1586                 :          0 :         const PropertyInfo* pEntry = pProps;
    1587         [ #  # ]:          0 :         beans::Property* pProperties = m_pProps->getArray();
    1588                 :            : 
    1589         [ #  # ]:          0 :         for ( sal_Int32 n = 0; n < nProps; ++n )
    1590                 :            :         {
    1591                 :          0 :             beans::Property& rProp = pProperties[ n ];
    1592                 :            : 
    1593                 :          0 :             rProp.Name       = rtl::OUString::createFromAscii( pEntry->pName );
    1594                 :          0 :             rProp.Handle     = pEntry->nHandle;
    1595         [ #  # ]:          0 :             rProp.Type       = pEntry->pGetCppuType();
    1596                 :          0 :             rProp.Attributes = pEntry->nAttributes;
    1597                 :            : 
    1598                 :          0 :             pEntry++;
    1599                 :            :         }
    1600                 :            :     }
    1601                 :          0 : }
    1602                 :            : 
    1603                 :            : //=========================================================================
    1604                 :            : // virtual
    1605                 :          0 : PropertySetInfo::~PropertySetInfo()
    1606                 :            : {
    1607 [ #  # ][ #  # ]:          0 :     delete m_pProps;
    1608         [ #  # ]:          0 : }
    1609                 :            : 
    1610                 :            : //=========================================================================
    1611                 :            : //
    1612                 :            : // XInterface methods.
    1613                 :            : //
    1614                 :            : //=========================================================================
    1615                 :            : 
    1616 [ #  # ][ #  # ]:          0 : XINTERFACE_IMPL_2( PropertySetInfo,
                 [ #  # ]
    1617                 :            :                    lang::XTypeProvider,
    1618                 :            :                    beans::XPropertySetInfo );
    1619                 :            : 
    1620                 :            : //=========================================================================
    1621                 :            : //
    1622                 :            : // XTypeProvider methods.
    1623                 :            : //
    1624                 :            : //=========================================================================
    1625                 :            : 
    1626 [ #  # ][ #  # ]:          0 : XTYPEPROVIDER_IMPL_2( PropertySetInfo,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1627                 :            :                          lang::XTypeProvider,
    1628                 :            :                          beans::XPropertySetInfo );
    1629                 :            : 
    1630                 :            : //=========================================================================
    1631                 :            : //
    1632                 :            : // XPropertySetInfo methods.
    1633                 :            : //
    1634                 :            : //=========================================================================
    1635                 :            : 
    1636                 :            : // virtual
    1637                 :          0 : uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
    1638                 :            :     throw( uno::RuntimeException )
    1639                 :            : {
    1640                 :          0 :     return uno::Sequence< beans::Property >( *m_pProps );
    1641                 :            : }
    1642                 :            : 
    1643                 :            : //=========================================================================
    1644                 :            : // virtual
    1645                 :          0 : beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
    1646                 :            :         const rtl::OUString& aName )
    1647                 :            :     throw( beans::UnknownPropertyException, uno::RuntimeException )
    1648                 :            : {
    1649                 :          0 :     beans::Property aProp;
    1650 [ #  # ][ #  # ]:          0 :     if ( queryProperty( aName, aProp ) )
    1651                 :          0 :         return aProp;
    1652                 :            : 
    1653         [ #  # ]:          0 :     throw beans::UnknownPropertyException();
    1654                 :            : }
    1655                 :            : 
    1656                 :            : //=========================================================================
    1657                 :            : // virtual
    1658                 :          0 : sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
    1659                 :            :         const rtl::OUString& Name )
    1660                 :            :     throw( uno::RuntimeException )
    1661                 :            : {
    1662                 :          0 :     beans::Property aProp;
    1663         [ #  # ]:          0 :     return queryProperty( Name, aProp );
    1664                 :            : }
    1665                 :            : 
    1666                 :            : //=========================================================================
    1667                 :          0 : sal_Bool PropertySetInfo::queryProperty(
    1668                 :            :     const rtl::OUString& aName, beans::Property& rProp )
    1669                 :            : {
    1670                 :          0 :     sal_Int32 nCount = m_pProps->getLength();
    1671                 :          0 :     const beans::Property* pProps = m_pProps->getConstArray();
    1672         [ #  # ]:          0 :     for ( sal_Int32 n = 0; n < nCount; ++n )
    1673                 :            :     {
    1674                 :          0 :         const beans::Property& rCurr = pProps[ n ];
    1675         [ #  # ]:          0 :         if ( rCurr.Name == aName )
    1676                 :            :         {
    1677                 :          0 :             rProp = rCurr;
    1678                 :          0 :             return sal_True;
    1679                 :            :         }
    1680                 :            :     }
    1681                 :            : 
    1682                 :          0 :     return sal_False;
    1683                 :            : }
    1684                 :            : 
    1685                 :            : } // namespace ucbhelper_impl
    1686                 :            : 
    1687                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10