LCOV - code coverage report
Current view: top level - connectivity/source/sdbcx - VColumn.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 54 81 66.7 %
Date: 2015-06-13 12:38:46 Functions: 13 19 68.4 %
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/VColumn.hxx>
      21             : #include <com/sun/star/lang/DisposedException.hpp>
      22             : #include <comphelper/sequence.hxx>
      23             : #include <cppuhelper/supportsservice.hxx>
      24             : #include "TConnection.hxx"
      25             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      26             : 
      27             : using namespace connectivity;
      28             : using namespace connectivity::sdbcx;
      29             : using namespace cppu;
      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 : OUString SAL_CALL OColumn::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
      37             : {
      38           0 :     if(isNew())
      39           0 :         return OUString("com.sun.star.sdbcx.VColumnDescription");
      40           0 :     return OUString("com.sun.star.sdbcx.VColumn");
      41             : }
      42             : 
      43           0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL OColumn::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      44             : {
      45           0 :     ::com::sun::star::uno::Sequence< OUString > aSupported(1);
      46           0 :     if(isNew())
      47           0 :         aSupported[0] = "com.sun.star.sdbcx.ColumnDescription";
      48             :     else
      49           0 :         aSupported[0] = "com.sun.star.sdbcx.Column";
      50             : 
      51           0 :     return aSupported;
      52             : }
      53             : 
      54           0 : sal_Bool SAL_CALL OColumn::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
      55             : {
      56           0 :     return cppu::supportsService(this, _rServiceName);
      57             : }
      58             : 
      59           0 : OColumn::OColumn(bool _bCase)
      60             :     :OColumnDescriptor_BASE(m_aMutex)
      61             :     ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase,true)
      62             :     ,m_IsNullable(ColumnValue::NULLABLE)
      63             :     ,m_Precision(0)
      64             :     ,m_Scale(0)
      65             :     ,m_Type(0)
      66             :     ,m_IsAutoIncrement(false)
      67             :     ,m_IsRowVersion(false)
      68           0 :     ,m_IsCurrency(false)
      69             : {
      70           0 :     construct();
      71           0 : }
      72             : 
      73        3076 : OColumn::OColumn(   const OUString& _Name,
      74             :                     const OUString& _TypeName,
      75             :                     const OUString& _DefaultValue,
      76             :                     const OUString& _Description,
      77             :                     sal_Int32       _IsNullable,
      78             :                     sal_Int32       _Precision,
      79             :                     sal_Int32       _Scale,
      80             :                     sal_Int32       _Type,
      81             :                     bool            _IsAutoIncrement,
      82             :                     bool            _IsRowVersion,
      83             :                     bool            _IsCurrency,
      84             :                     bool            _bCase,
      85             :                     const OUString& _CatalogName,
      86             :                     const OUString& _SchemaName,
      87             :                     const OUString& _TableName)
      88             :     :OColumnDescriptor_BASE(m_aMutex)
      89             :     ,ODescriptor(OColumnDescriptor_BASE::rBHelper,_bCase)
      90             :     ,m_TypeName(_TypeName)
      91             :     ,m_Description(_Description)
      92             :     ,m_DefaultValue(_DefaultValue)
      93             :     ,m_IsNullable(_IsNullable)
      94             :     ,m_Precision(_Precision)
      95             :     ,m_Scale(_Scale)
      96             :     ,m_Type(_Type)
      97             :     ,m_IsAutoIncrement(_IsAutoIncrement)
      98             :     ,m_IsRowVersion(_IsRowVersion)
      99             :     ,m_IsCurrency(_IsCurrency)
     100             :     ,m_CatalogName(_CatalogName)
     101             :     ,m_SchemaName(_SchemaName)
     102        3076 :     ,m_TableName(_TableName)
     103             : {
     104        3076 :     m_Name = _Name;
     105             : 
     106        3076 :     construct();
     107        3076 : }
     108             : 
     109        3613 : OColumn::~OColumn()
     110             : {
     111        3613 : }
     112             : 
     113          22 : ::cppu::IPropertyArrayHelper* OColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
     114             : {
     115          22 :     return doCreateArrayHelper();
     116             : }
     117             : 
     118       80761 : ::cppu::IPropertyArrayHelper& SAL_CALL OColumn::getInfoHelper()
     119             : {
     120       80761 :     return *OColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
     121             : }
     122             : 
     123       53112 : void SAL_CALL OColumn::acquire() throw()
     124             : {
     125       53112 :     OColumnDescriptor_BASE::acquire();
     126       53112 : }
     127             : 
     128       53112 : void SAL_CALL OColumn::release() throw()
     129             : {
     130       53112 :     OColumnDescriptor_BASE::release();
     131       53112 : }
     132             : 
     133       12595 : Any SAL_CALL OColumn::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     134             : {
     135       12595 :     Any aRet = ODescriptor::queryInterface( rType);
     136       12595 :     if(!aRet.hasValue())
     137             :     {
     138        8046 :         if(!isNew())
     139        8046 :             aRet = OColumn_BASE::queryInterface(rType);
     140        8046 :         if(!aRet.hasValue())
     141        1494 :             aRet = OColumnDescriptor_BASE::queryInterface( rType);
     142             :     }
     143       12595 :     return aRet;
     144             : }
     145             : 
     146           0 : Sequence< Type > SAL_CALL OColumn::getTypes(  ) throw(RuntimeException, std::exception)
     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        3076 : void OColumn::construct()
     155             : {
     156        3076 :     ODescriptor::construct();
     157             : 
     158        3076 :     sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
     159             : 
     160        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME),        PROPERTY_ID_TYPENAME,           nAttrib, &m_TypeName,        cppu::UnoType<decltype(m_TypeName)>::get());
     161        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION),     PROPERTY_ID_DESCRIPTION,        nAttrib, &m_Description,     cppu::UnoType<decltype(m_Description)>::get());
     162        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE),    PROPERTY_ID_DEFAULTVALUE,       nAttrib, &m_DefaultValue,    cppu::UnoType<decltype(m_DefaultValue)>::get());
     163        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION),       PROPERTY_ID_PRECISION,          nAttrib, &m_Precision,       cppu::UnoType<decltype(m_Precision)>::get());
     164        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),            PROPERTY_ID_TYPE,               nAttrib, &m_Type,            cppu::UnoType<decltype(m_Type)>::get());
     165        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE),           PROPERTY_ID_SCALE,              nAttrib, &m_Scale,           cppu::UnoType<decltype(m_Scale)>::get());
     166        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE),      PROPERTY_ID_ISNULLABLE,         nAttrib, &m_IsNullable,      cppu::UnoType<decltype(m_IsNullable)>::get());
     167        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT), PROPERTY_ID_ISAUTOINCREMENT,    nAttrib, &m_IsAutoIncrement, cppu::UnoType<bool>::get());
     168        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISROWVERSION),    PROPERTY_ID_ISROWVERSION,       nAttrib, &m_IsRowVersion,    cppu::UnoType<bool>::get());
     169        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY),      PROPERTY_ID_ISCURRENCY,         nAttrib, &m_IsCurrency,      cppu::UnoType<bool>::get());
     170        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME),     PROPERTY_ID_CATALOGNAME,        nAttrib, &m_CatalogName,     cppu::UnoType<decltype(m_CatalogName)>::get());
     171        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),      PROPERTY_ID_SCHEMANAME,         nAttrib, &m_SchemaName,      cppu::UnoType<decltype(m_SchemaName)>::get());
     172        3076 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME),       PROPERTY_ID_TABLENAME,          nAttrib, &m_TableName,       cppu::UnoType<decltype(m_TableName)>::get());
     173        3076 : }
     174             : 
     175        3076 : void OColumn::disposing()
     176             : {
     177        3076 :     OPropertySetHelper::disposing();
     178             : 
     179        3076 :     ::osl::MutexGuard aGuard(m_aMutex);
     180        3076 :     checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
     181             : 
     182        3076 : }
     183             : 
     184           0 : Reference< XPropertySet > SAL_CALL OColumn::createDataDescriptor(  ) throw(RuntimeException, std::exception)
     185             : {
     186           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     187           0 :     checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
     188             : 
     189             : 
     190             :     OColumn* pNewColumn = new OColumn(  m_Name,
     191             :                                         m_TypeName,
     192             :                                         m_DefaultValue,
     193             :                                         m_Description,
     194             :                                         m_IsNullable,
     195             :                                         m_Precision,
     196             :                                         m_Scale,
     197             :                                         m_Type,
     198             :                                         m_IsAutoIncrement,
     199             :                                         m_IsRowVersion,
     200             :                                         m_IsCurrency,
     201           0 :                                         isCaseSensitive(),
     202             :                                         m_CatalogName,
     203             :                                         m_SchemaName,
     204           0 :                                         m_TableName);
     205           0 :     pNewColumn->setNew(true);
     206           0 :     return pNewColumn;
     207             : }
     208             : 
     209        9996 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OColumn::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     210             : {
     211        9996 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     212             : }
     213             : 
     214             : // XNamed
     215         420 : OUString SAL_CALL OColumn::getName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     216             : {
     217         420 :     return m_Name;
     218             : }
     219             : 
     220         223 : void SAL_CALL OColumn::setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     221             : {
     222         223 :     m_Name = aName;
     223         223 : }
     224             : 
     225             : 
     226             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11