LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_sequenceresultset.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 25 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            :  *    Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
      32                 :            :  *
      33                 :            :  *    The contents of this file are subject to the Mozilla Public License Version
      34                 :            :  *    1.1 (the "License"); you may not use this file except in compliance with
      35                 :            :  *    the License or as specified alternatively below. You may obtain a copy of
      36                 :            :  *    the License at http://www.mozilla.org/MPL/
      37                 :            :  *
      38                 :            :  *    Software distributed under the License is distributed on an "AS IS" basis,
      39                 :            :  *    WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      40                 :            :  *    for the specific language governing rights and limitations under the
      41                 :            :  *    License.
      42                 :            :  *
      43                 :            :  *    Major Contributor(s):
      44                 :            :  *    [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
      45                 :            :  *
      46                 :            :  *    All Rights Reserved.
      47                 :            :  *
      48                 :            :  *    For minor contributions see the git repository.
      49                 :            :  *
      50                 :            :  *    Alternatively, the contents of this file may be used under the terms of
      51                 :            :  *    either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      52                 :            :  *    the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
      53                 :            :  *    in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
      54                 :            :  *    instead of those above.
      55                 :            :  *
      56                 :            :  ************************************************************************/
      57                 :            : 
      58                 :            : 
      59                 :            : #include "pq_sequenceresultset.hxx"
      60                 :            : #include "pq_sequenceresultsetmetadata.hxx"
      61                 :            : 
      62                 :            : 
      63                 :            : using rtl::OUString;
      64                 :            : 
      65                 :            : using com::sun::star::sdbc::XResultSetMetaData;
      66                 :            : 
      67                 :            : using com::sun::star::uno::Sequence;
      68                 :            : using com::sun::star::uno::Reference;
      69                 :            : using com::sun::star::uno::Any;
      70                 :            : 
      71                 :            : namespace pq_sdbc_driver
      72                 :            : {
      73                 :            : #define ASCII_STR(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
      74                 :            : 
      75                 :          0 : void SequenceResultSet::checkClosed()
      76                 :            :     throw ( com::sun::star::sdbc::SQLException,
      77                 :            :             com::sun::star::uno::RuntimeException )
      78                 :            : {
      79                 :            :     // we never close :o)
      80                 :          0 : }
      81                 :            : 
      82                 :            : 
      83                 :          0 : Any SequenceResultSet::getValue( sal_Int32 columnIndex )
      84                 :            : {
      85                 :          0 :     m_wasNull = ! m_data[m_row][columnIndex -1 ].hasValue();
      86                 :          0 :     return m_data[m_row][columnIndex -1 ];
      87                 :            : }
      88                 :            : 
      89                 :          0 : SequenceResultSet::SequenceResultSet(
      90                 :            :     const ::rtl::Reference< RefCountedMutex > & mutex,
      91                 :            :     const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
      92                 :            :     const Sequence< OUString > &colNames,
      93                 :            :     const Sequence< Sequence< Any > > &data,
      94                 :            :     const Reference< com::sun::star::script::XTypeConverter > & tc,
      95                 :            :     const ColumnMetaDataVector *pVec) :
      96                 :            :     BaseResultSet( mutex, owner, data.getLength(), colNames.getLength(),tc ),
      97                 :            :     m_data(data ),
      98                 :          0 :     m_columnNames( colNames )
      99                 :            : {
     100                 :          0 :     if( pVec )
     101                 :            :     {
     102                 :          0 :         m_meta = new SequenceResultSetMetaData( mutex, *pVec, m_columnNames.getLength() );
     103                 :            :     }
     104                 :          0 : }
     105                 :            : 
     106                 :          0 : SequenceResultSet::~SequenceResultSet()
     107                 :            : {
     108                 :            : 
     109                 :          0 : }
     110                 :            : 
     111                 :          0 : void SequenceResultSet::close(  )
     112                 :            :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
     113                 :            : {
     114                 :            :     // a noop
     115                 :          0 : }
     116                 :            : 
     117                 :          0 : Reference< XResultSetMetaData > SAL_CALL SequenceResultSet::getMetaData(  )
     118                 :            :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
     119                 :            : {
     120                 :          0 :     if( ! m_meta.is() )
     121                 :            :     {
     122                 :            :         // Oh no, not again
     123                 :            :         throw ::com::sun::star::sdbc::SQLException(
     124                 :            :             ASCII_STR( "pq_sequenceresultset: no meta supported " ), *this,
     125                 :            :         // I did not find "IM001" in a specific standard,
     126                 :            :         // but it seems to be used by other systems (such as ODBC)
     127                 :            :         // and some parts of LibreOffice special-case it.
     128                 :          0 :             OUString( ASCII_STR("IM001") ), 1, Any() );
     129                 :            :     }
     130                 :          0 :     return m_meta;
     131                 :            : }
     132                 :            : 
     133                 :            : 
     134                 :          0 : sal_Int32 SAL_CALL SequenceResultSet::findColumn(
     135                 :            :     const ::rtl::OUString& columnName )
     136                 :            :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
     137                 :            : {
     138                 :            :     // no need to guard, as all members are readonly !
     139                 :          0 :     sal_Int32 ret = -1;
     140                 :          0 :     for( int i = 0 ;i < m_fieldCount ; i ++ )
     141                 :            :     {
     142                 :          0 :         if( columnName == m_columnNames[i] )
     143                 :            :         {
     144                 :          0 :             ret = i+1;
     145                 :          0 :             break;
     146                 :            :         }
     147                 :            :     }
     148                 :          0 :     return ret;
     149                 :            : }
     150                 :            : }

Generated by: LCOV version 1.10