LCOV - code coverage report
Current view: top level - connectivity/source/commontools - TConnection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 35 60.0 %
Date: 2012-08-25 Functions: 4 6 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 80 31.2 %

           Branch data     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                 :         56 : OMetaConnection::OMetaConnection()
      36                 :            :     : OMetaConnection_BASE(m_aMutex)
      37 [ +  - ][ +  - ]:         56 :     , m_nTextEncoding(RTL_TEXTENCODING_MS_1252)
         [ +  - ][ +  - ]
                 [ +  - ]
      38                 :            : {
      39                 :         56 : }
      40                 :            : //------------------------------------------------------------------------------
      41                 :         56 : void OMetaConnection::disposing()
      42                 :            : {
      43         [ +  - ]:         56 :     ::osl::MutexGuard aGuard(m_aMutex);
      44 [ +  - ][ +  - ]:         56 :     m_xMetaData = WeakReference< XDatabaseMetaData>();
                 [ +  - ]
      45 [ +  - ][ +  - ]:        166 :     for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i)
                 [ +  + ]
      46                 :            :     {
      47                 :            :         try
      48                 :            :         {
      49 [ +  - ][ +  - ]:        110 :             Reference< XInterface > xStatement( i->get() );
      50 [ +  - ][ #  # ]:        110 :             ::comphelper::disposeComponent( xStatement );
      51                 :            :         }
      52         [ #  # ]:          0 :         catch (const DisposedException&)
      53                 :            :         {
      54                 :            :         }
      55                 :            :     }
      56         [ +  - ]:         56 :     m_aStatements.clear();
      57                 :         56 : }
      58                 :            : //XUnoTunnel
      59                 :          0 : sal_Int64 SAL_CALL OMetaConnection::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException)
      60                 :            : {
      61 [ #  # ][ #  # ]:          0 :     return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
                 [ #  # ]
      62                 :            :         ? reinterpret_cast< sal_Int64 >( this )
      63   [ #  #  #  # ]:          0 :         : (sal_Int64)0;
      64                 :            : }
      65                 :            : // -----------------------------------------------------------------------------
      66                 :          0 : Sequence< sal_Int8 > OMetaConnection::getUnoTunnelImplementationId()
      67                 :            : {
      68                 :            :     static ::cppu::OImplementationId * pId = 0;
      69         [ #  # ]:          0 :     if (! pId)
      70                 :            :     {
      71 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      72         [ #  # ]:          0 :         if (! pId)
      73                 :            :         {
      74 [ #  # ][ #  # ]:          0 :             static ::cppu::OImplementationId aId;
      75                 :          0 :             pId = &aId;
      76         [ #  # ]:          0 :         }
      77                 :            :     }
      78                 :          0 :     return pId->getImplementationId();
      79                 :            : }
      80                 :            : // -----------------------------------------------------------------------------
      81                 :     121828 : ::dbtools::OPropertyMap& OMetaConnection::getPropMap()
      82                 :            : {
      83 [ +  + ][ +  - ]:     121828 :     static ::dbtools::OPropertyMap s_aPropertyNameMap;
         [ +  - ][ #  # ]
      84                 :     121828 :     return s_aPropertyNameMap;
      85                 :            : }
      86                 :            : // -----------------------------------------------------------------------------
      87                 :         44 : void OMetaConnection::throwGenericSQLException( sal_uInt16 _nErrorResourceId,const Reference< XInterface>& _xContext )
      88                 :            : {
      89                 :         44 :     ::rtl::OUString sErrorMessage;
      90         [ +  - ]:         44 :     if ( _nErrorResourceId )
      91         [ +  - ]:         44 :         sErrorMessage = m_aResources.getResourceString( _nErrorResourceId );
      92                 :         44 :     Reference< XInterface> xContext = _xContext;
      93         [ -  + ]:         44 :     if ( !xContext.is() )
      94 [ #  # ][ #  # ]:          0 :         xContext = *this;
      95         [ -  + ]:         44 :     ::dbtools::throwGenericSQLException( sErrorMessage, xContext);
      96                 :          0 : }
      97                 :            : 
      98                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10