LCOV - code coverage report
Current view: top level - connectivity/source/inc/java/sql - Connection.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 7 100.0 %
Date: 2014-11-03 Functions: 7 7 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_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
      20             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
      21             : 
      22             : #include "java/lang/Object.hxx"
      23             : #include "TConnection.hxx"
      24             : #include <connectivity/CommonTools.hxx>
      25             : #include <connectivity/OSubComponent.hxx>
      26             : #include <cppuhelper/weakref.hxx>
      27             : #include "AutoRetrievingBase.hxx"
      28             : #include "java/sql/ConnectionLog.hxx"
      29             : #include "java/LocalRef.hxx"
      30             : #include "java/GlobalRef.hxx"
      31             : 
      32             : #include <com/sun/star/beans/NamedValue.hpp>
      33             : 
      34             : namespace connectivity
      35             : {
      36             :     class java_sql_Driver;
      37             : 
      38             :     typedef OMetaConnection     java_sql_Connection_BASE;
      39             : 
      40             :     class java_sql_Connection : public java_sql_Connection_BASE,
      41             :                                 public java_lang_Object,
      42             :                                 public OSubComponent<java_sql_Connection, java_sql_Connection_BASE>,
      43             :                                 public OAutoRetrievingBase
      44             :     {
      45             :         friend class OSubComponent<java_sql_Connection, java_sql_Connection_BASE>;
      46             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
      47             :         const java_sql_Driver*  m_pDriver;
      48             :         jobject                 m_pDriverobject;
      49             :         jdbc::GlobalRef< jobject >
      50             :                                 m_pDriverClassLoader;
      51             : 
      52             :         jclass                  m_Driver_theClass;
      53             :         java::sql::ConnectionLog
      54             :                                 m_aLogger;
      55             :         bool                m_bParameterSubstitution;
      56             :         bool                m_bIgnoreDriverPrivileges;
      57             :         bool                m_bIgnoreCurrency;
      58             :         ::com::sun::star::uno::Any  m_aCatalogRestriction;
      59             :         ::com::sun::star::uno::Any  m_aSchemaRestriction;
      60             : 
      61             :         /** transform named parameter into unnamed one.
      62             :             @param  _sSQL
      63             :                 The SQL statement to transform.
      64             :             @return
      65             :                 The new statement with unnamed parameters.
      66             :         */
      67             :         OUString transFormPreparedStatement(const OUString& _sSQL);
      68             :         void loadDriverFromProperties(
      69             :                 const OUString& _sDriverClass,
      70             :                 const OUString& _sDriverClassPath,
      71             :                 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSystemProperties
      72             :             );
      73             :         /** load driver class path from system configuration.
      74             :             @param  _sDriverClass
      75             :                 The driver class name to look for in the configuration.
      76             :         */
      77             :         OUString impl_getJavaDriverClassPath_nothrow(const OUString& _sDriverClass);
      78             : 
      79             :     protected:
      80             :     // Static data for the class
      81             :         static jclass theClass;
      82             : 
      83             :         virtual ~java_sql_Connection();
      84             : 
      85             :     public:
      86             :         virtual jclass getMyClass() const SAL_OVERRIDE;
      87             : 
      88             :         DECLARE_SERVICE_INFO();
      89             :         // A ctor that is needed for returning the object
      90             :         java_sql_Connection( const java_sql_Driver& _rDriver );
      91             :         bool construct( const OUString& url,
      92             :                         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info);
      93             : 
      94             :         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&
      95           4 :             getConnectionInfo() const { return m_aConnectionInfo; }
      96             : 
      97           2 :         inline  bool isIgnoreDriverPrivilegesEnabled() const { return   m_bIgnoreDriverPrivileges;}
      98           6 :         inline  bool isIgnoreCurrencyEnabled() const { return   m_bIgnoreCurrency; }
      99           8 :         inline const ::com::sun::star::uno::Any& getCatalogRestriction() const { return m_aCatalogRestriction; }
     100           4 :         inline const ::com::sun::star::uno::Any& getSchemaRestriction() const { return m_aSchemaRestriction; }
     101             : 
     102             :         /** returns the instance used for logging events related to this connection
     103             :         */
     104          18 :         const java::sql::ConnectionLog& getLogger() const { return m_aLogger; }
     105             : 
     106             :         /** returns the class loader which was used to load the driver class
     107             : 
     108             :             Usually used in conjunction with a ContextClassLoaderScope instance.
     109             :         */
     110          16 :         const jdbc::GlobalRef< jobject >& getDriverClassLoader() const { return m_pDriverClassLoader; }
     111             : 
     112             :         // OComponentHelper
     113             :         virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
     114             :         // XInterface
     115             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     116             : 
     117             :         // XConnection
     118             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :         virtual OUString SAL_CALL nativeSQL( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             :         virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             :         virtual sal_Bool SAL_CALL getAutoCommit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :         virtual void SAL_CALL commit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             :         virtual void SAL_CALL rollback(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :         virtual sal_Bool SAL_CALL isClosed(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :         virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             :         virtual sal_Bool SAL_CALL isReadOnly(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :         virtual void SAL_CALL setCatalog( const OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131             :         virtual OUString SAL_CALL getCatalog(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             :         virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     133             :         virtual sal_Int32 SAL_CALL getTransactionIsolation(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             :         virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :         // XCloseable
     137             :         virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             :         // XWarningsSupplier
     139             :         virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :         virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :     };
     142             : }
     143             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_JAVA_SQL_CONNECTION_HXX
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10