LCOV - code coverage report
Current view: top level - connectivity/source/drivers/calc - CDriver.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 25 80.0 %
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 "calc/CDriver.hxx"
      21             : #include "calc/CConnection.hxx"
      22             : #include <com/sun/star/lang/DisposedException.hpp>
      23             : #include <connectivity/dbexception.hxx>
      24             : #include "resource/sharedresources.hxx"
      25             : #include "resource/calc_res.hrc"
      26             : #include <comphelper/processfactory.hxx>
      27             : 
      28             : using namespace connectivity::calc;
      29             : using namespace connectivity::file;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::beans;
      32             : using namespace ::com::sun::star::sdbcx;
      33             : using namespace ::com::sun::star::sdbc;
      34             : using namespace ::com::sun::star::lang;
      35             : 
      36             : 
      37             : 
      38             : // static ServiceInfo
      39             : 
      40           4 : OUString ODriver::getImplementationName_Static(  ) throw(RuntimeException)
      41             : {
      42           4 :     return OUString("com.sun.star.comp.sdbc.calc.ODriver");
      43             : }
      44             : 
      45           1 : OUString SAL_CALL ODriver::getImplementationName(  ) throw(RuntimeException, std::exception)
      46             : {
      47           1 :     return getImplementationName_Static();
      48             : }
      49             : 
      50             : // service names from file::OFileDriver
      51             : 
      52             : 
      53             : 
      54             : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
      55           3 :     connectivity::calc::ODriver_CreateInstance(const ::com::sun::star::uno::Reference<
      56             :         ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
      57             : {
      58           3 :     return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
      59             : }
      60             : 
      61           9 : Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url,
      62             :     const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException, std::exception)
      63             : {
      64           9 :     ::osl::MutexGuard aGuard( m_aMutex );
      65           9 :     if (ODriver_BASE::rBHelper.bDisposed)
      66           0 :         throw DisposedException();
      67             : 
      68           9 :     if ( ! acceptsURL(url) )
      69           0 :         return NULL;
      70             : 
      71           9 :     OCalcConnection* pCon = new OCalcConnection(this);
      72           9 :     pCon->construct(url,info);
      73          18 :     Reference< XConnection > xCon = pCon;
      74           9 :     m_xConnections.push_back(WeakReferenceHelper(*pCon));
      75             : 
      76          18 :     return xCon;
      77             : }
      78             : 
      79          54 : sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
      80             :                 throw(SQLException, RuntimeException, std::exception)
      81             : {
      82          54 :     return url.startsWith("sdbc:calc:");
      83             : }
      84             : 
      85           9 : Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException, std::exception)
      86             : {
      87           9 :     if ( !acceptsURL(url) )
      88             :     {
      89           0 :         SharedResources aResources;
      90           0 :         const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
      91           0 :         ::dbtools::throwGenericSQLException(sMessage ,*this);
      92             :     }
      93           9 :     return Sequence< DriverPropertyInfo >();
      94             : }
      95             : 
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11