LCOV - code coverage report
Current view: top level - dbaccess/source/sdbtools/connection - connectiontools.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 53 0.0 %
Date: 2014-04-14 Functions: 0 16 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 "connectiontools.hxx"
      21             : #include "tablename.hxx"
      22             : #include "objectnames.hxx"
      23             : #include "datasourcemetadata.hxx"
      24             : 
      25             : #include <comphelper/namedvaluecollection.hxx>
      26             : #include <cppuhelper/supportsservice.hxx>
      27             : #include <connectivity/dbtools.hxx>
      28             : #include <connectivity/statementcomposer.hxx>
      29             : 
      30             : #include <algorithm>
      31             : 
      32           0 : extern "C" void SAL_CALL createRegistryInfo_ConnectionTools()
      33             : {
      34           0 :     ::sdbtools::OAutoRegistration< ::sdbtools::ConnectionTools > aRegistration;
      35           0 : }
      36             : 
      37             : namespace sdbtools
      38             : {
      39             : 
      40             :     using namespace ::com::sun::star;
      41             :     using namespace ::com::sun::star::uno;
      42             :     using ::com::sun::star::uno::Reference;
      43             :     using ::com::sun::star::uno::RuntimeException;
      44             :     using ::com::sun::star::sdb::tools::XTableName;
      45             :     using ::com::sun::star::sdb::tools::XObjectNames;
      46             :     using ::com::sun::star::sdb::tools::XDataSourceMetaData;
      47             :     using ::com::sun::star::uno::Sequence;
      48             :     using ::com::sun::star::uno::XInterface;
      49             :     using ::com::sun::star::uno::Any;
      50             :     using ::com::sun::star::uno::Exception;
      51             :     using ::com::sun::star::sdbc::XConnection;
      52             :     using ::com::sun::star::lang::IllegalArgumentException;
      53             :     using ::com::sun::star::uno::XComponentContext;
      54             : 
      55             :     // ConnectionTools
      56           0 :     ConnectionTools::ConnectionTools( const Reference<XComponentContext>& _rContext )
      57           0 :         :ConnectionDependentComponent( _rContext )
      58             :     {
      59           0 :     }
      60             : 
      61           0 :     ConnectionTools::~ConnectionTools()
      62             :     {
      63           0 :     }
      64             : 
      65           0 :     Reference< XTableName > SAL_CALL ConnectionTools::createTableName() throw (RuntimeException, std::exception)
      66             :     {
      67           0 :         EntryGuard aGuard( *this );
      68           0 :         return new TableName( getContext(), getConnection() );
      69             :     }
      70             : 
      71           0 :     Reference< XObjectNames > SAL_CALL ConnectionTools::getObjectNames() throw (RuntimeException, std::exception)
      72             :     {
      73           0 :         EntryGuard aGuard( *this );
      74           0 :         return new ObjectNames( getContext(), getConnection() );
      75             :     }
      76             : 
      77           0 :     Reference< XDataSourceMetaData > SAL_CALL ConnectionTools::getDataSourceMetaData() throw (RuntimeException, std::exception)
      78             :     {
      79           0 :         EntryGuard aGuard( *this );
      80           0 :         return new DataSourceMetaData( getContext(), getConnection() );
      81             :     }
      82           0 :     Reference< container::XNameAccess > SAL_CALL ConnectionTools::getFieldsByCommandDescriptor( ::sal_Int32 commandType, const OUString& command, Reference< lang::XComponent >& keepFieldsAlive ) throw (sdbc::SQLException, RuntimeException, std::exception)
      83             :     {
      84           0 :         EntryGuard aGuard( *this );
      85           0 :         ::dbtools::SQLExceptionInfo aErrorInfo;
      86           0 :         Reference< container::XNameAccess > xRet = ::dbtools::getFieldsByCommandDescriptor(getConnection(),commandType,command,keepFieldsAlive,&aErrorInfo);
      87           0 :         if ( aErrorInfo.isValid() )
      88           0 :             aErrorInfo.doThrow();
      89           0 :         return xRet;
      90             :     }
      91           0 :     Reference< sdb::XSingleSelectQueryComposer > SAL_CALL ConnectionTools::getComposer( ::sal_Int32 commandType, const OUString& command ) throw (::com::sun::star::uno::RuntimeException, std::exception)
      92             :     {
      93           0 :         EntryGuard aGuard( *this );
      94           0 :         dbtools::StatementComposer aComposer(getConnection(), command, commandType, true );
      95           0 :         aComposer.setDisposeComposer(false);
      96           0 :         return aComposer.getComposer();
      97             :     }
      98             : 
      99           0 :     OUString SAL_CALL ConnectionTools::getImplementationName() throw (RuntimeException, std::exception)
     100             :     {
     101           0 :         return getImplementationName_static();
     102             :     }
     103             : 
     104           0 :     sal_Bool SAL_CALL ConnectionTools::supportsService(const OUString & _ServiceName) throw (RuntimeException, std::exception)
     105             :     {
     106           0 :         return cppu::supportsService(this, _ServiceName);
     107             :     }
     108             : 
     109           0 :     Sequence< OUString > SAL_CALL ConnectionTools::getSupportedServiceNames() throw (RuntimeException, std::exception)
     110             :     {
     111           0 :         return getSupportedServiceNames_static();
     112             :     }
     113             : 
     114           0 :     OUString SAL_CALL ConnectionTools::getImplementationName_static()
     115             :     {
     116           0 :         return OUString( "com.sun.star.comp.dbaccess.ConnectionTools" );
     117             :     }
     118             : 
     119           0 :     Sequence< OUString > SAL_CALL ConnectionTools::getSupportedServiceNames_static()
     120             :     {
     121           0 :         Sequence< OUString > aSupported( 1 );
     122           0 :         aSupported[0] = "com.sun.star.sdb.tools.ConnectionTools";
     123           0 :         return aSupported;
     124             :     }
     125             : 
     126           0 :     Reference< XInterface > SAL_CALL ConnectionTools::Create(const Reference< XComponentContext >& _rxContext )
     127             :     {
     128           0 :         return *( new ConnectionTools( Reference<XComponentContext>( _rxContext ) ) );
     129             :     }
     130             : 
     131           0 :     void SAL_CALL ConnectionTools::initialize(const Sequence< Any > & _rArguments) throw (RuntimeException, Exception, std::exception)
     132             :     {
     133           0 :         ::osl::MutexGuard aGuard( getMutex() );
     134             : 
     135           0 :         Reference< XConnection > xConnection;
     136           0 :         if (_rArguments.getLength()==1 && (_rArguments[0] >>= xConnection))
     137             :         {
     138             :         }
     139             :         else
     140             :         {
     141           0 :             ::comphelper::NamedValueCollection aArguments( _rArguments );
     142           0 :             aArguments.get( "Connection" ) >>= xConnection;
     143             :         }
     144           0 :         if ( !xConnection.is() )
     145           0 :             throw IllegalArgumentException();
     146             : 
     147           0 :         setWeakConnection( xConnection );
     148           0 :     }
     149             : 
     150             : } // namespace sdbtools
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10