LCOV - code coverage report
Current view: top level - connectivity/source/sdbcx - VIndex.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 44 79 55.7 %
Date: 2015-06-13 12:38:46 Functions: 10 21 47.6 %
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 <connectivity/sdbcx/VIndex.hxx>
      21             : #include <com/sun/star/lang/DisposedException.hpp>
      22             : #include <connectivity/sdbcx/VColumn.hxx>
      23             : #include <connectivity/dbexception.hxx>
      24             : #include <comphelper/sequence.hxx>
      25             : #include <connectivity/sdbcx/VCollection.hxx>
      26             : #include <cppuhelper/supportsservice.hxx>
      27             : #include "TConnection.hxx"
      28             : 
      29             : using namespace ::connectivity;
      30             : using namespace ::dbtools;
      31             : using namespace ::connectivity::sdbcx;
      32             : using namespace ::cppu;
      33             : using namespace ::com::sun::star::beans;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::sdbc;
      36             : using namespace ::com::sun::star::sdbcx;
      37             : using namespace ::com::sun::star::container;
      38             : using namespace ::com::sun::star::lang;
      39             : 
      40             : 
      41           0 : OUString SAL_CALL OIndex::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
      42             : {
      43           0 :     if(isNew())
      44           0 :         return OUString("com.sun.star.sdbcx.VIndexDescriptor");
      45           0 :     return OUString("com.sun.star.sdbcx.VIndex");
      46             : }
      47             : 
      48           0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL OIndex::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      49             : {
      50           0 :     ::com::sun::star::uno::Sequence< OUString > aSupported(1);
      51           0 :     if(isNew())
      52           0 :         aSupported[0] = "com.sun.star.sdbcx.IndexDescriptor";
      53             :     else
      54           0 :         aSupported[0] = "com.sun.star.sdbcx.Index";
      55             : 
      56           0 :     return aSupported;
      57             : }
      58             : 
      59           0 : sal_Bool SAL_CALL OIndex::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      60             : {
      61           0 :     return cppu::supportsService(this, _rServiceName);
      62             : }
      63             : 
      64           0 : OIndex::OIndex(bool _bCase) :   ODescriptor_BASE(m_aMutex)
      65             :                 ,   ODescriptor(ODescriptor_BASE::rBHelper,_bCase,true)
      66             :                 ,m_IsUnique(false)
      67             :                 ,m_IsPrimaryKeyIndex(false)
      68             :                 ,m_IsClustered(false)
      69           0 :                 ,m_pColumns(NULL)
      70             : {
      71           0 : }
      72             : 
      73           3 : OIndex::OIndex( const OUString& _Name,
      74             :                 const OUString& _Catalog,
      75             :                 bool _isUnique,
      76             :                 bool _isPrimaryKeyIndex,
      77             :                 bool _isClustered,
      78             :                 bool _bCase) :  ODescriptor_BASE(m_aMutex)
      79             :                         ,ODescriptor(ODescriptor_BASE::rBHelper,_bCase)
      80             :                         ,m_Catalog(_Catalog)
      81             :                         ,m_IsUnique(_isUnique)
      82             :                         ,m_IsPrimaryKeyIndex(_isPrimaryKeyIndex)
      83             :                         ,m_IsClustered(_isClustered)
      84           3 :                         ,m_pColumns(NULL)
      85             : {
      86           3 :     m_Name = _Name;
      87           3 : }
      88             : 
      89           6 : OIndex::~OIndex( )
      90             : {
      91           3 :     delete m_pColumns;
      92           3 : }
      93             : 
      94           1 : ::cppu::IPropertyArrayHelper* OIndex::createArrayHelper( sal_Int32 /*_nId*/ ) const
      95             : {
      96           1 :     return doCreateArrayHelper();
      97             : }
      98             : 
      99          84 : ::cppu::IPropertyArrayHelper& SAL_CALL OIndex::getInfoHelper()
     100             : {
     101          84 :     return *OIndex_PROP::getArrayHelper(isNew() ? 1 : 0);
     102             : }
     103             : 
     104          51 : Any SAL_CALL OIndex::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     105             : {
     106          51 :     Any aRet = ODescriptor::queryInterface( rType);
     107          51 :     if(!aRet.hasValue())
     108             :     {
     109          27 :         if(!isNew())
     110          27 :             aRet = OIndex_BASE::queryInterface(rType);
     111          27 :         if(!aRet.hasValue())
     112          27 :             aRet = ODescriptor_BASE::queryInterface( rType);
     113             :     }
     114          51 :     return aRet;
     115             : }
     116             : 
     117           0 : Sequence< Type > SAL_CALL OIndex::getTypes(  ) throw(RuntimeException, std::exception)
     118             : {
     119           0 :     if(isNew())
     120           0 :         return ::comphelper::concatSequences(ODescriptor::getTypes(),ODescriptor_BASE::getTypes());
     121           0 :     return ::comphelper::concatSequences(ODescriptor::getTypes(),ODescriptor_BASE::getTypes(),OIndex_BASE::getTypes());
     122             : }
     123             : 
     124           3 : void OIndex::construct()
     125             : {
     126           3 :     ODescriptor::construct();
     127             : 
     128           3 :     sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
     129             : 
     130           3 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOG),         PROPERTY_ID_CATALOG,            nAttrib,&m_Catalog,         ::cppu::UnoType<OUString>::get());
     131           3 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE),            PROPERTY_ID_ISUNIQUE,           nAttrib,&m_IsUnique,            cppu::UnoType<bool>::get());
     132           3 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISPRIMARYKEYINDEX),PROPERTY_ID_ISPRIMARYKEYINDEX, nAttrib,&m_IsPrimaryKeyIndex,   cppu::UnoType<bool>::get());
     133           3 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCLUSTERED),     PROPERTY_ID_ISCLUSTERED,        nAttrib,&m_IsClustered,     cppu::UnoType<bool>::get());
     134           3 : }
     135             : 
     136           3 : void OIndex::disposing()
     137             : {
     138           3 :     OPropertySetHelper::disposing();
     139             : 
     140           3 :     ::osl::MutexGuard aGuard(m_aMutex);
     141             : 
     142           3 :     if(m_pColumns)
     143           3 :         m_pColumns->disposing();
     144           3 : }
     145             : 
     146          21 : Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OIndex::getColumns(  ) throw(RuntimeException, std::exception)
     147             : {
     148          21 :     ::osl::MutexGuard aGuard(m_aMutex);
     149          21 :     checkDisposed(ODescriptor_BASE::rBHelper.bDisposed);
     150             : 
     151             :     try
     152             :     {
     153          21 :         if  ( !m_pColumns )
     154           0 :             refreshColumns();
     155             :     }
     156           0 :     catch( const RuntimeException& )
     157             :     {
     158             :         // allowed to leave this method
     159           0 :         throw;
     160             :     }
     161           0 :     catch( const Exception& )
     162             :     {
     163             :         OSL_FAIL( "OIndex::getColumns: caught an exception!" );
     164             :     }
     165             : 
     166          21 :     return m_pColumns;
     167             : }
     168             : 
     169           0 : Reference< XPropertySet > SAL_CALL OIndex::createDataDescriptor(  ) throw(RuntimeException, std::exception)
     170             : {
     171           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     172           0 :     checkDisposed(ODescriptor_BASE::rBHelper.bDisposed);
     173             : 
     174             : 
     175           0 :     return this;
     176             : }
     177             : 
     178           0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OIndex::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     179             : {
     180           0 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     181             : }
     182             : 
     183           0 : OUString SAL_CALL OIndex::getName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     184             : {
     185           0 :     return m_Name;
     186             : }
     187             : 
     188           0 : void SAL_CALL OIndex::setName( const OUString& /*aName*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     189             : {
     190           0 : }
     191             : 
     192             : // XInterface
     193         192 : void SAL_CALL OIndex::acquire() throw()
     194             : {
     195         192 :     ODescriptor_BASE::acquire();
     196         192 : }
     197             : 
     198         192 : void SAL_CALL OIndex::release() throw()
     199             : {
     200         192 :     ODescriptor_BASE::release();
     201         192 : }
     202             : 
     203           0 : void OIndex::refreshColumns()
     204             : {
     205           0 : }
     206             : 
     207             : 
     208             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11