LCOV - code coverage report
Current view: top level - connectivity/source/drivers/flat - EConnection.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 71 0.0 %
Date: 2014-04-14 Functions: 0 12 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 "flat/EConnection.hxx"
      21             : #include "flat/EDatabaseMetaData.hxx"
      22             : #include "flat/ECatalog.hxx"
      23             : #include "flat/EDriver.hxx"
      24             : #include <com/sun/star/lang/DisposedException.hpp>
      25             : #include "flat/EPreparedStatement.hxx"
      26             : #include "flat/EStatement.hxx"
      27             : #include <comphelper/extract.hxx>
      28             : #include <connectivity/dbexception.hxx>
      29             : 
      30             : using namespace connectivity::flat;
      31             : using namespace connectivity::file;
      32             : 
      33             : typedef connectivity::file::OConnection  OConnection_B;
      34             : 
      35             : 
      36             : using namespace ::com::sun::star::uno;
      37             : using namespace ::com::sun::star::beans;
      38             : using namespace ::com::sun::star::sdbcx;
      39             : using namespace ::com::sun::star::sdbc;
      40             : using namespace ::com::sun::star::lang;
      41             : 
      42             : 
      43           0 : OFlatConnection::OFlatConnection(ODriver*   _pDriver) : OConnection(_pDriver)
      44             :     ,m_nMaxRowsToScan(50)
      45             :     ,m_bHeaderLine(sal_True)
      46             :     ,m_cFieldDelimiter(';')
      47             :     ,m_cStringDelimiter('"')
      48             :     ,m_cDecimalDelimiter(',')
      49           0 :     ,m_cThousandDelimiter('.')
      50             : {
      51           0 : }
      52             : 
      53           0 : OFlatConnection::~OFlatConnection()
      54             : {
      55           0 : }
      56             : 
      57             : // XServiceInfo
      58             : 
      59           0 : IMPLEMENT_SERVICE_INFO(OFlatConnection, "com.sun.star.sdbc.drivers.flat.Connection", "com.sun.star.sdbc.Connection")
      60             : 
      61             : 
      62           0 : void OFlatConnection::construct(const OUString& url,const Sequence< PropertyValue >& info)  throw(SQLException)
      63             : {
      64           0 :     osl_atomic_increment( &m_refCount );
      65             : 
      66           0 :     const PropertyValue *pBegin  = info.getConstArray();
      67           0 :     const PropertyValue *pEnd    = pBegin + info.getLength();
      68           0 :     for(;pBegin != pEnd;++pBegin)
      69             :     {
      70           0 :         if(pBegin->Name.equalsAscii("HeaderLine"))
      71           0 :             OSL_VERIFY( pBegin->Value >>= m_bHeaderLine );
      72           0 :         else if(pBegin->Name.equalsAscii("FieldDelimiter"))
      73             :         {
      74           0 :             OUString aVal;
      75           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      76           0 :             m_cFieldDelimiter = aVal.toChar();
      77             :         }
      78           0 :         else if(pBegin->Name.equalsAscii("StringDelimiter"))
      79             :         {
      80           0 :             OUString aVal;
      81           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      82           0 :             m_cStringDelimiter = aVal.toChar();
      83             :         }
      84           0 :         else if(pBegin->Name.equalsAscii("DecimalDelimiter"))
      85             :         {
      86           0 :             OUString aVal;
      87           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      88           0 :             m_cDecimalDelimiter = aVal.toChar();
      89             :         }
      90           0 :         else if(pBegin->Name.equalsAscii("ThousandDelimiter"))
      91             :         {
      92           0 :             OUString aVal;
      93           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      94           0 :             m_cThousandDelimiter = aVal.toChar();
      95             :         }
      96           0 :         else if ( pBegin->Name.equalsAscii("MaxRowScan") )
      97             :         {
      98           0 :             pBegin->Value >>= m_nMaxRowsToScan;
      99             :         }
     100             :     }
     101             : 
     102           0 :     osl_atomic_decrement( &m_refCount );
     103           0 :     OConnection::construct(url,info);
     104           0 :     m_bShowDeleted = sal_True; // we do not supported rows for this type
     105           0 : }
     106             : 
     107           0 : Reference< XDatabaseMetaData > SAL_CALL OFlatConnection::getMetaData(  ) throw(SQLException, RuntimeException, std::exception)
     108             : {
     109           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     110           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     111             : 
     112             : 
     113           0 :     Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
     114           0 :     if(!xMetaData.is())
     115             :     {
     116           0 :         xMetaData = new OFlatDatabaseMetaData(this);
     117           0 :         m_xMetaData = xMetaData;
     118             :     }
     119             : 
     120           0 :     return xMetaData;
     121             : }
     122             : 
     123           0 : ::com::sun::star::uno::Reference< XTablesSupplier > OFlatConnection::createCatalog()
     124             : {
     125           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     126           0 :     Reference< XTablesSupplier > xTab = m_xCatalog;
     127           0 :     if(!xTab.is())
     128             :     {
     129           0 :         OFlatCatalog *pCat = new OFlatCatalog(this);
     130           0 :         xTab = pCat;
     131           0 :         m_xCatalog = xTab;
     132             :     }
     133           0 :     return xTab;
     134             : }
     135             : 
     136           0 : Reference< XStatement > SAL_CALL OFlatConnection::createStatement(  ) throw(SQLException, RuntimeException, std::exception)
     137             : {
     138           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     139           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     140             : 
     141           0 :     OFlatStatement* pStmt = new OFlatStatement(this);
     142             : 
     143           0 :     Reference< XStatement > xStmt = pStmt;
     144           0 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
     145           0 :     return xStmt;
     146             : }
     147             : 
     148           0 : Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareStatement( const OUString& sql ) throw(SQLException, RuntimeException, std::exception)
     149             : {
     150           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     151           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     152             : 
     153             : 
     154           0 :     OFlatPreparedStatement* pStmt = new OFlatPreparedStatement(this);
     155           0 :     Reference< XPreparedStatement > xStmt = pStmt;
     156           0 :     pStmt->construct(sql);
     157             : 
     158           0 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
     159           0 :     return xStmt;
     160             : }
     161             : 
     162           0 : Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareCall( const OUString& /*sql*/ ) throw(SQLException, RuntimeException, std::exception)
     163             : {
     164           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     165           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     166             : 
     167           0 :     ::dbtools::throwFeatureNotImplementedException( "XConnection::prepareCall", *this );
     168           0 :     return NULL;
     169             : }
     170             : 
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10