LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - View.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 45 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 96 0.0 %

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

Generated by: LCOV version 1.10