LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - View.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 43 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 11 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 "View.hxx"
      21             : #include "dbastrings.hrc"
      22             : 
      23             : #include "connectivity/dbexception.hxx"
      24             : #include "connectivity/dbtools.hxx"
      25             : 
      26             : #include <com/sun/star/lang/WrappedTargetException.hpp>
      27             : #include <com/sun/star/lang/DisposedException.hpp>
      28             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29             : #include <com/sun/star/sdbc/XRow.hpp>
      30             : 
      31             : #include <cppuhelper/exc_hlp.hxx>
      32             : #include <tools/diagnose_ex.h>
      33             : #include <unotools/sharedunocomponent.hxx>
      34             : 
      35             : namespace dbaccess
      36             : {
      37             : 
      38             :     using namespace ::com::sun::star::uno;
      39             :     using ::com::sun::star::sdbc::XDatabaseMetaData;
      40             :     using ::com::sun::star::sdbc::SQLException;
      41             :     using ::com::sun::star::sdbc::XConnection;
      42             :     using ::com::sun::star::lang::WrappedTargetException;
      43             :     using ::com::sun::star::lang::XMultiServiceFactory;
      44             :     using ::com::sun::star::sdbc::XResultSet;
      45             :     using ::com::sun::star::sdbc::XStatement;
      46             :     using ::com::sun::star::lang::DisposedException;
      47             :     using ::com::sun::star::sdbc::XRow;
      48             : 
      49           0 :     OUString lcl_getServiceNameForSetting(const Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const OUString& i_sSetting)
      50             :     {
      51           0 :         OUString sSupportService;
      52           0 :         Any aValue;
      53           0 :         if ( dbtools::getDataSourceSetting(_xConnection,i_sSetting,aValue) )
      54             :         {
      55           0 :             aValue >>= sSupportService;
      56             :         }
      57           0 :         return sSupportService;
      58             :     }
      59             :     // View
      60           0 :     View::View( const Reference< XConnection >& _rxConnection, bool _bCaseSensitive,
      61             :         const OUString& _rCatalogName,const OUString& _rSchemaName, const OUString& _rName )
      62           0 :         :View_Base( _bCaseSensitive, _rName, _rxConnection->getMetaData(), 0, OUString(), _rSchemaName, _rCatalogName )
      63             :     {
      64           0 :         m_nCommandHandle = getProperty(PROPERTY_COMMAND).Handle;
      65             :         try
      66             :         {
      67           0 :             Reference<XMultiServiceFactory> xFac(_rxConnection,UNO_QUERY_THROW);
      68             :             static const char s_sViewAccess[] = "ViewAccessServiceName";
      69           0 :             m_xViewAccess.set(xFac->createInstance(lcl_getServiceNameForSetting(_rxConnection,s_sViewAccess)),UNO_QUERY);
      70             :         }
      71           0 :         catch(const Exception& )
      72             :         {
      73             :             DBG_UNHANDLED_EXCEPTION();
      74             :         }
      75           0 :     }
      76             : 
      77           0 :     View::~View()
      78             :     {
      79           0 :     }
      80             : 
      81           0 :     IMPLEMENT_FORWARD_REFCOUNT( View, View_Base )
      82           0 :     IMPLEMENT_GET_IMPLEMENTATION_ID( View )
      83             : 
      84           0 :     Any SAL_CALL View::queryInterface( const Type & _rType ) throw(RuntimeException, std::exception)
      85             :     {
      86           0 :         if(_rType == cppu::UnoType<XAlterView>::get()&& !m_xViewAccess.is() )
      87           0 :             return Any();
      88           0 :         Any aReturn = View_Base::queryInterface( _rType );
      89           0 :         if ( !aReturn.hasValue() )
      90           0 :             aReturn = View_IBASE::queryInterface( _rType );
      91           0 :         return aReturn;
      92             :     }
      93             : 
      94           0 :     Sequence< Type > SAL_CALL View::getTypes(  ) throw(RuntimeException, std::exception)
      95             :     {
      96           0 :         Type aAlterType = cppu::UnoType<XAlterView>::get();
      97             : 
      98           0 :         Sequence< Type > aTypes( ::comphelper::concatSequences(View_Base::getTypes(),View_IBASE::getTypes()) );
      99           0 :         ::std::vector<Type> aOwnTypes;
     100           0 :         aOwnTypes.reserve(aTypes.getLength());
     101             : 
     102           0 :         const Type* pIter = aTypes.getConstArray();
     103           0 :         const Type* pEnd = pIter + aTypes.getLength();
     104           0 :         for(;pIter != pEnd ;++pIter)
     105             :         {
     106           0 :             if( (*pIter != aAlterType || m_xViewAccess.is()) )
     107           0 :                 aOwnTypes.push_back(*pIter);
     108             :         }
     109             : 
     110           0 :         return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
     111             :     }
     112             : 
     113           0 :     void SAL_CALL View::alterCommand( const OUString& _rNewCommand ) throw (SQLException, RuntimeException, std::exception)
     114             :     {
     115             :         OSL_ENSURE(m_xViewAccess.is(),"Illegal call to AlterView!");
     116           0 :         m_xViewAccess->alterCommand(this,_rNewCommand);
     117           0 :     }
     118             : 
     119           0 :     void SAL_CALL View::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
     120             :     {
     121           0 :         if ( _nHandle == m_nCommandHandle && m_xViewAccess.is() )
     122             :         {
     123             :             // retrieve the very current command, don't rely on the base classes cached value
     124             :             // (which we initialized empty, anyway)
     125           0 :             _rValue <<= m_xViewAccess->getCommand(const_cast<View*>(this));
     126           0 :             return;
     127             :         }
     128             : 
     129           0 :         View_Base::getFastPropertyValue( _rValue, _nHandle );
     130             :     }
     131             : 
     132             : } // namespace dbaccess
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11