LCOV - code coverage report
Current view: top level - connectivity/source/sdbcx - VColumn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 51 81 63.0 %
Date: 2012-08-25 Functions: 13 19 68.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 30 112 26.8 %

           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                 :            : #include "connectivity/sdbcx/VColumn.hxx"
      21                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      22                 :            : #include <comphelper/sequence.hxx>
      23                 :            : #include "TConnection.hxx"
      24                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      25                 :            : // -------------------------------------------------------------------------
      26                 :            : using namespace connectivity;
      27                 :            : using namespace connectivity::sdbcx;
      28                 :            : using namespace cppu;
      29                 :            : using namespace connectivity;
      30                 :            : using namespace ::com::sun::star::beans;
      31                 :            : using namespace ::com::sun::star::uno;
      32                 :            : using namespace ::com::sun::star::lang;
      33                 :            : using namespace ::com::sun::star::sdbc;
      34                 :            : 
      35                 :            : // -----------------------------------------------------------------------------
      36                 :          0 : ::rtl::OUString SAL_CALL OColumn::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)
      37                 :            : {
      38         [ #  # ]:          0 :     if(isNew())
      39                 :          0 :         return ::rtl::OUString("com.sun.star.sdbcx.VColumnDescription");
      40                 :          0 :     return ::rtl::OUString("com.sun.star.sdbcx.VColumn");
      41                 :            : }
      42                 :            : // -----------------------------------------------------------------------------
      43                 :          0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OColumn::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)
      44                 :            : {
      45                 :          0 :     ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
      46         [ #  # ]:          0 :     if(isNew())
      47         [ #  # ]:          0 :         aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.ColumnDescription");
      48                 :            :     else
      49         [ #  # ]:          0 :         aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.Column");
      50                 :            : 
      51                 :          0 :     return aSupported;
      52                 :            : }
      53                 :            : // -----------------------------------------------------------------------------
      54                 :          0 : sal_Bool SAL_CALL OColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
      55                 :            : {
      56         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
      57                 :          0 :     const ::rtl::OUString* pSupported = aSupported.getConstArray();
      58                 :          0 :     const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
      59 [ #  # ][ #  # ]:          0 :     for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
                 [ #  # ]
      60                 :            :         ;
      61                 :            : 
      62         [ #  # ]:          0 :     return pSupported != pEnd;
      63                 :            : }
      64                 :            : // -------------------------------------------------------------------------
      65                 :          0 : OColumn::OColumn(sal_Bool _bCase)
      66                 :            :     :OColumnDescriptor_BASE(m_aMutex)
      67                 :            :     ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase,sal_True)
      68                 :            :     ,m_IsNullable(ColumnValue::NULLABLE)
      69                 :            :     ,m_Precision(0)
      70                 :            :     ,m_Scale(0)
      71                 :            :     ,m_Type(0)
      72                 :            :     ,m_IsAutoIncrement(sal_False)
      73                 :            :     ,m_IsRowVersion(sal_False)
      74 [ #  # ][ #  # ]:          0 :     ,m_IsCurrency(sal_False)
      75                 :            : {
      76         [ #  # ]:          0 :     construct();
      77                 :          0 : }
      78                 :            : // -------------------------------------------------------------------------
      79                 :       4120 : OColumn::OColumn(   const ::rtl::OUString& _Name,
      80                 :            :                     const ::rtl::OUString& _TypeName,
      81                 :            :                     const ::rtl::OUString& _DefaultValue,
      82                 :            :                     const ::rtl::OUString& _Description,
      83                 :            :                     sal_Int32       _IsNullable,
      84                 :            :                     sal_Int32       _Precision,
      85                 :            :                     sal_Int32       _Scale,
      86                 :            :                     sal_Int32       _Type,
      87                 :            :                     sal_Bool        _IsAutoIncrement,
      88                 :            :                     sal_Bool        _IsRowVersion,
      89                 :            :                     sal_Bool        _IsCurrency,
      90                 :            :                     sal_Bool        _bCase)
      91                 :            :     :OColumnDescriptor_BASE(m_aMutex)
      92                 :            :     ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase)
      93                 :            :     ,m_TypeName(_TypeName)
      94                 :            :     ,m_Description(_Description)
      95                 :            :     ,m_DefaultValue(_DefaultValue)
      96                 :            :     ,m_IsNullable(_IsNullable)
      97                 :            :     ,m_Precision(_Precision)
      98                 :            :     ,m_Scale(_Scale)
      99                 :            :     ,m_Type(_Type)
     100                 :            :     ,m_IsAutoIncrement(_IsAutoIncrement)
     101                 :            :     ,m_IsRowVersion(_IsRowVersion)
     102 [ +  - ][ +  - ]:       4120 :     ,m_IsCurrency(_IsCurrency)
     103                 :            : {
     104                 :       4120 :     m_Name = _Name;
     105                 :            : 
     106         [ +  - ]:       4120 :     construct();
     107                 :       4120 : }
     108                 :            : // -------------------------------------------------------------------------
     109 [ +  - ][ +  - ]:       4120 : OColumn::~OColumn()
                 [ +  - ]
     110                 :            : {
     111         [ -  + ]:       4668 : }
     112                 :            : // -----------------------------------------------------------------------------
     113                 :         16 : ::cppu::IPropertyArrayHelper* OColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
     114                 :            : {
     115                 :         16 :     return doCreateArrayHelper();
     116                 :            : }
     117                 :            : // -----------------------------------------------------------------------------
     118                 :      90216 : ::cppu::IPropertyArrayHelper& SAL_CALL OColumn::getInfoHelper()
     119                 :            : {
     120         [ -  + ]:      90216 :     return *OColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
     121                 :            : }
     122                 :            : // -----------------------------------------------------------------------------
     123                 :      70100 : void SAL_CALL OColumn::acquire() throw()
     124                 :            : {
     125                 :      70100 :     OColumnDescriptor_BASE::acquire();
     126                 :      70100 : }
     127                 :            : // -----------------------------------------------------------------------------
     128                 :      70100 : void SAL_CALL OColumn::release() throw()
     129                 :            : {
     130                 :      70100 :     OColumnDescriptor_BASE::release();
     131                 :      70100 : }
     132                 :            : // -----------------------------------------------------------------------------
     133                 :      15592 : Any SAL_CALL OColumn::queryInterface( const Type & rType ) throw(RuntimeException)
     134                 :            : {
     135                 :      15592 :     Any aRet = ODescriptor::queryInterface( rType);
     136         [ +  + ]:      15592 :     if(!aRet.hasValue())
     137                 :            :     {
     138         [ +  - ]:       9934 :         if(!isNew())
     139         [ +  - ]:       9934 :             aRet = OColumn_BASE::queryInterface(rType);
     140         [ +  + ]:       9934 :         if(!aRet.hasValue())
     141         [ +  - ]:       1644 :             aRet = OColumnDescriptor_BASE::queryInterface( rType);
     142                 :            :     }
     143                 :      15592 :     return aRet;
     144                 :            : }
     145                 :            : // -------------------------------------------------------------------------
     146                 :          0 : Sequence< Type > SAL_CALL OColumn::getTypes(  ) throw(RuntimeException)
     147                 :            : {
     148         [ #  # ]:          0 :     if(isNew())
     149 [ #  # ][ #  # ]:          0 :         return ::comphelper::concatSequences(ODescriptor::getTypes(),OColumnDescriptor_BASE::getTypes());
                 [ #  # ]
     150                 :            : 
     151 [ #  # ][ #  # ]:          0 :     return ::comphelper::concatSequences(ODescriptor::getTypes(),OColumn_BASE::getTypes(),OColumnDescriptor_BASE::getTypes());
         [ #  # ][ #  # ]
                 [ #  # ]
     152                 :            : }
     153                 :            : // -------------------------------------------------------------------------
     154                 :       4120 : void OColumn::construct()
     155                 :            : {
     156                 :       4120 :     ODescriptor::construct();
     157                 :            : 
     158         [ -  + ]:       4120 :     sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
     159                 :            : 
     160         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME),            PROPERTY_ID_TYPENAME,           nAttrib,&m_TypeName,        ::getCppuType(static_cast< ::rtl::OUString*>(0)));
     161         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION),     PROPERTY_ID_DESCRIPTION,        nAttrib,&m_Description,     ::getCppuType(static_cast< ::rtl::OUString*>(0)));
     162         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE),        PROPERTY_ID_DEFAULTVALUE,       nAttrib,&m_DefaultValue,    ::getCppuType(static_cast< ::rtl::OUString*>(0)));
     163         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION),       PROPERTY_ID_PRECISION,          nAttrib,&m_Precision,       ::getCppuType(static_cast<sal_Int32*>(0)));
     164         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),                PROPERTY_ID_TYPE,               nAttrib,&m_Type,            ::getCppuType(static_cast<sal_Int32*>(0)));
     165         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE),           PROPERTY_ID_SCALE,              nAttrib,&m_Scale,           ::getCppuType(static_cast<sal_Int32*>(0)));
     166         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE),      PROPERTY_ID_ISNULLABLE,         nAttrib,&m_IsNullable,      ::getCppuType(static_cast<sal_Int32*>(0)));
     167         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT), PROPERTY_ID_ISAUTOINCREMENT,    nAttrib,&m_IsAutoIncrement, ::getBooleanCppuType());
     168         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISROWVERSION),        PROPERTY_ID_ISROWVERSION,       nAttrib,&m_IsRowVersion,    ::getBooleanCppuType());
     169         [ +  - ]:       4120 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY),      PROPERTY_ID_ISCURRENCY,         nAttrib,&m_IsCurrency,      ::getBooleanCppuType());
     170                 :       4120 : }
     171                 :            : // -------------------------------------------------------------------------
     172                 :       4120 : void OColumn::disposing(void)
     173                 :            : {
     174         [ +  - ]:       4120 :     OPropertySetHelper::disposing();
     175                 :            : 
     176         [ +  - ]:       4120 :     ::osl::MutexGuard aGuard(m_aMutex);
     177 [ +  - ][ +  - ]:       4120 :     checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
     178                 :            : 
     179                 :       4120 : }
     180                 :            : // -------------------------------------------------------------------------
     181                 :          0 : Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor(  ) throw(RuntimeException)
     182                 :            : {
     183         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     184         [ #  # ]:          0 :     checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
     185                 :            : 
     186                 :            : 
     187                 :            :     OColumn* pNewColumn = new OColumn(  m_Name,
     188                 :            :                                         m_TypeName,
     189                 :            :                                         m_DefaultValue,
     190                 :            :                                         m_Description,
     191                 :            :                                         m_IsNullable,
     192                 :            :                                         m_Precision,
     193                 :            :                                         m_Scale,
     194                 :            :                                         m_Type,
     195                 :            :                                         m_IsAutoIncrement,
     196                 :            :                                         m_IsRowVersion,
     197                 :            :                                         m_IsCurrency,
     198         [ #  # ]:          0 :                                         isCaseSensitive());
     199         [ #  # ]:          0 :     pNewColumn->setNew(sal_True);
     200 [ #  # ][ #  # ]:          0 :     return pNewColumn;
                 [ #  # ]
     201                 :            : }
     202                 :            : // -----------------------------------------------------------------------------
     203                 :      15002 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OColumn::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
     204                 :            : {
     205                 :      15002 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     206                 :            : }
     207                 :            : // -----------------------------------------------------------------------------
     208                 :            : // XNamed
     209                 :        548 : ::rtl::OUString SAL_CALL OColumn::getName(  ) throw(::com::sun::star::uno::RuntimeException)
     210                 :            : {
     211                 :        548 :     return m_Name;
     212                 :            : }
     213                 :            : // -----------------------------------------------------------------------------
     214                 :        426 : void SAL_CALL OColumn::setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException)
     215                 :            : {
     216                 :        426 :     m_Name = aName;
     217                 :        426 : }
     218                 :            : // -----------------------------------------------------------------------------
     219                 :            : 
     220                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10