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

Generated by: LCOV version 1.10