LCOV - code coverage report
Current view: top level - connectivity/source/inc/java/sql - JStatement.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
      20             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
      21             : 
      22             : #include "java/lang/Object.hxx"
      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/util/XCancellable.hpp>
      29             : #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
      30             : #include <comphelper/proparrhlp.hxx>
      31             : #include <cppuhelper/compbase6.hxx>
      32             : #include <comphelper/uno3.hxx>
      33             : #include <connectivity/CommonTools.hxx>
      34             : #include <connectivity/OSubComponent.hxx>
      35             : #include <com/sun/star/lang/XServiceInfo.hpp>
      36             : #include <comphelper/broadcasthelper.hxx>
      37             : 
      38             : #include <java/sql/Connection.hxx>
      39             : #include "java/sql/ConnectionLog.hxx"
      40             : 
      41             : namespace connectivity
      42             : {
      43             : 
      44             :         typedef ::cppu::WeakComponentImplHelper6<       ::com::sun::star::sdbc::XStatement,
      45             :                                                         ::com::sun::star::sdbc::XWarningsSupplier,
      46             :                                                         ::com::sun::star::util::XCancellable,
      47             :                                                         ::com::sun::star::sdbc::XCloseable,
      48             :                                                         ::com::sun::star::sdbc::XGeneratedResultSet,
      49             :                                                         ::com::sun::star::sdbc::XMultipleResults> java_sql_Statement_BASE;
      50             : 
      51             :     //************ Class: java.sql.Statement
      52             : 
      53             :     class java_sql_Statement_Base : public comphelper::OBaseMutex,
      54             :                                     public  java_sql_Statement_BASE,
      55             :                                     public  java_lang_Object,
      56             :                                     public  ::cppu::OPropertySetHelper,
      57             :                                     public  ::comphelper::OPropertyArrayUsageHelper<java_sql_Statement_Base>
      58             : 
      59             :     {
      60             : 
      61             :         sal_Int32 getQueryTimeOut()             throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      62             :         sal_Int32 getMaxFieldSize()             throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      63             :         sal_Int32 getMaxRows()                  throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      64             :         sal_Int32 getResultSetConcurrency()     throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      65             :         sal_Int32 getResultSetType()            throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      66             :         sal_Int32 getFetchDirection()           throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      67             :         sal_Int32 getFetchSize()                throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      68             :         OUString getCursorName()         throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      69             : 
      70             :         void setQueryTimeOut(sal_Int32 _par0)                   throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      71             :         void setMaxFieldSize(sal_Int32 _par0)                   throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      72             :         void setMaxRows(sal_Int32 _par0)                                throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      73             :         void setResultSetConcurrency(sal_Int32 _par0)   throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      74             :         void setResultSetType(sal_Int32 _par0)                  throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      75             :         void setFetchDirection(sal_Int32 _par0)                 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      76             :         void setFetchSize(sal_Int32 _par0)                              throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      77             :         void setCursorName(const OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      78             :         void setEscapeProcessing(bool _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      79             : 
      80             :     protected:
      81             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement>       m_xGeneratedStatement;
      82             :         java_sql_Connection*        m_pConnection;
      83             :         java::sql::ConnectionLog    m_aLogger;
      84             :         OUString             m_sSqlStatement;
      85             :         // Properties
      86             :         sal_Int32                   m_nResultSetConcurrency;
      87             :         sal_Int32                   m_nResultSetType;
      88             :         bool                    m_bEscapeProcessing;
      89             :         ::cppu::OBroadcastHelper&   rBHelper;
      90             : 
      91             : 
      92             :     // Static data for the class
      93             :         static jclass theClass;
      94             : 
      95             :         // OPropertyArrayUsageHelper
      96             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
      97             :         // OPropertySetHelper
      98             :         virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
      99             : 
     100             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(
     101             :                                     ::com::sun::star::uno::Any & rConvertedValue,
     102             :                                     ::com::sun::star::uno::Any & rOldValue,
     103             :                                     sal_Int32 nHandle,
     104             :                                     const ::com::sun::star::uno::Any& rValue
     105             :                                 )   throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
     106             : 
     107             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     108             :                                     sal_Int32 nHandle,
     109             :                                     const ::com::sun::star::uno::Any& rValue
     110             :                                 )   throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     111             : 
     112             :         virtual void SAL_CALL getFastPropertyValue(
     113             :                                     ::com::sun::star::uno::Any& rValue,
     114             :                                     sal_Int32 nHandle
     115             :                                 ) const SAL_OVERRIDE;
     116             : 
     117             :         virtual void createStatement(JNIEnv* _pEnv) = 0;
     118             : 
     119             :         virtual ~java_sql_Statement_Base();
     120             : 
     121             :         sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID);
     122             :         sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault);
     123             : 
     124             :     public:
     125             :         virtual jclass getMyClass() const SAL_OVERRIDE;
     126             : 
     127             :         // A ctor that is needed for returning the object
     128             :         java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon );
     129             : 
     130         267 :         sal_Int32   getStatementObjectID() const { return m_aLogger.getObjectID(); }
     131             : 
     132             :         // OComponentHelper
     133             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
     134             :         // XInterface
     135             :         virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     136             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     137             :         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;
     138             :         //XTypeProvider
     139             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             : 
     141             :         // XPropertySet
     142             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     143             :         // XStatement
     144             :         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 ;
     145             :         virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     146             :         virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     147             :         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 ;
     148             :         // XWarningsSupplier
     149             :         virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             :         virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :         // XCancellable
     152             :         virtual void SAL_CALL cancel(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :         // XCloseable
     154             :         virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     155             :         // XMultipleResults
     156             :         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;
     157             :         virtual sal_Int32 SAL_CALL getUpdateCount(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             :         virtual sal_Bool SAL_CALL getMoreResults(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             :         //XGeneratedResultSet
     160             :         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;
     161             : 
     162             :     public:
     163             :         using ::cppu::OPropertySetHelper::getFastPropertyValue;
     164             :     };
     165             : 
     166         267 :     class OStatement_BASE2  :public java_sql_Statement_Base
     167             :                             ,public OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>
     168             : 
     169             :     {
     170             :         friend class OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>;
     171             :     public:
     172         267 :         OStatement_BASE2(JNIEnv * pEnv, java_sql_Connection& _rCon ) : java_sql_Statement_Base( pEnv, _rCon ),
     173         267 :                                 OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>(static_cast<cppu::OWeakObject*>(&_rCon), this){}
     174             : 
     175             :         // OComponentHelper
     176             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
     177             :         // XInterface
     178             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     179             :     };
     180             : 
     181             :     class java_sql_Statement :  public OStatement_BASE2,
     182             :                                 public ::com::sun::star::sdbc::XBatchExecution,
     183             :                                 public ::com::sun::star::lang::XServiceInfo
     184             :     {
     185             :     protected:
     186             :         // Static data for the class
     187             :         static jclass theClass;
     188             : 
     189             :         virtual void createStatement(JNIEnv* _pEnv) SAL_OVERRIDE;
     190             : 
     191             :         virtual ~java_sql_Statement();
     192             :     public:
     193             :         DECLARE_SERVICE_INFO();
     194             :         virtual jclass getMyClass() const SAL_OVERRIDE;
     195             : 
     196             :         // A ctor that is needed for returning the object
     197         212 :         java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){};
     198             : 
     199             :         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;
     200             :         virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     201             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     202             :         // XBatchExecution
     203             :         virtual void SAL_CALL addBatch( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             :         virtual void SAL_CALL clearBatch(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     205             :         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;
     206             :     };
     207             : }
     208             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_JSTATEMENT_HXX
     209             : 
     210             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11