LCOV - code coverage report
Current view: top level - connectivity/source/drivers/dbase - DConnection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 35 39 89.7 %
Date: 2012-08-25 Functions: 7 11 63.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 44 96 45.8 %

           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                 :            : 
      21                 :            : #include "dbase/DConnection.hxx"
      22                 :            : #include "dbase/DDatabaseMetaData.hxx"
      23                 :            : #include "dbase/DCatalog.hxx"
      24                 :            : #include "dbase/DDriver.hxx"
      25                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      26                 :            : #include "dbase/DPreparedStatement.hxx"
      27                 :            : #include "dbase/DStatement.hxx"
      28                 :            : #include <tools/debug.hxx>
      29                 :            : #include <connectivity/dbexception.hxx>
      30                 :            : 
      31                 :            : using namespace connectivity::dbase;
      32                 :            : using namespace connectivity::file;
      33                 :            : 
      34                 :            : typedef connectivity::file::OConnection  OConnection_BASE;
      35                 :            : 
      36                 :            : //------------------------------------------------------------------------------
      37                 :            : using namespace ::com::sun::star::uno;
      38                 :            : using namespace ::com::sun::star::beans;
      39                 :            : using namespace ::com::sun::star::sdbcx;
      40                 :            : using namespace ::com::sun::star::sdbc;
      41                 :            : using namespace ::com::sun::star::lang;
      42                 :            : 
      43                 :            : DBG_NAME(ODbaseConnection)
      44                 :            : // --------------------------------------------------------------------------------
      45                 :         56 : ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
      46                 :            : {
      47                 :            :     DBG_CTOR(ODbaseConnection,NULL);
      48         [ +  - ]:         56 :     m_aFilenameExtension = rtl::OUString("dbf");
      49                 :         56 : }
      50                 :            : //-----------------------------------------------------------------------------
      51                 :         56 : ODbaseConnection::~ODbaseConnection()
      52                 :            : {
      53                 :            :     DBG_DTOR(ODbaseConnection,NULL);
      54         [ -  + ]:        112 : }
      55                 :            : 
      56                 :            : // XServiceInfo
      57                 :            : // --------------------------------------------------------------------------------
      58 [ #  # ][ #  # ]:          0 : IMPLEMENT_SERVICE_INFO(ODbaseConnection, "com.sun.star.sdbc.drivers.dbase.Connection", "com.sun.star.sdbc.Connection")
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      59                 :            : 
      60                 :            : // --------------------------------------------------------------------------------
      61                 :       5234 : Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData(  ) throw(SQLException, RuntimeException)
      62                 :            : {
      63         [ +  - ]:       5234 :     ::osl::MutexGuard aGuard( m_aMutex );
      64         [ +  - ]:       5234 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
      65                 :            : 
      66                 :            : 
      67         [ +  - ]:       5234 :     Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
      68         [ +  + ]:       5234 :     if(!xMetaData.is())
      69                 :            :     {
      70 [ +  - ][ +  - ]:         56 :         xMetaData = new ODbaseDatabaseMetaData(this);
                 [ +  - ]
      71         [ +  - ]:         56 :         m_xMetaData = xMetaData;
      72                 :            :     }
      73                 :            : 
      74         [ +  - ]:       5234 :     return xMetaData;
      75                 :            : }
      76                 :            : //------------------------------------------------------------------------------
      77                 :        188 : ::com::sun::star::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
      78                 :            : {
      79         [ +  - ]:        188 :     ::osl::MutexGuard aGuard( m_aMutex );
      80         [ +  - ]:        188 :     Reference< XTablesSupplier > xTab = m_xCatalog;
      81         [ +  + ]:        188 :     if(!xTab.is())
      82                 :            :     {
      83         [ +  - ]:         56 :         ODbaseCatalog *pCat = new ODbaseCatalog(this);
      84 [ +  - ][ +  - ]:         56 :         xTab = pCat;
      85         [ +  - ]:         56 :         m_xCatalog = xTab;
      86                 :            :     }
      87         [ +  - ]:        188 :     return xTab;
      88                 :            : }
      89                 :            : // --------------------------------------------------------------------------------
      90                 :         22 : Reference< XStatement > SAL_CALL ODbaseConnection::createStatement(  ) throw(SQLException, RuntimeException)
      91                 :            : {
      92         [ +  - ]:         22 :     ::osl::MutexGuard aGuard( m_aMutex );
      93         [ +  - ]:         22 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
      94                 :            : 
      95                 :            : 
      96 [ +  - ][ +  - ]:         22 :     Reference< XStatement > xReturn = new ODbaseStatement(this);
                 [ +  - ]
      97 [ +  - ][ +  - ]:         22 :     m_aStatements.push_back(WeakReferenceHelper(xReturn));
                 [ +  - ]
      98         [ +  - ]:         22 :     return xReturn;
      99                 :            : }
     100                 :            : // --------------------------------------------------------------------------------
     101                 :        110 : Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
     102                 :            : {
     103         [ +  - ]:        110 :     ::osl::MutexGuard aGuard( m_aMutex );
     104         [ +  - ]:        110 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     105                 :            : 
     106                 :            : 
     107         [ +  - ]:        110 :     ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this);
     108 [ +  - ][ +  - ]:        110 :     Reference< XPreparedStatement > xHoldAlive = pStmt;
     109         [ +  + ]:        110 :     pStmt->construct(sql);
     110 [ +  - ][ +  - ]:         88 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
         [ +  - ][ +  - ]
     111 [ +  - ][ +  - ]:        110 :     return pStmt;
                 [ +  - ]
     112                 :            : }
     113                 :            : // --------------------------------------------------------------------------------
     114                 :          0 : Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
     115                 :            : {
     116         [ #  # ]:          0 :     ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
     117                 :          0 :     return NULL;
     118                 :            : }
     119                 :            : // -----------------------------------------------------------------------------
     120                 :            : 
     121                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10