LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/cpool - ZConnectionWrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 105 0.0 %
Date: 2012-12-27 Functions: 0 31 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             : #include "ZConnectionWrapper.hxx"
      21             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      22             : #include <com/sun/star/sdbc/XRow.hpp>
      23             : #include <com/sun/star/lang/DisposedException.hpp>
      24             : #include <comphelper/extract.hxx>
      25             : #include <cppuhelper/typeprovider.hxx>
      26             : #include <comphelper/sequence.hxx>
      27             : 
      28             : using namespace connectivity;
      29             : //------------------------------------------------------------------------------
      30             : using namespace com::sun::star::uno;
      31             : using namespace com::sun::star::lang;
      32             : using namespace com::sun::star::beans;
      33             : using namespace com::sun::star::sdbc;
      34             : // --------------------------------------------------------------------------------
      35           0 : OConnectionWeakWrapper::OConnectionWeakWrapper(Reference< XAggregation >& _xConnection)
      36           0 :     : OConnectionWeakWrapper_BASE(m_aMutex)
      37             : {
      38           0 :     setDelegation(_xConnection,m_refCount);
      39             :     OSL_ENSURE(m_xConnection.is(),"OConnectionWeakWrapper: Connection must be valid!");
      40           0 : }
      41             : //-----------------------------------------------------------------------------
      42           0 : OConnectionWeakWrapper::~OConnectionWeakWrapper()
      43             : {
      44           0 :     if ( !OConnectionWeakWrapper_BASE::rBHelper.bDisposed )
      45             :     {
      46           0 :         osl_atomic_increment( &m_refCount );
      47           0 :         dispose();
      48             :     }
      49           0 : }
      50             : // XServiceInfo
      51             : // --------------------------------------------------------------------------------
      52           0 : IMPLEMENT_SERVICE_INFO(OConnectionWeakWrapper, "com.sun.star.sdbc.drivers.OConnectionWeakWrapper", "com.sun.star.sdbc.Connection")
      53             : 
      54             : // --------------------------------------------------------------------------------
      55           0 : Reference< XStatement > SAL_CALL OConnectionWeakWrapper::createStatement(  ) throw(SQLException, RuntimeException)
      56             : {
      57           0 :     ::osl::MutexGuard aGuard( m_aMutex );
      58           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
      59             : 
      60             : 
      61           0 :     return m_xConnection->createStatement();
      62             : }
      63             : // --------------------------------------------------------------------------------
      64           0 : Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
      65             : {
      66           0 :     ::osl::MutexGuard aGuard( m_aMutex );
      67           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
      68             : 
      69             : 
      70           0 :     return m_xConnection->prepareStatement(sql);
      71             : }
      72             : // --------------------------------------------------------------------------------
      73           0 : Reference< XPreparedStatement > SAL_CALL OConnectionWeakWrapper::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
      74             : {
      75           0 :     ::osl::MutexGuard aGuard( m_aMutex );
      76           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
      77             : 
      78             : 
      79           0 :     return m_xConnection->prepareCall(sql);
      80             : }
      81             : // --------------------------------------------------------------------------------
      82           0 : ::rtl::OUString SAL_CALL OConnectionWeakWrapper::nativeSQL( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
      83             : {
      84           0 :     ::osl::MutexGuard aGuard( m_aMutex );
      85           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
      86             : 
      87             : 
      88           0 :     return m_xConnection->nativeSQL(sql);
      89             : }
      90             : // --------------------------------------------------------------------------------
      91           0 : void SAL_CALL OConnectionWeakWrapper::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
      92             : {
      93           0 :     ::osl::MutexGuard aGuard( m_aMutex );
      94           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
      95             : 
      96           0 :     m_xConnection->setAutoCommit(autoCommit);
      97           0 : }
      98             : // --------------------------------------------------------------------------------
      99           0 : sal_Bool SAL_CALL OConnectionWeakWrapper::getAutoCommit(  ) throw(SQLException, RuntimeException)
     100             : {
     101           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     102           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     103             : 
     104             : 
     105           0 :     return m_xConnection->getAutoCommit();
     106             : }
     107             : // --------------------------------------------------------------------------------
     108           0 : void SAL_CALL OConnectionWeakWrapper::commit(  ) throw(SQLException, RuntimeException)
     109             : {
     110           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     111           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     112             : 
     113             : 
     114           0 :     m_xConnection->commit();
     115           0 : }
     116             : // --------------------------------------------------------------------------------
     117           0 : void SAL_CALL OConnectionWeakWrapper::rollback(  ) throw(SQLException, RuntimeException)
     118             : {
     119           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     120           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     121             : 
     122             : 
     123           0 :     m_xConnection->rollback();
     124           0 : }
     125             : // --------------------------------------------------------------------------------
     126           0 : sal_Bool SAL_CALL OConnectionWeakWrapper::isClosed(  ) throw(SQLException, RuntimeException)
     127             : {
     128           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     129             : 
     130           0 :     return m_xConnection->isClosed();
     131             : }
     132             : // --------------------------------------------------------------------------------
     133           0 : Reference< XDatabaseMetaData > SAL_CALL OConnectionWeakWrapper::getMetaData(  ) throw(SQLException, RuntimeException)
     134             : {
     135           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     136           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     137             : 
     138             : 
     139           0 :     return m_xConnection->getMetaData();
     140             : }
     141             : // --------------------------------------------------------------------------------
     142           0 : void SAL_CALL OConnectionWeakWrapper::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
     143             : {
     144           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     145           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     146             : 
     147             : 
     148           0 :     m_xConnection->setReadOnly(readOnly);
     149           0 : }
     150             : // --------------------------------------------------------------------------------
     151           0 : sal_Bool SAL_CALL OConnectionWeakWrapper::isReadOnly(  ) throw(SQLException, RuntimeException)
     152             : {
     153           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     154           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     155             : 
     156             : 
     157           0 :     return m_xConnection->isReadOnly();
     158             : }
     159             : // --------------------------------------------------------------------------------
     160           0 : void SAL_CALL OConnectionWeakWrapper::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
     161             : {
     162           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     163           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     164             : 
     165             : 
     166           0 :     m_xConnection->setCatalog(catalog);
     167           0 : }
     168             : // --------------------------------------------------------------------------------
     169           0 : ::rtl::OUString SAL_CALL OConnectionWeakWrapper::getCatalog(  ) throw(SQLException, RuntimeException)
     170             : {
     171           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     172           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     173             : 
     174             : 
     175           0 :     return m_xConnection->getCatalog();
     176             : }
     177             : // --------------------------------------------------------------------------------
     178           0 : void SAL_CALL OConnectionWeakWrapper::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
     179             : {
     180           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     181           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     182             : 
     183             : 
     184           0 :     m_xConnection->setTransactionIsolation(level);
     185           0 : }
     186             : // --------------------------------------------------------------------------------
     187           0 : sal_Int32 SAL_CALL OConnectionWeakWrapper::getTransactionIsolation(  ) throw(SQLException, RuntimeException)
     188             : {
     189           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     190           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     191             : 
     192             : 
     193           0 :     return m_xConnection->getTransactionIsolation();
     194             : }
     195             : // --------------------------------------------------------------------------------
     196           0 : Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnectionWeakWrapper::getTypeMap(  ) throw(SQLException, RuntimeException)
     197             : {
     198           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     199           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     200             : 
     201             : 
     202           0 :     return m_xConnection->getTypeMap();
     203             : }
     204             : // --------------------------------------------------------------------------------
     205           0 : void SAL_CALL OConnectionWeakWrapper::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException)
     206             : {
     207           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     208           0 :     checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     209             : 
     210             : 
     211           0 :     m_xConnection->setTypeMap(typeMap);
     212           0 : }
     213             : // --------------------------------------------------------------------------------
     214             : // XCloseable
     215           0 : void SAL_CALL OConnectionWeakWrapper::close(  ) throw(SQLException, RuntimeException)
     216             : {
     217             :     {
     218           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     219           0 :         checkDisposed(OConnectionWeakWrapper_BASE::rBHelper.bDisposed);
     220             : 
     221             :     }
     222           0 :     dispose();
     223           0 : }
     224             : //------------------------------------------------------------------------------
     225           0 : void OConnectionWeakWrapper::disposing()
     226             : {
     227           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     228             : 
     229           0 :     OConnectionWeakWrapper_BASE::disposing();
     230           0 :     OConnectionWrapper::disposing();
     231           0 : }
     232             : // -----------------------------------------------------------------------------
     233             : // com::sun::star::lang::XUnoTunnel
     234             : #ifdef N_DEBUG
     235             : IMPLEMENT_FORWARD_XINTERFACE2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
     236             : #else
     237           0 : IMPLEMENT_FORWARD_REFCOUNT( OConnectionWeakWrapper, OConnectionWeakWrapper_BASE ) \
     238           0 : ::com::sun::star::uno::Any SAL_CALL OConnectionWeakWrapper::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
     239             : { \
     240           0 :     ::com::sun::star::uno::Any aReturn = OConnectionWeakWrapper_BASE::queryInterface( _rType ); \
     241           0 :     if ( !aReturn.hasValue() ) \
     242           0 :         aReturn = OConnectionWrapper::queryInterface( _rType ); \
     243           0 :     return aReturn; \
     244             : }
     245             : #endif
     246           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2(OConnectionWeakWrapper,OConnectionWeakWrapper_BASE,OConnectionWrapper)
     247             : 
     248             : 
     249             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10