LCOV - code coverage report
Current view: top level - connectivity/source/drivers/dbase - DDriver.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 33 81.8 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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 "dbase/DDriver.hxx"
      21             : #include "dbase/DConnection.hxx"
      22             : #include <com/sun/star/lang/DisposedException.hpp>
      23             : #include <connectivity/dbexception.hxx>
      24             : #include "resource/dbase_res.hrc"
      25             : #include <comphelper/processfactory.hxx>
      26             : 
      27             : using namespace connectivity::dbase;
      28             : using namespace connectivity::file;
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::beans;
      31             : using namespace ::com::sun::star::sdbcx;
      32             : using namespace ::com::sun::star::sdbc;
      33             : using namespace ::com::sun::star::lang;
      34             : 
      35             : 
      36             : // static ServiceInfo
      37             : 
      38          11 : OUString ODriver::getImplementationName_Static(  ) throw(RuntimeException)
      39             : {
      40          11 :     return OUString("com.sun.star.comp.sdbc.dbase.ODriver");
      41             : }
      42             : 
      43             : 
      44           1 : OUString SAL_CALL ODriver::getImplementationName(  ) throw(RuntimeException, std::exception)
      45             : {
      46           1 :     return getImplementationName_Static();
      47             : }
      48             : 
      49             : 
      50          10 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
      51             : {
      52          10 :     return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
      53             : }
      54             : 
      55          29 : Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException, std::exception)
      56             : {
      57          29 :     ::osl::MutexGuard aGuard( m_aMutex );
      58          29 :     if (ODriver_BASE::rBHelper.bDisposed)
      59           0 :         throw DisposedException();
      60             : 
      61          29 :     if ( ! acceptsURL(url) )
      62           0 :         return NULL;
      63             : 
      64          29 :     ODbaseConnection* pCon = new ODbaseConnection(this);
      65          29 :     pCon->construct(url,info);
      66          58 :     Reference< XConnection > xCon = pCon;
      67          29 :     m_xConnections.push_back(WeakReferenceHelper(*pCon));
      68             : 
      69          58 :     return xCon;
      70             : }
      71             : 
      72         174 : sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url ) throw(SQLException, RuntimeException, std::exception)
      73             : {
      74         174 :     return url.startsWith("sdbc:dbase:");
      75             : }
      76             : 
      77          29 : Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException, std::exception)
      78             : {
      79          29 :     if ( acceptsURL(url) )
      80             :     {
      81          29 :         ::std::vector< DriverPropertyInfo > aDriverInfo;
      82             : 
      83          58 :         Sequence< OUString > aBoolean(2);
      84          29 :         aBoolean[0] = "0";
      85          29 :         aBoolean[1] = "1";
      86             : 
      87             :         aDriverInfo.push_back(DriverPropertyInfo(
      88             :                 OUString("CharSet")
      89             :                 ,OUString("CharSet of the database.")
      90             :                 ,sal_False
      91             :                 ,OUString()
      92             :                 ,Sequence< OUString >())
      93          29 :                 );
      94             :         aDriverInfo.push_back(DriverPropertyInfo(
      95             :                 OUString("ShowDeleted")
      96             :                 ,OUString("Display inactive records.")
      97             :                 ,sal_False
      98             :                 ,OUString("0")
      99             :                 ,aBoolean)
     100          29 :                 );
     101             :         aDriverInfo.push_back(DriverPropertyInfo(
     102             :                 OUString("EnableSQL92Check")
     103             :                 ,OUString("Use SQL92 naming constraints.")
     104             :                 ,sal_False
     105             :                 ,OUString("0")
     106             :                 ,aBoolean)
     107          29 :                 );
     108          58 :         return Sequence< DriverPropertyInfo >(&(aDriverInfo[0]),aDriverInfo.size());
     109             :     }
     110             : 
     111           0 :     SharedResources aResources;
     112           0 :     const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
     113           0 :     ::dbtools::throwGenericSQLException(sMessage ,*this);
     114           0 :     return Sequence< DriverPropertyInfo >();
     115             : }
     116             : 
     117             : 
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11