LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - datacolumn.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 24 196 12.2 %
Date: 2014-04-11 Functions: 6 46 13.0 %
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 "datacolumn.hxx"
      21             : #include <com/sun/star/lang/DisposedException.hpp>
      22             : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
      23             : #include <com/sun/star/sdbc/DataType.hpp>
      24             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      25             : #include <cppuhelper/typeprovider.hxx>
      26             : #include <tools/debug.hxx>
      27             : #include "dbastrings.hrc"
      28             : #include "apitools.hxx"
      29             : 
      30             : using namespace dbaccess;
      31             : using namespace ::com::sun::star::sdbc;
      32             : using namespace ::com::sun::star::sdb;
      33             : using namespace ::com::sun::star::beans;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::lang;
      36             : using namespace ::com::sun::star::container;
      37             : using namespace ::osl;
      38             : using namespace ::comphelper;
      39             : using namespace ::cppu;
      40             : 
      41             : 
      42         260 : ODataColumn::ODataColumn(
      43             :                          const Reference < XResultSetMetaData >& _xMetaData,
      44             :                          const Reference < XRow >& _xRow,
      45             :                          const Reference < XRowUpdate >& _xRowUpdate,
      46             :                          sal_Int32 _nPos,
      47             :                          const Reference< XDatabaseMetaData >& _rxDBMeta)
      48             :                      :OResultColumn(_xMetaData, _nPos, _rxDBMeta)
      49             :                      ,m_xRow(_xRow)
      50         260 :                      ,m_xRowUpdate(_xRowUpdate)
      51             : {
      52         260 : }
      53             : 
      54         260 : ODataColumn::~ODataColumn()
      55             : {
      56         260 : }
      57             : 
      58             : // com::sun::star::lang::XTypeProvider
      59           0 : Sequence< Type > ODataColumn::getTypes() throw (RuntimeException, std::exception)
      60             : {
      61           0 :     OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ),
      62           0 :                            ::getCppuType( (const Reference< XColumnUpdate > *)0 ),
      63           0 :                            OColumn::getTypes());
      64           0 :     return aTypes.getTypes();
      65             : }
      66             : 
      67           0 : Sequence< sal_Int8 > ODataColumn::getImplementationId() throw (RuntimeException, std::exception)
      68             : {
      69           0 :     return css::uno::Sequence<sal_Int8>();
      70             : }
      71             : 
      72        1921 : Any SAL_CALL ODataColumn::queryInterface( const Type & _rType ) throw (RuntimeException, std::exception)
      73             : {
      74        1921 :     Any aReturn = OResultColumn::queryInterface(_rType);
      75        1921 :     if (!aReturn.hasValue())
      76         440 :         aReturn = ::cppu::queryInterface(_rType,
      77             :             static_cast< XColumn* >(this),
      78             :             static_cast< XColumnUpdate* >(this)
      79         220 :         );
      80        1921 :     return aReturn;
      81             : }
      82             : 
      83             : // XServiceInfo
      84           0 : OUString ODataColumn::getImplementationName(  ) throw(RuntimeException, std::exception)
      85             : {
      86           0 :     return OUString("com.sun.star.sdb.ODataColumn");
      87             : }
      88             : 
      89           0 : Sequence< OUString > ODataColumn::getSupportedServiceNames(  ) throw (RuntimeException, std::exception)
      90             : {
      91           0 :     Sequence< OUString > aSNS( 3 );
      92           0 :     aSNS[0] = SERVICE_SDBCX_COLUMN;
      93           0 :     aSNS[1] = SERVICE_SDB_RESULTCOLUMN;
      94           0 :     aSNS[2] = SERVICE_SDB_DATACOLUMN;
      95           0 :     return aSNS;
      96             : }
      97             : 
      98             : // OComponentHelper
      99         260 : void ODataColumn::disposing()
     100             : {
     101         260 :     OResultColumn::disposing();
     102             : 
     103         260 :     m_xRow = NULL;
     104         260 :     m_xRowUpdate = NULL;
     105         260 : }
     106             : 
     107             : // ::com::sun::star::sdb::XColumn
     108         107 : sal_Bool ODataColumn::wasNull(void) throw( SQLException, RuntimeException, std::exception )
     109             : {
     110         107 :     MutexGuard aGuard(m_aMutex);
     111         107 :     ::connectivity::checkDisposed(!m_xRow.is());
     112             : 
     113         107 :     return m_xRow->wasNull();
     114             : }
     115             : 
     116         212 : OUString ODataColumn::getString(void) throw( SQLException, RuntimeException, std::exception )
     117             : {
     118         212 :     MutexGuard aGuard(m_aMutex);
     119         212 :     ::connectivity::checkDisposed(!m_xRow.is());
     120             : 
     121         212 :     return m_xRow->getString(m_nPos);
     122             : }
     123             : 
     124           0 : sal_Bool ODataColumn::getBoolean(void) throw( SQLException, RuntimeException, std::exception )
     125             : {
     126           0 :     MutexGuard aGuard(m_aMutex);
     127           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     128             : 
     129           0 :     return m_xRow->getBoolean(m_nPos);
     130             : }
     131             : 
     132           0 : sal_Int8 ODataColumn::getByte(void) throw( SQLException, RuntimeException, std::exception )
     133             : {
     134           0 :     MutexGuard aGuard(m_aMutex);
     135           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     136             : 
     137           0 :     return m_xRow->getByte(m_nPos);
     138             : }
     139             : 
     140           0 : sal_Int16 ODataColumn::getShort(void) throw( SQLException, RuntimeException, std::exception )
     141             : {
     142           0 :     MutexGuard aGuard(m_aMutex);
     143           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     144             : 
     145           0 :     return m_xRow->getShort(m_nPos);
     146             : }
     147             : 
     148           0 : sal_Int32 ODataColumn::getInt(void) throw( SQLException, RuntimeException, std::exception )
     149             : {
     150           0 :     MutexGuard aGuard(m_aMutex);
     151           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     152             : 
     153           0 :     return m_xRow->getInt(m_nPos);
     154             : }
     155             : 
     156           0 : sal_Int64 ODataColumn::getLong(void) throw( SQLException, RuntimeException, std::exception )
     157             : {
     158           0 :     MutexGuard aGuard(m_aMutex);
     159           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     160             : 
     161           0 :     return m_xRow->getLong(m_nPos);
     162             : }
     163             : 
     164           0 : float ODataColumn::getFloat(void) throw( SQLException, RuntimeException, std::exception )
     165             : {
     166           0 :     MutexGuard aGuard(m_aMutex);
     167           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     168             : 
     169           0 :     return m_xRow->getFloat(m_nPos);
     170             : }
     171             : 
     172           0 : double ODataColumn::getDouble(void) throw( SQLException, RuntimeException, std::exception )
     173             : {
     174           0 :     MutexGuard aGuard(m_aMutex);
     175           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     176             : 
     177           0 :     return m_xRow->getDouble(m_nPos);
     178             : }
     179             : 
     180           0 : Sequence< sal_Int8 > ODataColumn::getBytes(void) throw( SQLException, RuntimeException, std::exception )
     181             : {
     182           0 :     MutexGuard aGuard(m_aMutex);
     183           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     184             : 
     185           0 :     return m_xRow->getBytes(m_nPos);
     186             : }
     187             : 
     188           0 : com::sun::star::util::Date ODataColumn::getDate(void) throw( SQLException, RuntimeException, std::exception )
     189             : {
     190           0 :     MutexGuard aGuard(m_aMutex);
     191           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     192             : 
     193           0 :     return m_xRow->getDate(m_nPos);
     194             : }
     195             : 
     196           0 : com::sun::star::util::Time ODataColumn::getTime(void) throw( SQLException, RuntimeException, std::exception )
     197             : {
     198           0 :     MutexGuard aGuard(m_aMutex);
     199           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     200             : 
     201           0 :     return m_xRow->getTime(m_nPos);
     202             : }
     203             : 
     204           0 : com::sun::star::util::DateTime ODataColumn::getTimestamp(void) throw( SQLException, RuntimeException, std::exception )
     205             : {
     206           0 :     MutexGuard aGuard(m_aMutex);
     207           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     208             : 
     209           0 :     return m_xRow->getTimestamp(m_nPos);
     210             : }
     211             : 
     212           0 : Reference< ::com::sun::star::io::XInputStream >  ODataColumn::getBinaryStream(void) throw( SQLException, RuntimeException, std::exception )
     213             : {
     214           0 :     MutexGuard aGuard(m_aMutex);
     215           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     216             : 
     217           0 :     return m_xRow->getBinaryStream(m_nPos);
     218             : }
     219             : 
     220           0 : Reference< ::com::sun::star::io::XInputStream >  ODataColumn::getCharacterStream(void) throw( SQLException, RuntimeException, std::exception )
     221             : {
     222           0 :     MutexGuard aGuard(m_aMutex);
     223           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     224             : 
     225           0 :     return m_xRow->getCharacterStream(m_nPos);
     226             : }
     227             : 
     228           0 : Any ODataColumn::getObject(const Reference< ::com::sun::star::container::XNameAccess > & typeMap) throw( SQLException, RuntimeException, std::exception )
     229             : {
     230           0 :     MutexGuard aGuard(m_aMutex);
     231           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     232             : 
     233           0 :     return m_xRow->getObject(m_nPos, typeMap);
     234             : }
     235             : 
     236           0 : Reference< XRef >  ODataColumn::getRef(void) throw( SQLException, RuntimeException, std::exception )
     237             : {
     238           0 :     MutexGuard aGuard(m_aMutex);
     239           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     240             : 
     241           0 :     return m_xRow->getRef(m_nPos);
     242             : }
     243             : 
     244           0 : Reference< XBlob >  ODataColumn::getBlob(void) throw( SQLException, RuntimeException, std::exception )
     245             : {
     246           0 :     MutexGuard aGuard(m_aMutex);
     247           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     248             : 
     249           0 :     return m_xRow->getBlob(m_nPos);
     250             : }
     251             : 
     252           0 : Reference< XClob >  ODataColumn::getClob(void) throw( SQLException, RuntimeException, std::exception )
     253             : {
     254           0 :     MutexGuard aGuard(m_aMutex);
     255           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     256             : 
     257           0 :     return m_xRow->getClob(m_nPos);
     258             : }
     259             : 
     260           0 : Reference< XArray >  ODataColumn::getArray(void) throw( SQLException, RuntimeException, std::exception )
     261             : {
     262           0 :     MutexGuard aGuard(m_aMutex);
     263           0 :     ::connectivity::checkDisposed(!m_xRow.is());
     264             : 
     265           0 :     return m_xRow->getArray(m_nPos);
     266             : }
     267             : 
     268             : // ::com::sun::star::sdb::XColumnUpdate
     269           0 : void ODataColumn::updateNull(void) throw( SQLException, RuntimeException, std::exception )
     270             : {
     271           0 :     MutexGuard aGuard( m_aMutex );
     272           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     273             : 
     274           0 :     m_xRowUpdate->updateNull(m_nPos);
     275           0 : }
     276             : 
     277           0 : void ODataColumn::updateBoolean(sal_Bool x) throw( SQLException, RuntimeException, std::exception )
     278             : {
     279           0 :     MutexGuard aGuard( m_aMutex );
     280           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     281             : 
     282           0 :     m_xRowUpdate->updateBoolean(m_nPos, x);
     283           0 : }
     284             : 
     285           0 : void ODataColumn::updateByte(sal_Int8 x) throw( SQLException, RuntimeException, std::exception )
     286             : {
     287           0 :     MutexGuard aGuard( m_aMutex );
     288           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     289             : 
     290           0 :     m_xRowUpdate->updateByte(m_nPos, x);
     291           0 : }
     292             : 
     293           0 : void ODataColumn::updateShort(sal_Int16 x) throw( SQLException, RuntimeException, std::exception )
     294             : {
     295           0 :     MutexGuard aGuard( m_aMutex );
     296           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     297             : 
     298           0 :     m_xRowUpdate->updateShort(m_nPos, x);
     299           0 : }
     300             : 
     301           0 : void ODataColumn::updateInt(sal_Int32 x) throw( SQLException, RuntimeException, std::exception )
     302             : {
     303           0 :     MutexGuard aGuard( m_aMutex );
     304           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     305             : 
     306           0 :     m_xRowUpdate->updateInt(m_nPos, x);
     307           0 : }
     308             : 
     309           0 : void ODataColumn::updateLong(sal_Int64 x) throw( SQLException, RuntimeException, std::exception )
     310             : {
     311           0 :     MutexGuard aGuard( m_aMutex );
     312           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     313             : 
     314           0 :     m_xRowUpdate->updateLong(m_nPos, x);
     315           0 : }
     316             : 
     317           0 : void ODataColumn::updateFloat(float x) throw( SQLException, RuntimeException, std::exception )
     318             : {
     319           0 :     MutexGuard aGuard( m_aMutex );
     320           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     321             : 
     322           0 :     m_xRowUpdate->updateFloat(m_nPos, x);
     323           0 : }
     324             : 
     325           0 : void ODataColumn::updateDouble(double x) throw( SQLException, RuntimeException, std::exception )
     326             : {
     327           0 :     MutexGuard aGuard( m_aMutex );
     328           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     329             : 
     330           0 :     m_xRowUpdate->updateDouble(m_nPos, x);
     331           0 : }
     332             : 
     333           0 : void ODataColumn::updateString(const OUString& x) throw( SQLException, RuntimeException, std::exception )
     334             : {
     335           0 :     MutexGuard aGuard( m_aMutex );
     336           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     337             : 
     338           0 :     m_xRowUpdate->updateString(m_nPos, x);
     339           0 : }
     340             : 
     341           0 : void ODataColumn::updateBytes(const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException, std::exception )
     342             : {
     343           0 :     MutexGuard aGuard( m_aMutex );
     344           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     345             : 
     346           0 :     m_xRowUpdate->updateBytes(m_nPos, x);
     347           0 : }
     348             : 
     349           0 : void ODataColumn::updateDate(const com::sun::star::util::Date& x) throw( SQLException, RuntimeException, std::exception )
     350             : {
     351           0 :     MutexGuard aGuard( m_aMutex );
     352           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     353             : 
     354           0 :     m_xRowUpdate->updateDate(m_nPos, x);
     355           0 : }
     356             : 
     357           0 : void ODataColumn::updateTime(const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException, std::exception )
     358             : {
     359           0 :     MutexGuard aGuard( m_aMutex );
     360           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     361             : 
     362           0 :     m_xRowUpdate->updateTime(m_nPos, x);
     363           0 : }
     364             : 
     365           0 : void ODataColumn::updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException, std::exception )
     366             : {
     367           0 :     MutexGuard aGuard( m_aMutex );
     368           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     369             : 
     370           0 :     m_xRowUpdate->updateTimestamp(m_nPos, x);
     371           0 : }
     372             : 
     373           0 : void ODataColumn::updateCharacterStream(const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException, std::exception )
     374             : {
     375           0 :     MutexGuard aGuard( m_aMutex );
     376           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     377             : 
     378           0 :     m_xRowUpdate->updateCharacterStream(m_nPos, x, length);
     379           0 : }
     380             : 
     381           0 : void ODataColumn::updateBinaryStream(const Reference< ::com::sun::star::io::XInputStream > & x, sal_Int32 length) throw( SQLException, RuntimeException, std::exception )
     382             : {
     383           0 :     MutexGuard aGuard( m_aMutex );
     384           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     385             : 
     386           0 :     m_xRowUpdate->updateBinaryStream(m_nPos, x, length);
     387           0 : }
     388             : 
     389           0 : void ODataColumn::updateNumericObject(const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException, std::exception )
     390             : {
     391           0 :     MutexGuard aGuard( m_aMutex );
     392           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     393             : 
     394           0 :     m_xRowUpdate->updateNumericObject(m_nPos, x, scale);
     395           0 : }
     396             : 
     397           0 : void ODataColumn::updateObject(const Any& x) throw( SQLException, RuntimeException, std::exception )
     398             : {
     399           0 :     MutexGuard aGuard( m_aMutex );
     400           0 :     ::connectivity::checkDisposed(!m_xRowUpdate.is());
     401             : 
     402           0 :     m_xRowUpdate->updateObject(m_nPos, x);
     403           0 : }
     404             : 
     405             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10