LCOV - code coverage report
Current view: top level - connectivity/source/drivers/calc - CDriver.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 25 72.0 %
Date: 2014-11-03 Functions: 5 6 83.3 %
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           2 : OUString ODriver::getImplementationName_Static(  ) throw(RuntimeException)
      41             : {
      42           2 :     return OUString("com.sun.star.comp.sdbc.calc.ODriver");
      43             : }
      44             : 
      45           0 : OUString SAL_CALL ODriver::getImplementationName(  ) throw(RuntimeException, std::exception)
      46             : {
      47           0 :     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           2 :     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           2 :     return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
      59             : }
      60             : 
      61           4 : Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url,
      62             :     const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException, std::exception)
      63             : {
      64           4 :     ::osl::MutexGuard aGuard( m_aMutex );
      65           4 :     if (ODriver_BASE::rBHelper.bDisposed)
      66           0 :         throw DisposedException();
      67             : 
      68           4 :     if ( ! acceptsURL(url) )
      69           0 :         return NULL;
      70             : 
      71           4 :     OCalcConnection* pCon = new OCalcConnection(this);
      72           4 :     pCon->construct(url,info);
      73           8 :     Reference< XConnection > xCon = pCon;
      74           4 :     m_xConnections.push_back(WeakReferenceHelper(*pCon));
      75             : 
      76           8 :     return xCon;
      77             : }
      78             : 
      79          24 : sal_Bool SAL_CALL ODriver::acceptsURL( const OUString& url )
      80             :                 throw(SQLException, RuntimeException, std::exception)
      81             : {
      82          24 :     return url.startsWith("sdbc:calc:");
      83             : }
      84             : 
      85           4 : Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException, std::exception)
      86             : {
      87           4 :     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           4 :     return Sequence< DriverPropertyInfo >();
      94             : }
      95             : 
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10