LCOV - code coverage report
Current view: top level - dbaccess/source/core/inc - statement.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
      21             : 
      22             : #include <com/sun/star/lang/XServiceInfo.hpp>
      23             : #include <com/sun/star/sdbc/XStatement.hpp>
      24             : #include <com/sun/star/sdbc/XConnection.hpp>
      25             : #include <com/sun/star/util/XCancellable.hpp>
      26             : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
      27             : #include <com/sun/star/sdbc/XCloseable.hpp>
      28             : #include <com/sun/star/sdbc/XMultipleResults.hpp>
      29             : #include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
      30             : #include <com/sun/star/sdbc/XBatchExecution.hpp>
      31             : #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
      32             : #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
      33             : #include <cppuhelper/propshlp.hxx>
      34             : #include <comphelper/proparrhlp.hxx>
      35             : #include "apitools.hxx"
      36             : #include <comphelper/broadcasthelper.hxx>
      37             : 
      38             : #include <cppuhelper/implbase3.hxx>
      39             : 
      40             : 
      41             : //  OStatementBase
      42             : 
      43             : class OStatementBase :  public comphelper::OBaseMutex,
      44             :                         public OSubComponent,
      45             :                         public ::cppu::OPropertySetHelper,
      46             :                         public ::comphelper::OPropertyArrayUsageHelper < OStatementBase >,
      47             :                         public ::com::sun::star::util::XCancellable,
      48             :                         public ::com::sun::star::sdbc::XWarningsSupplier,
      49             :                         public ::com::sun::star::sdbc::XPreparedBatchExecution,
      50             :                         public ::com::sun::star::sdbc::XMultipleResults,
      51             :                         public ::com::sun::star::sdbc::XCloseable,
      52             :                         public ::com::sun::star::sdbc::XGeneratedResultSet
      53             : {
      54             : protected:
      55             :     ::osl::Mutex            m_aCancelMutex;
      56             : 
      57             :     ::com::sun::star::uno::WeakReferenceHelper  m_aResultSet;
      58             :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAggregateAsSet;
      59             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XCancellable > m_xAggregateAsCancellable;
      60             :     bool                m_bUseBookmarks;
      61             :     bool                m_bEscapeProcessing;
      62             : 
      63             :     virtual ~OStatementBase();
      64             : 
      65             : public:
      66             :     OStatementBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _xConn,
      67             :                    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _xStatement);
      68             : 
      69             : 
      70             : // ::com::sun::star::lang::XTypeProvider
      71             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             : 
      73             : // ::com::sun::star::uno::XInterface
      74             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      75             :     virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
      76             :     virtual void SAL_CALL release() throw() SAL_OVERRIDE;
      77             : 
      78             : // OComponentHelper
      79             :     virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
      80             : 
      81             : // com::sun::star::beans::XPropertySet
      82             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      83             : 
      84             : // comphelper::OPropertyArrayUsageHelper
      85             :     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
      86             : 
      87             : // cppu::OPropertySetHelper
      88             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
      89             : 
      90             :     virtual sal_Bool SAL_CALL convertFastPropertyValue(
      91             :                             ::com::sun::star::uno::Any & rConvertedValue,
      92             :                             ::com::sun::star::uno::Any & rOldValue,
      93             :                             sal_Int32 nHandle,
      94             :                             const ::com::sun::star::uno::Any& rValue )
      95             :                                 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
      96             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
      97             :                                 sal_Int32 nHandle,
      98             :                                 const ::com::sun::star::uno::Any& rValue
      99             :                                                  )
     100             :                                                  throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     101             :     virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
     102             : 
     103             : // ::com::sun::star::sdbc::XWarningsSupplier
     104             :     virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             :     virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             : 
     107             : // ::com::sun::star::util::XCancellable
     108             :     virtual void SAL_CALL cancel(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             : 
     110             : // ::com::sun::star::sdbc::XCloseable
     111             :     virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             : 
     113             : // ::com::sun::star::sdbc::XMultipleResults
     114             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual sal_Int32 SAL_CALL getUpdateCount(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     virtual sal_Bool SAL_CALL getMoreResults(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             : // ::com::sun::star::sdbc::XPreparedBatchExecution
     119             :     virtual void SAL_CALL addBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual void SAL_CALL clearBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : // ::com::sun::star::sdbc::XGeneratedResultSet
     123             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getGeneratedValues(  ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             : 
     125             : // Helper
     126             :     void disposeResultSet();
     127             : 
     128             : protected:
     129             :     using ::cppu::OPropertySetHelper::getFastPropertyValue;
     130             : };
     131             : 
     132             : 
     133             : //  OStatement
     134             : 
     135             : typedef ::cppu::ImplHelper3 <   ::com::sun::star::sdbc::XStatement
     136             :                             ,   ::com::sun::star::lang::XServiceInfo
     137             :                             ,   ::com::sun::star::sdbc::XBatchExecution
     138             :                             >   OStatement_IFACE;
     139          52 : class OStatement    :public OStatementBase
     140             :                     ,public OStatement_IFACE
     141             : {
     142             : private:
     143             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement >                  m_xAggregateStatement;
     144             :     ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >   m_xComposer;
     145             :     bool                                                                                    m_bAttemptedComposerCreation;
     146             : 
     147             : public:
     148             :     OStatement(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > & _xConn,
     149             :                const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _xStatement);
     150             : 
     151             :     DECLARE_XINTERFACE()
     152             :     DECLARE_XTYPEPROVIDER()
     153             : 
     154             : // ::com::sun::star::lang::XServiceInfo
     155             :     virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     156             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             : 
     159             : // ::com::sun::star::sdbc::XStatement
     160             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             :     virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     162             :     virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             :     // OComponentHelper
     166             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     167             : 
     168             :     // XBatchExecution
     169             :     virtual void SAL_CALL addBatch( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             :     virtual void SAL_CALL clearBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     171             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     172             : 
     173             :     using OStatementBase::addBatch;
     174             : 
     175             : private:
     176             :     /** does escape processing for the given SQL command, if the our EscapeProcessing
     177             :         property allows so.
     178             :     */
     179             :     OUString impl_doEscapeProcessing_nothrow( const OUString& _rSQL ) const;
     180             :     bool            impl_ensureComposer_nothrow() const;
     181             : };
     182             : 
     183             : #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10