LCOV - code coverage report
Current view: top level - connectivity/source/sdbcx - VColumn.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 54 81 66.7 %
Date: 2014-11-03 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        4650 : 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        4650 :     ,m_TableName(_TableName)
     103             : {
     104        4650 :     m_Name = _Name;
     105             : 
     106        4650 :     construct();
     107        4650 : }
     108             : 
     109        5476 : OColumn::~OColumn()
     110             : {
     111        5476 : }
     112             : 
     113          30 : ::cppu::IPropertyArrayHelper* OColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
     114             : {
     115          30 :     return doCreateArrayHelper();
     116             : }
     117             : 
     118      122586 : ::cppu::IPropertyArrayHelper& SAL_CALL OColumn::getInfoHelper()
     119             : {
     120      122586 :     return *OColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
     121             : }
     122             : 
     123       78530 : void SAL_CALL OColumn::acquire() throw()
     124             : {
     125       78530 :     OColumnDescriptor_BASE::acquire();
     126       78530 : }
     127             : 
     128       78518 : void SAL_CALL OColumn::release() throw()
     129             : {
     130       78518 :     OColumnDescriptor_BASE::release();
     131       78518 : }
     132             : 
     133       17858 : Any SAL_CALL OColumn::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     134             : {
     135       17858 :     Any aRet = ODescriptor::queryInterface( rType);
     136       17858 :     if(!aRet.hasValue())
     137             :     {
     138       11424 :         if(!isNew())
     139       11424 :             aRet = OColumn_BASE::queryInterface(rType);
     140       11424 :         if(!aRet.hasValue())
     141        2336 :             aRet = OColumnDescriptor_BASE::queryInterface( rType);
     142             :     }
     143       17858 :     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        4650 : void OColumn::construct()
     155             : {
     156        4650 :     ODescriptor::construct();
     157             : 
     158        4650 :     sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
     159             : 
     160        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME),        PROPERTY_ID_TYPENAME,           nAttrib, &m_TypeName,        ::getCppuType(&m_TypeName));
     161        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION),     PROPERTY_ID_DESCRIPTION,        nAttrib, &m_Description,     ::getCppuType(&m_Description));
     162        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE),    PROPERTY_ID_DEFAULTVALUE,       nAttrib, &m_DefaultValue,    ::getCppuType(&m_DefaultValue));
     163        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION),       PROPERTY_ID_PRECISION,          nAttrib, &m_Precision,       ::getCppuType(&m_Precision));
     164        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),            PROPERTY_ID_TYPE,               nAttrib, &m_Type,            ::getCppuType(&m_Type));
     165        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE),           PROPERTY_ID_SCALE,              nAttrib, &m_Scale,           ::getCppuType(&m_Scale));
     166        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE),      PROPERTY_ID_ISNULLABLE,         nAttrib, &m_IsNullable,      ::getCppuType(&m_IsNullable));
     167        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISAUTOINCREMENT), PROPERTY_ID_ISAUTOINCREMENT,    nAttrib, &m_IsAutoIncrement, ::getBooleanCppuType());
     168        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISROWVERSION),    PROPERTY_ID_ISROWVERSION,       nAttrib, &m_IsRowVersion,    ::getBooleanCppuType());
     169        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY),      PROPERTY_ID_ISCURRENCY,         nAttrib, &m_IsCurrency,      ::getBooleanCppuType());
     170        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CATALOGNAME),     PROPERTY_ID_CATALOGNAME,        nAttrib, &m_CatalogName,     ::getCppuType(&m_CatalogName));
     171        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),      PROPERTY_ID_SCHEMANAME,         nAttrib, &m_SchemaName,      ::getCppuType(&m_SchemaName));
     172        4650 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TABLENAME),       PROPERTY_ID_TABLENAME,          nAttrib, &m_TableName,       ::getCppuType(&m_TableName));
     173        4650 : }
     174             : 
     175        4644 : void OColumn::disposing(void)
     176             : {
     177        4644 :     OPropertySetHelper::disposing();
     178             : 
     179        4644 :     ::osl::MutexGuard aGuard(m_aMutex);
     180        4644 :     checkDisposed(OColumnDescriptor_BASE::rBHelper.bDisposed);
     181             : 
     182        4644 : }
     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       16148 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OColumn::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     210             : {
     211       16148 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     212             : }
     213             : 
     214             : // XNamed
     215         672 : OUString SAL_CALL OColumn::getName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     216             : {
     217         672 :     return m_Name;
     218             : }
     219             : 
     220         400 : void SAL_CALL OColumn::setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     221             : {
     222         400 :     m_Name = aName;
     223         400 : }
     224             : 
     225             : 
     226             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10