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

Generated by: LCOV version 1.10