LCOV - code coverage report
Current view: top level - connectivity/source/drivers/flat - EConnection.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 71 0.0 %
Date: 2015-06-13 12:38:46 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(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)
      63             :     throw(css::sdbc::SQLException, css::uno::RuntimeException)
      64             : {
      65           0 :     osl_atomic_increment( &m_refCount );
      66             : 
      67           0 :     const PropertyValue *pBegin  = info.getConstArray();
      68           0 :     const PropertyValue *pEnd    = pBegin + info.getLength();
      69           0 :     for(;pBegin != pEnd;++pBegin)
      70             :     {
      71           0 :         if(pBegin->Name == "HeaderLine")
      72           0 :             OSL_VERIFY( pBegin->Value >>= m_bHeaderLine );
      73           0 :         else if(pBegin->Name == "FieldDelimiter")
      74             :         {
      75           0 :             OUString aVal;
      76           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      77           0 :             m_cFieldDelimiter = aVal.toChar();
      78             :         }
      79           0 :         else if(pBegin->Name == "StringDelimiter")
      80             :         {
      81           0 :             OUString aVal;
      82           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      83           0 :             m_cStringDelimiter = aVal.toChar();
      84             :         }
      85           0 :         else if(pBegin->Name == "DecimalDelimiter")
      86             :         {
      87           0 :             OUString aVal;
      88           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      89           0 :             m_cDecimalDelimiter = aVal.toChar();
      90             :         }
      91           0 :         else if(pBegin->Name == "ThousandDelimiter")
      92             :         {
      93           0 :             OUString aVal;
      94           0 :             OSL_VERIFY( pBegin->Value >>= aVal );
      95           0 :             m_cThousandDelimiter = aVal.toChar();
      96             :         }
      97           0 :         else if ( pBegin->Name == "MaxRowScan" )
      98             :         {
      99           0 :             pBegin->Value >>= m_nMaxRowsToScan;
     100             :         }
     101             :     }
     102             : 
     103           0 :     osl_atomic_decrement( &m_refCount );
     104           0 :     OConnection::construct(url,info);
     105           0 :     m_bShowDeleted = true; // we do not supported rows for this type
     106           0 : }
     107             : 
     108           0 : Reference< XDatabaseMetaData > SAL_CALL OFlatConnection::getMetaData(  ) throw(SQLException, RuntimeException, std::exception)
     109             : {
     110           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     111           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     112             : 
     113             : 
     114           0 :     Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
     115           0 :     if(!xMetaData.is())
     116             :     {
     117           0 :         xMetaData = new OFlatDatabaseMetaData(this);
     118           0 :         m_xMetaData = xMetaData;
     119             :     }
     120             : 
     121           0 :     return xMetaData;
     122             : }
     123             : 
     124           0 : ::com::sun::star::uno::Reference< XTablesSupplier > OFlatConnection::createCatalog()
     125             : {
     126           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     127           0 :     Reference< XTablesSupplier > xTab = m_xCatalog;
     128           0 :     if(!xTab.is())
     129             :     {
     130           0 :         OFlatCatalog *pCat = new OFlatCatalog(this);
     131           0 :         xTab = pCat;
     132           0 :         m_xCatalog = xTab;
     133             :     }
     134           0 :     return xTab;
     135             : }
     136             : 
     137           0 : Reference< XStatement > SAL_CALL OFlatConnection::createStatement(  ) throw(SQLException, RuntimeException, std::exception)
     138             : {
     139           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     140           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     141             : 
     142           0 :     OFlatStatement* pStmt = new OFlatStatement(this);
     143             : 
     144           0 :     Reference< XStatement > xStmt = pStmt;
     145           0 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
     146           0 :     return xStmt;
     147             : }
     148             : 
     149           0 : Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareStatement( const OUString& sql ) throw(SQLException, RuntimeException, std::exception)
     150             : {
     151           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     152           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     153             : 
     154             : 
     155           0 :     OFlatPreparedStatement* pStmt = new OFlatPreparedStatement(this);
     156           0 :     Reference< XPreparedStatement > xStmt = pStmt;
     157           0 :     pStmt->construct(sql);
     158             : 
     159           0 :     m_aStatements.push_back(WeakReferenceHelper(*pStmt));
     160           0 :     return xStmt;
     161             : }
     162             : 
     163           0 : Reference< XPreparedStatement > SAL_CALL OFlatConnection::prepareCall( const OUString& /*sql*/ ) throw(SQLException, RuntimeException, std::exception)
     164             : {
     165           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     166           0 :     checkDisposed(OConnection_B::rBHelper.bDisposed);
     167             : 
     168           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XConnection::prepareCall", *this );
     169           0 :     return NULL;
     170             : }
     171             : 
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11