LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/connectivity/source/drivers/dbase - DConnection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 35 39 89.7 %
Date: 2013-07-09 Functions: 7 11 63.6 %
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             : 
      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          29 : ODbaseConnection::ODbaseConnection(ODriver* _pDriver) : OConnection(_pDriver)
      46             : {
      47             :     DBG_CTOR(ODbaseConnection,NULL);
      48          29 :     m_aFilenameExtension = OUString("dbf");
      49          29 : }
      50             : //-----------------------------------------------------------------------------
      51          58 : ODbaseConnection::~ODbaseConnection()
      52             : {
      53             :     DBG_DTOR(ODbaseConnection,NULL);
      54          58 : }
      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        2667 : Reference< XDatabaseMetaData > SAL_CALL ODbaseConnection::getMetaData(  ) throw(SQLException, RuntimeException)
      62             : {
      63        2667 :     ::osl::MutexGuard aGuard( m_aMutex );
      64        2667 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
      65             : 
      66             : 
      67        2667 :     Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
      68        2667 :     if(!xMetaData.is())
      69             :     {
      70          29 :         xMetaData = new ODbaseDatabaseMetaData(this);
      71          29 :         m_xMetaData = xMetaData;
      72             :     }
      73             : 
      74        2667 :     return xMetaData;
      75             : }
      76             : //------------------------------------------------------------------------------
      77          97 : ::com::sun::star::uno::Reference< XTablesSupplier > ODbaseConnection::createCatalog()
      78             : {
      79          97 :     ::osl::MutexGuard aGuard( m_aMutex );
      80          97 :     Reference< XTablesSupplier > xTab = m_xCatalog;
      81          97 :     if(!xTab.is())
      82             :     {
      83          29 :         ODbaseCatalog *pCat = new ODbaseCatalog(this);
      84          29 :         xTab = pCat;
      85          29 :         m_xCatalog = xTab;
      86             :     }
      87          97 :     return xTab;
      88             : }
      89             : // --------------------------------------------------------------------------------
      90          11 : Reference< XStatement > SAL_CALL ODbaseConnection::createStatement(  ) throw(SQLException, RuntimeException)
      91             : {
      92          11 :     ::osl::MutexGuard aGuard( m_aMutex );
      93          11 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
      94             : 
      95             : 
      96          11 :     Reference< XStatement > xReturn = new ODbaseStatement(this);
      97          11 :     m_aStatements.push_back(WeakReferenceHelper(xReturn));
      98          11 :     return xReturn;
      99             : }
     100             : // --------------------------------------------------------------------------------
     101          57 : Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareStatement( const OUString& sql ) throw(SQLException, RuntimeException)
     102             : {
     103          57 :     ::osl::MutexGuard aGuard( m_aMutex );
     104          57 :     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
     105             : 
     106             : 
     107          57 :     ODbasePreparedStatement* pStmt = new ODbasePreparedStatement(this);
     108         114 :     Reference< XPreparedStatement > xHoldAlive = pStmt;
     109          57 :     pStmt->construct(sql);
     110          46 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
     111         103 :     return pStmt;
     112             : }
     113             : // --------------------------------------------------------------------------------
     114           0 : Reference< XPreparedStatement > SAL_CALL ODbaseConnection::prepareCall( const 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