LCOV - code coverage report
Current view: top level - connectivity/source/inc/odbc - OConnection.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 7 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 7 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             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
      20             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
      21             : 
      22             : #include <com/sun/star/sdbc/SQLWarning.hpp>
      23             : #include <com/sun/star/beans/PropertyValue.hpp>
      24             : #include <connectivity/odbc.hxx>
      25             : #include "odbc/odbcbasedllapi.hxx"
      26             : #include <connectivity/OSubComponent.hxx>
      27             : #include <connectivity/CommonTools.hxx>
      28             : #include "TConnection.hxx"
      29             : #include "OTypeInfo.hxx"
      30             : #include "OTools.hxx"
      31             : #include <cppuhelper/weakref.hxx>
      32             : #include "AutoRetrievingBase.hxx"
      33             : #include <osl/module.h>
      34             : 
      35             : 
      36             : #include <map>
      37             : 
      38             : namespace connectivity
      39             : {
      40             :     namespace odbc
      41             :     {
      42             :         class ODBCDriver;
      43             : 
      44             :         typedef connectivity::OMetaConnection OConnection_BASE;
      45             :         typedef ::std::vector< ::connectivity::OTypeInfo>   TTypeInfoVector;
      46             : 
      47             :         class OOO_DLLPUBLIC_ODBCBASE OConnection :
      48             :                             public OConnection_BASE,
      49             :                             public connectivity::OSubComponent<OConnection, OConnection_BASE>,
      50             :                             public OAutoRetrievingBase
      51             :         {
      52             :             friend class connectivity::OSubComponent<OConnection, OConnection_BASE>;
      53             : 
      54             :         protected:
      55             : 
      56             :             // Data attributes
      57             : 
      58             :             ::std::map< SQLHANDLE,OConnection*> m_aConnections; // holds all connectionas which are need for serveral statements
      59             :             TTypeInfoVector                     m_aTypeInfo;    //  vector containing an entry
      60             :                                                         //  for each row returned by
      61             :                                                         //  DatabaseMetaData.getTypeInfo.
      62             : 
      63             : 
      64             :             ::com::sun::star::sdbc::SQLWarning  m_aLastWarning; //  Last SQLWarning generated by
      65             :                                                                 //  an operation
      66             :             OUString        m_sUser;        //  the user name
      67             :             ODBCDriver*     m_pDriver;      //  Pointer to the owning
      68             :                                             //  driver object
      69             : 
      70             :             SQLHANDLE       m_aConnectionHandle;
      71             :             SQLHANDLE       m_pDriverHandleCopy;    // performance reason
      72             :             sal_Int32       m_nStatementCount;
      73             :             bool            m_bClosed;
      74             :             bool            m_bUseCatalog;  // should we use the catalog on filebased databases
      75             :             bool            m_bUseOldDateFormat;
      76             :             bool            m_bParameterSubstitution;
      77             :             bool            m_bIgnoreDriverPrivileges;
      78             :             bool            m_bPreventGetVersionColumns;    // #i60273#
      79             :             bool            m_bReadOnly;
      80             : 
      81             : 
      82             :             SQLRETURN       OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent);
      83             : 
      84             :             OConnection*    cloneConnection(); // creates a new connection
      85             : 
      86             :         public:
      87             :             oslGenericFunction  getOdbcFunction(ODBC3SQLFunctionId _nIndex)  const;
      88             :             SQLRETURN       Construct( const OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException);
      89             : 
      90             :             OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver*  _pDriver);
      91             :             //  OConnection(const SQLHANDLE _pConnectionHandle);
      92             :             virtual ~OConnection();
      93             : 
      94             :             void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException);
      95             : 
      96             :             // OComponentHelper
      97             :             virtual void SAL_CALL disposing() SAL_OVERRIDE;
      98             :             // XInterface
      99             :             virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     100             : 
     101             :             // XServiceInfo
     102             :             DECLARE_SERVICE_INFO();
     103             :             // XConnection
     104             :             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;
     105             :             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;
     106             :             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;
     107             :             virtual OUString SAL_CALL nativeSQL( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :             virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :             virtual sal_Bool SAL_CALL getAutoCommit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             :             virtual void SAL_CALL commit(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :             virtual void SAL_CALL rollback(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :             virtual sal_Bool SAL_CALL isClosed(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :             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;
     114             :             virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :             virtual sal_Bool SAL_CALL isReadOnly(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :             virtual void SAL_CALL setCatalog( const OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             :             virtual OUString SAL_CALL getCatalog(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             :             virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :             virtual sal_Int32 SAL_CALL getTransactionIsolation(  ) 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::container::XNameAccess > SAL_CALL getTypeMap(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :             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;
     122             :             // XCloseable
     123             :             virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :             // XWarningsSupplier
     125             :             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :             virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             : 
     128           0 :             SQLHANDLE       getConnection() { return m_aConnectionHandle; }
     129             : 
     130             :             // should we use the catalog on filebased databases
     131           0 :             inline bool     isCatalogUsed()                     const { return m_bUseCatalog; }
     132           0 :             inline bool     isParameterSubstitutionEnabled()    const { return m_bParameterSubstitution; }
     133           0 :             inline bool     isIgnoreDriverPrivilegesEnabled()   const { return m_bIgnoreDriverPrivileges; }
     134           0 :             inline bool     preventGetVersionColumns()          const { return m_bPreventGetVersionColumns; }
     135           0 :             inline bool     useOldDateFormat()                  const { return m_bUseOldDateFormat; }
     136             :             inline SQLHANDLE        getDriverHandle()               const { return m_pDriverHandleCopy;}
     137           0 :             inline ODBCDriver*      getDriver()                     const { return m_pDriver;}
     138             :             inline OUString getUserName()                    const { return m_sUser; }
     139             : 
     140             :             SQLHANDLE       createStatementHandle();
     141             :             // close and free the handle and set it to SQL_NULLHANDLE
     142             :             void            freeStatementHandle(SQLHANDLE& _pHandle);
     143             : 
     144             :             const TTypeInfoVector&  getTypeInfo() const { return m_aTypeInfo; }
     145             :         };
     146             :     }
     147             : }
     148             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_OCONNECTION_HXX
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11