LCOV - code coverage report
Current view: top level - connectivity/source/drivers/postgresql - pq_sequenceresultsetmetadata.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 65 0.0 %
Date: 2014-04-14 Functions: 0 23 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: 200? 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             : #include "pq_sequenceresultsetmetadata.hxx"
      38             : 
      39             : #include <rtl/ustrbuf.hxx>
      40             : 
      41             : using com::sun::star::uno::Any;
      42             : 
      43             : using com::sun::star::uno::RuntimeException;
      44             : 
      45             : using com::sun::star::sdbc::SQLException;
      46             : 
      47             : namespace pq_sdbc_driver
      48             : {
      49             : 
      50           0 : SequenceResultSetMetaData::SequenceResultSetMetaData(
      51             :     const ::rtl::Reference< RefCountedMutex > & refMutex,
      52             :     const ColumnMetaDataVector &metaDataVector,
      53             :     int colCount ) :
      54             :     m_refMutex( refMutex ),
      55             :     m_columnData( metaDataVector ),
      56           0 :     m_colCount( colCount )
      57             : {
      58           0 : }
      59             : 
      60             : 
      61             : // Methods
      62           0 : sal_Int32 SequenceResultSetMetaData::getColumnCount(  )
      63             :     throw (SQLException, RuntimeException, std::exception)
      64             : {
      65           0 :     return m_colCount;
      66             : }
      67             : 
      68           0 : sal_Bool SequenceResultSetMetaData::isAutoIncrement( sal_Int32 column )
      69             :     throw (SQLException, RuntimeException, std::exception)
      70             : {
      71           0 :     checkColumnIndex( column );
      72           0 :     return m_columnData[column-1].isAutoIncrement;
      73             : }
      74             : 
      75           0 : sal_Bool SequenceResultSetMetaData::isCaseSensitive( sal_Int32 /* column */ )
      76             :     throw (SQLException, RuntimeException, std::exception)
      77             : {
      78             : 
      79           0 :     return sal_True; // ??? hmm, numeric types or
      80             : }
      81             : 
      82           0 : sal_Bool SequenceResultSetMetaData::isSearchable( sal_Int32 /* column */ ) throw (SQLException, RuntimeException, std::exception)
      83             : {
      84           0 :     return sal_True; // mmm, what types are not searchable ?
      85             : }
      86             : 
      87           0 : sal_Bool SequenceResultSetMetaData::isCurrency( sal_Int32 column ) throw (SQLException, RuntimeException, std::exception)
      88             : {
      89           0 :     checkColumnIndex( column );
      90           0 :     return m_columnData[column-1].isCurrency;
      91             : }
      92             : 
      93           0 : sal_Int32 SequenceResultSetMetaData::isNullable( sal_Int32 column )
      94             :     throw (SQLException, RuntimeException, std::exception)
      95             : {
      96           0 :     checkColumnIndex( column );
      97           0 :     return m_columnData[column-1].isNullable;
      98             : }
      99             : 
     100           0 : sal_Bool SequenceResultSetMetaData::isSigned( sal_Int32 /* column */ )
     101             :     throw (SQLException, RuntimeException, std::exception)
     102             : {
     103           0 :     return sal_True;
     104             : }
     105             : 
     106           0 : sal_Int32 SequenceResultSetMetaData::getColumnDisplaySize( sal_Int32 /* column */ )
     107             :     throw (SQLException, RuntimeException, std::exception)
     108             : {
     109           0 :     return 50;
     110             : }
     111             : 
     112           0 : OUString SequenceResultSetMetaData::getColumnLabel( sal_Int32 column )
     113             :     throw (SQLException, RuntimeException, std::exception)
     114             : {
     115           0 :     checkColumnIndex( column );
     116           0 :     return m_columnData[column-1].columnName;
     117             : }
     118             : 
     119           0 : OUString SequenceResultSetMetaData::getColumnName( sal_Int32 column ) throw (SQLException, RuntimeException, std::exception)
     120             : {
     121           0 :     checkColumnIndex( column );
     122           0 :     return m_columnData[column-1].columnName;
     123             : }
     124             : 
     125           0 : OUString SequenceResultSetMetaData::getSchemaName( sal_Int32 column ) throw (SQLException, RuntimeException, std::exception)
     126             : {
     127           0 :     checkColumnIndex( column );
     128           0 :     return m_columnData[column-1].schemaTableName;
     129             : }
     130             : 
     131             : 
     132             : 
     133           0 : sal_Int32 SequenceResultSetMetaData::getPrecision( sal_Int32 column )
     134             :     throw (SQLException, RuntimeException, std::exception)
     135             : {
     136           0 :     checkColumnIndex( column );
     137           0 :     return m_columnData[column-1].precision;
     138             : }
     139             : 
     140           0 : sal_Int32 SequenceResultSetMetaData::getScale( sal_Int32 column )
     141             :     throw (SQLException, RuntimeException, std::exception)
     142             : {
     143           0 :     checkColumnIndex( column );
     144           0 :     return m_columnData[column-1].scale;
     145             : }
     146             : 
     147           0 : OUString SequenceResultSetMetaData::getTableName( sal_Int32 column )
     148             :     throw (SQLException, RuntimeException, std::exception)
     149             : {
     150           0 :     checkColumnIndex( column );
     151           0 :     return m_columnData[column-1].tableName;
     152             : }
     153             : 
     154           0 : OUString SequenceResultSetMetaData::getCatalogName( sal_Int32 /* column */ )
     155             :     throw (SQLException, RuntimeException, std::exception)
     156             : {
     157             :     // can do this through XConnection.getCatalog() !
     158           0 :     return OUString();
     159             : }
     160           0 : sal_Int32 SequenceResultSetMetaData::getColumnType( sal_Int32 column )
     161             :     throw (SQLException, RuntimeException, std::exception)
     162             : {
     163           0 :     checkColumnIndex( column );
     164           0 :     return m_columnData[column-1].type;
     165             : }
     166             : 
     167           0 : OUString SequenceResultSetMetaData::getColumnTypeName( sal_Int32 column )
     168             :     throw (SQLException, RuntimeException, std::exception)
     169             : {
     170           0 :     checkColumnIndex( column );
     171           0 :     return m_columnData[column-1].typeName;
     172             : }
     173             : 
     174             : 
     175           0 : sal_Bool SequenceResultSetMetaData::isReadOnly( sal_Int32 /* column */ )
     176             :     throw (SQLException, RuntimeException, std::exception)
     177             : {
     178           0 :     return sal_False;
     179             : }
     180             : 
     181           0 : sal_Bool SequenceResultSetMetaData::isWritable( sal_Int32 column )
     182             :     throw (SQLException, RuntimeException, std::exception)
     183             : {
     184           0 :     return ! isReadOnly( column ); // what's the sense if this method ?
     185             : }
     186             : 
     187           0 : sal_Bool SequenceResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
     188             :     throw (SQLException, RuntimeException, std::exception)
     189             : {
     190           0 :     return isWritable(column); // uhh, now it becomes really esoteric ....
     191             : }
     192           0 : OUString SequenceResultSetMetaData::getColumnServiceName( sal_Int32 /* column */ )
     193             :     throw (SQLException, RuntimeException, std::exception)
     194             : {
     195           0 :     return OUString();
     196             : }
     197             : 
     198           0 : void SequenceResultSetMetaData::checkColumnIndex(sal_Int32 columnIndex)
     199             :     throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
     200             : {
     201           0 :     if( columnIndex < 1 || columnIndex > m_colCount )
     202             :     {
     203           0 :         OUStringBuffer buf(128);
     204             : 
     205           0 :         buf.appendAscii( "pq_sequenceresultsetmetadata: index out of range (expected 1 to " );
     206           0 :         buf.append( m_colCount );
     207           0 :         buf.appendAscii( ", got " );
     208           0 :         buf.append( columnIndex );
     209             :         throw SQLException(
     210           0 :             buf.makeStringAndClear(), *this, OUString(), 1, Any() );
     211             :     }
     212           0 : }
     213             : 
     214             : 
     215             : }
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10