LCOV - code coverage report
Current view: top level - connectivity/source/commontools - TConnection.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 32 35 91.4 %
Date: 2014-11-03 Functions: 6 6 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             : 
      20             : #include <string.h>
      21             : #include "TConnection.hxx"
      22             : #include <cppuhelper/typeprovider.hxx>
      23             : #include <comphelper/types.hxx>
      24             : #include <comphelper/officeresourcebundle.hxx>
      25             : #include <connectivity/dbexception.hxx>
      26             : 
      27             : using namespace connectivity;
      28             : using namespace com::sun::star::uno;
      29             : using namespace com::sun::star::lang;
      30             : using namespace com::sun::star::sdbc;
      31             : using namespace com::sun::star::beans;
      32             : using namespace ::osl;
      33             : 
      34             : 
      35          72 : OMetaConnection::OMetaConnection()
      36             :     : OMetaConnection_BASE(m_aMutex)
      37          72 :     , m_nTextEncoding(RTL_TEXTENCODING_MS_1252)
      38             : {
      39          72 : }
      40             : 
      41          64 : void OMetaConnection::disposing()
      42             : {
      43          64 :     ::osl::MutexGuard aGuard(m_aMutex);
      44          64 :     m_xMetaData = WeakReference< XDatabaseMetaData>();
      45         176 :     for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
      46             :     {
      47             :         try
      48             :         {
      49         112 :             Reference< XInterface > xStatement( i->get() );
      50         112 :             ::comphelper::disposeComponent( xStatement );
      51             :         }
      52           0 :         catch (const DisposedException&)
      53             :         {
      54             :         }
      55             :     }
      56          64 :     m_aStatements.clear();
      57          64 : }
      58             : //XUnoTunnel
      59           6 : sal_Int64 SAL_CALL OMetaConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException, std::exception)
      60             : {
      61          24 :     return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
      62             :         ? reinterpret_cast< sal_Int64 >( this )
      63          22 :         : (sal_Int64)0;
      64             : }
      65             : 
      66          10 : Sequence< sal_Int8 > OMetaConnection::getUnoTunnelImplementationId()
      67             : {
      68             :     static ::cppu::OImplementationId * pId = 0;
      69          10 :     if (! pId)
      70             :     {
      71           4 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      72           4 :         if (! pId)
      73             :         {
      74           4 :             static ::cppu::OImplementationId aId;
      75           4 :             pId = &aId;
      76           4 :         }
      77             :     }
      78          10 :     return pId->getImplementationId();
      79             : }
      80             : 
      81      153944 : ::dbtools::OPropertyMap& OMetaConnection::getPropMap()
      82             : {
      83      153944 :     static ::dbtools::OPropertyMap s_aPropertyNameMap;
      84      153944 :     return s_aPropertyNameMap;
      85             : }
      86             : 
      87          44 : void OMetaConnection::throwGenericSQLException( sal_uInt16 _nErrorResourceId,const Reference< XInterface>& _xContext )
      88             : {
      89          44 :     OUString sErrorMessage;
      90          44 :     if ( _nErrorResourceId )
      91          44 :         sErrorMessage = m_aResources.getResourceString( _nErrorResourceId );
      92          88 :     Reference< XInterface> xContext = _xContext;
      93          44 :     if ( !xContext.is() )
      94           0 :         xContext = *this;
      95          88 :     ::dbtools::throwGenericSQLException( sErrorMessage, xContext);
      96           0 : }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10