LCOV - code coverage report
Current view: top level - connectivity/source/cpool - ZPooledConnection.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 20 0.0 %
Date: 2014-04-14 Functions: 0 4 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 "ZPooledConnection.hxx"
      21             : #include "ZConnectionWrapper.hxx"
      22             : #include "connectivity/ConnectionWrapper.hxx"
      23             : #include <com/sun/star/sdbc/XCloseable.hpp>
      24             : #include <comphelper/types.hxx>
      25             : #include <comphelper/uno3.hxx>
      26             : #include <cppuhelper/component.hxx>
      27             : #include <cppuhelper/compbase1.hxx>
      28             : 
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::lang;
      31             : using namespace ::com::sun::star::sdbc;
      32             : using namespace ::com::sun::star::container;
      33             : using namespace ::com::sun::star::reflection;
      34             : using namespace connectivity;
      35             : using namespace ::osl;
      36             : 
      37           0 : OPooledConnection::OPooledConnection(const Reference< XConnection >& _xConnection,
      38             :                                     const Reference< ::com::sun::star::reflection::XProxyFactory >& _rxProxyFactory)
      39             :     : OPooledConnection_Base(m_aMutex)
      40             :     ,m_xRealConnection(_xConnection)
      41           0 :     ,m_xProxyFactory(_rxProxyFactory)
      42             : {
      43             : 
      44           0 : }
      45             : 
      46             : // OComponentHelper
      47           0 : void SAL_CALL OPooledConnection::disposing(void)
      48             : {
      49           0 :     MutexGuard aGuard(m_aMutex);
      50           0 :     if (m_xComponent.is())
      51           0 :         m_xComponent->removeEventListener(this);
      52           0 : m_xComponent.clear();
      53           0 :     ::comphelper::disposeComponent(m_xRealConnection);
      54           0 : }
      55             : 
      56             : // XEventListener
      57           0 : void SAL_CALL OPooledConnection::disposing( const EventObject& /*Source*/ ) throw (RuntimeException, std::exception)
      58             : {
      59           0 : m_xComponent.clear();
      60           0 : }
      61             : 
      62             : //XPooledConnection
      63           0 : Reference< XConnection > OPooledConnection::getConnection()  throw(SQLException, RuntimeException, std::exception)
      64             : {
      65           0 :     if(!m_xComponent.is() && m_xRealConnection.is())
      66             :     {
      67           0 :         Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(m_xRealConnection.get());
      68           0 :         m_xComponent = new OConnectionWeakWrapper(xConProxy);
      69             :         // register as event listener for the new connection
      70           0 :         if (m_xComponent.is())
      71           0 :             m_xComponent->addEventListener(this);
      72             :     }
      73           0 :     return Reference< XConnection >(m_xComponent,UNO_QUERY);
      74             : }
      75             : 
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10