LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_sequenceresultset.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 24 0.0 %
Date: 2014-11-03 Functions: 0 8 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             :  *
       4             :  *  Effective License of whole file:
       5             :  *
       6             :  *    This library is free software; you can redistribute it and/or
       7             :  *    modify it under the terms of the GNU Lesser General Public
       8             :  *    License version 2.1, as published by the Free Software Foundation.
       9             :  *
      10             :  *    This library is distributed in the hope that it will be useful,
      11             :  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13             :  *    Lesser General Public License for more details.
      14             :  *
      15             :  *    You should have received a copy of the GNU Lesser General Public
      16             :  *    License along with this library; if not, write to the Free Software
      17             :  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      18             :  *    MA  02111-1307  USA
      19             :  *
      20             :  *  Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
      21             :  *
      22             :  *    The Contents of this file are made available subject to the terms of
      23             :  *    the GNU Lesser General Public License Version 2.1
      24             :  *
      25             :  *    Copyright: 2000 by Sun Microsystems, Inc.
      26             :  *
      27             :  *    Contributor(s): Joerg Budischewski
      28             :  *
      29             :  *  All parts contributed on or after August 2011:
      30             :  *
      31             :  *    This Source Code Form is subject to the terms of the Mozilla Public
      32             :  *    License, v. 2.0. If a copy of the MPL was not distributed with this
      33             :  *    file, You can obtain one at http://mozilla.org/MPL/2.0/.
      34             :  *
      35             :  ************************************************************************/
      36             : 
      37             : 
      38             : #include "pq_sequenceresultset.hxx"
      39             : #include "pq_sequenceresultsetmetadata.hxx"
      40             : 
      41             : #include <connectivity/dbexception.hxx>
      42             : 
      43             : using com::sun::star::sdbc::XResultSetMetaData;
      44             : 
      45             : using com::sun::star::uno::Sequence;
      46             : using com::sun::star::uno::Reference;
      47             : using com::sun::star::uno::Any;
      48             : 
      49             : namespace pq_sdbc_driver
      50             : {
      51             : 
      52           0 : void SequenceResultSet::checkClosed()
      53             :     throw ( com::sun::star::sdbc::SQLException,
      54             :             com::sun::star::uno::RuntimeException )
      55             : {
      56             :     // we never close :o)
      57           0 : }
      58             : 
      59             : 
      60           0 : Any SequenceResultSet::getValue( sal_Int32 columnIndex )
      61             : {
      62           0 :     m_wasNull = ! m_data[m_row][columnIndex -1 ].hasValue();
      63           0 :     return m_data[m_row][columnIndex -1 ];
      64             : }
      65             : 
      66           0 : SequenceResultSet::SequenceResultSet(
      67             :     const ::rtl::Reference< RefCountedMutex > & mutex,
      68             :     const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
      69             :     const Sequence< OUString > &colNames,
      70             :     const Sequence< Sequence< Any > > &data,
      71             :     const Reference< com::sun::star::script::XTypeConverter > & tc,
      72             :     const ColumnMetaDataVector *pVec) :
      73             :     BaseResultSet( mutex, owner, data.getLength(), colNames.getLength(),tc ),
      74             :     m_data(data ),
      75           0 :     m_columnNames( colNames )
      76             : {
      77           0 :     if( pVec )
      78             :     {
      79           0 :         m_meta = new SequenceResultSetMetaData( mutex, *pVec, m_columnNames.getLength() );
      80             :     }
      81           0 : }
      82             : 
      83           0 : SequenceResultSet::~SequenceResultSet()
      84             : {
      85             : 
      86           0 : }
      87             : 
      88           0 : void SequenceResultSet::close(  )
      89             :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      90             : {
      91             :     // a noop
      92           0 : }
      93             : 
      94           0 : Reference< XResultSetMetaData > SAL_CALL SequenceResultSet::getMetaData(  )
      95             :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
      96             : {
      97           0 :     if( ! m_meta.is() )
      98             :     {
      99             :         // Oh no, not again
     100             :         throw ::com::sun::star::sdbc::SQLException(
     101             :             "pq_sequenceresultset: no meta supported ", *this,
     102             :         // I did not find "IM001" in a specific standard,
     103             :         // but it seems to be used by other systems (such as ODBC)
     104             :         // and some parts of LibreOffice special-case it.
     105           0 :             OUString( "IM001" ), 1, Any() );
     106             :     }
     107           0 :     return m_meta;
     108             : }
     109             : 
     110             : 
     111           0 : sal_Int32 SAL_CALL SequenceResultSet::findColumn(
     112             :     const OUString& columnName )
     113             :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     114             : {
     115             :     // no need to guard, as all members are readonly !
     116           0 :     for( int i = 0 ;i < m_fieldCount ; i ++ )
     117             :     {
     118           0 :         if( columnName == m_columnNames[i] )
     119             :         {
     120           0 :             return i+1;
     121             :         }
     122             :     }
     123           0 :     ::dbtools::throwInvalidColumnException( columnName, *this );
     124             :     assert(false);
     125           0 :     return 0; // Never reached
     126             : }
     127             : }
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10