LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/inc/odbc - OStatement.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-12-27 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_
      21             : #define _CONNECTIVITY_ODBC_OSTATEMENT_HXX_
      22             : 
      23             : #include <com/sun/star/sdbc/XStatement.hpp>
      24             : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
      25             : #include <com/sun/star/sdbc/XMultipleResults.hpp>
      26             : #include <com/sun/star/sdbc/XBatchExecution.hpp>
      27             : #include <com/sun/star/sdbc/XCloseable.hpp>
      28             : #include <com/sun/star/sdbc/SQLWarning.hpp>
      29             : #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
      30             : #include <com/sun/star/util/XCancellable.hpp>
      31             : #include <comphelper/proparrhlp.hxx>
      32             : #include <cppuhelper/compbase6.hxx>
      33             : #include <comphelper/uno3.hxx>
      34             : #include "connectivity/CommonTools.hxx"
      35             : #include "odbc/OFunctions.hxx"
      36             : #include "odbc/OConnection.hxx"
      37             : #include "odbc/odbcbasedllapi.hxx"
      38             : #include <list>
      39             : #include <com/sun/star/lang/XServiceInfo.hpp>
      40             : #include <comphelper/broadcasthelper.hxx>
      41             : 
      42             : namespace connectivity
      43             : {
      44             :     namespace odbc
      45             :     {
      46             : 
      47             :         typedef ::cppu::WeakComponentImplHelper6<   ::com::sun::star::sdbc::XStatement,
      48             :                                                     ::com::sun::star::sdbc::XWarningsSupplier,
      49             :                                                     ::com::sun::star::util::XCancellable,
      50             :                                                     ::com::sun::star::sdbc::XCloseable,
      51             :                                                     ::com::sun::star::sdbc::XGeneratedResultSet,
      52             :                                                     ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE;
      53             : 
      54             :         class OResultSet;
      55             :         //**************************************************************
      56             :         //************ Class: java.sql.Statement
      57             :         //**************************************************************
      58             :         class OOO_DLLPUBLIC_ODBCBASE OStatement_Base :
      59             :                                         public comphelper::OBaseMutex,
      60             :                                         public  OStatement_BASE,
      61             :                                         public  ::cppu::OPropertySetHelper,
      62             :                                         public  ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
      63             : 
      64             :         {
      65             :         ::com::sun::star::sdbc::SQLWarning                                           m_aLastWarning;
      66             :         protected:
      67             :             ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet>   m_xResultSet;   // The last ResultSet created
      68             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement>       m_xGeneratedStatement;
      69             :             //  for this Statement
      70             : 
      71             :             ::std::list< ::rtl::OUString>   m_aBatchList;
      72             :             ::rtl::OUString                 m_sSqlStatement;
      73             : 
      74             :             OConnection*                    m_pConnection;// The owning Connection object
      75             :             SQLHANDLE                       m_aStatementHandle;
      76             :             SQLUSMALLINT*                   m_pRowStatusArray;
      77             :             ::cppu::OBroadcastHelper&       rBHelper;
      78             : 
      79             :         protected:
      80             : 
      81             :             sal_Int64 getQueryTimeOut()         const;
      82             :             sal_Int64 getMaxFieldSize()         const;
      83             :             sal_Int64 getMaxRows()              const;
      84             :             sal_Int32 getResultSetConcurrency() const;
      85             :             sal_Int32 getResultSetType()        const;
      86             :             sal_Int32 getFetchDirection()       const;
      87             :             sal_Int32 getFetchSize()            const;
      88             :             ::rtl::OUString getCursorName()     const;
      89             :             sal_Bool isUsingBookmarks()         const;
      90             :             sal_Bool getEscapeProcessing()      const;
      91             :             template < typename T, SQLINTEGER BufferLength > T getStmtOption (SQLINTEGER fOption, T dflt = 0) const;
      92             : 
      93             :             void setQueryTimeOut(sal_Int64 _par0)           ;
      94             :             void setMaxFieldSize(sal_Int64 _par0)           ;
      95             :             void setMaxRows(sal_Int64 _par0)                ;
      96             :             void setFetchDirection(sal_Int32 _par0)         ;
      97             :             void setFetchSize(sal_Int32 _par0)              ;
      98             :             void setCursorName(const ::rtl::OUString &_par0);
      99             :             void setEscapeProcessing( const sal_Bool _bEscapeProc );
     100             :             template < typename T, SQLINTEGER BufferLength > SQLRETURN setStmtOption (SQLINTEGER fOption, T value) const;
     101             : 
     102             :             virtual void setResultSetConcurrency(sal_Int32 _par0)   ;
     103             :             virtual void setResultSetType(sal_Int32 _par0)          ;
     104             :             virtual void setUsingBookmarks(sal_Bool _bUseBookmark)  ;
     105             : 
     106             :             void reset () throw( ::com::sun::star::sdbc::SQLException);
     107             :             void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
     108             :             void setWarning (const  ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException);
     109             :             sal_Bool lockIfNecessary (const ::rtl::OUString& sql) throw( ::com::sun::star::sdbc::SQLException);
     110             :             sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException);
     111             : 
     112             :             //--------------------------------------------------------------------
     113             :             // getResultSet
     114             :             // getResultSet returns the current result as a ResultSet.  It
     115             :             // returns NULL if the current result is not a ResultSet.
     116             :             //--------------------------------------------------------------------
     117             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > getResultSet (sal_Bool checkCount) throw( ::com::sun::star::sdbc::SQLException);
     118             :             /**
     119             :                 creates the driver specific resultset (factory)
     120             :             */
     121             :             virtual OResultSet* createResulSet();
     122             : 
     123             :             SQLLEN getRowCount () throw( ::com::sun::star::sdbc::SQLException);
     124             : 
     125             : 
     126             :             void disposeResultSet();
     127             : 
     128             :             // OPropertyArrayUsageHelper
     129             :             virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
     130             :             // OPropertySetHelper
     131             :             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
     132             :             virtual sal_Bool SAL_CALL convertFastPropertyValue(
     133             :                                 ::com::sun::star::uno::Any & rConvertedValue,
     134             :                                 ::com::sun::star::uno::Any & rOldValue,
     135             :                                 sal_Int32 nHandle,
     136             :                                 const ::com::sun::star::uno::Any& rValue )
     137             :                             throw (::com::sun::star::lang::IllegalArgumentException);
     138             :             virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     139             :                                     sal_Int32 nHandle,
     140             :                                     const ::com::sun::star::uno::Any& rValue
     141             :                                                      )
     142             :                                  throw (::com::sun::star::uno::Exception);
     143             :             virtual void SAL_CALL getFastPropertyValue(
     144             :                                     ::com::sun::star::uno::Any& rValue,
     145             :                                     sal_Int32 nHandle
     146             :                                          ) const;
     147             :             virtual ~OStatement_Base();
     148             : 
     149             :         public:
     150             :             OStatement_Base(OConnection* _pConnection );
     151             :             using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
     152             : 
     153           0 :             inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex)  const
     154             :             {
     155           0 :                 return m_pConnection->getOdbcFunction(_nIndex);
     156             :             }
     157             :             // OComponentHelper
     158             :             virtual void SAL_CALL disposing(void);
     159             :             // XInterface
     160             :             virtual void SAL_CALL release() throw();
     161             :             virtual void SAL_CALL acquire() throw();
     162             :             // XInterface
     163             :             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
     164             :             //XTypeProvider
     165             :             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
     166             : 
     167             :             // XPropertySet
     168             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     169             :             // XStatement
     170             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
     171             :             virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
     172             :             virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
     173             :             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) ;
     174             :             // XWarningsSupplier
     175             :             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     176             :             virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     177             :             // XCancellable
     178             :             virtual void SAL_CALL cancel(  ) throw(::com::sun::star::uno::RuntimeException);
     179             :             // XCloseable
     180             :             virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     181             :             // XMultipleResults
     182             :             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);
     183             :             virtual sal_Int32 SAL_CALL getUpdateCount(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     184             :             virtual sal_Bool SAL_CALL getMoreResults(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     185             :             //XGeneratedResultSet
     186             :             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);
     187             : 
     188             :             // other methods
     189           0 :             SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); }
     190           0 :             OConnection* getOwnConnection() const { return m_pConnection;}
     191             :             /** getCursorProperties return the properties for a specific cursor type
     192             :                 @param _nCursorType     the CursorType
     193             :                 @param bFirst           when true the first property set is returned
     194             : 
     195             :                 @return the cursor properties
     196             :             */
     197             :             SQLUINTEGER getCursorProperties(SQLINTEGER _nCursorType,sal_Bool bFirst);
     198             : 
     199             :         protected:
     200             :             using OPropertySetHelper::getFastPropertyValue;
     201             :         };
     202             : 
     203           0 :         class OOO_DLLPUBLIC_ODBCBASE OStatement_BASE2 :
     204             :                                  public OStatement_Base
     205             :                                 ,public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
     206             : 
     207             :         {
     208             :             friend class OSubComponent<OStatement_BASE2, OStatement_BASE>;
     209             :         public:
     210           0 :             OStatement_BASE2(OConnection* _pConnection ) :  OStatement_Base(_pConnection ),
     211           0 :                                     ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
     212             :             // OComponentHelper
     213             :             virtual void SAL_CALL disposing(void);
     214             :             // XInterface
     215             :             virtual void SAL_CALL release() throw();
     216             :         };
     217             : 
     218             :         class OOO_DLLPUBLIC_ODBCBASE OStatement :
     219             :                             public OStatement_BASE2,
     220             :                             public ::com::sun::star::sdbc::XBatchExecution,
     221             :                             public ::com::sun::star::lang::XServiceInfo
     222             :         {
     223             :         protected:
     224           0 :             virtual ~OStatement(){}
     225             :         public:
     226             :             // A ctor that is needed for returning the object
     227           0 :             OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
     228             :             DECLARE_SERVICE_INFO();
     229             : 
     230             :             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
     231             :             virtual void SAL_CALL acquire() throw();
     232             :             virtual void SAL_CALL release() throw();
     233             :             // XBatchExecution
     234             :             virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     235             :             virtual void SAL_CALL clearBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     236             :             virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     237             :         };
     238             :     }
     239             : }
     240             : #endif // _CONNECTIVITY_ODBC_OSTATEMENT_HXX_
     241             : 
     242             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10