LCOV - code coverage report
Current view: top level - ucbhelper/source/provider - resultsetmetadata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 54 174 31.0 %
Date: 2012-08-25 Functions: 12 33 36.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 39 271 14.4 %

           Branch data     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                 :            : 
      21                 :            : /**************************************************************************
      22                 :            :                                 TODO
      23                 :            :  **************************************************************************
      24                 :            : 
      25                 :            :  *************************************************************************/
      26                 :            : 
      27                 :            : #include "osl/diagnose.h"
      28                 :            : #include <com/sun/star/beans/Property.hpp>
      29                 :            : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      30                 :            : #include <com/sun/star/io/XInputStream.hpp>
      31                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      32                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      33                 :            : #include <com/sun/star/sdbc/XArray.hpp>
      34                 :            : #include <com/sun/star/sdbc/XBlob.hpp>
      35                 :            : #include <com/sun/star/sdbc/XClob.hpp>
      36                 :            : #include <com/sun/star/sdbc/XRef.hpp>
      37                 :            : #include <com/sun/star/util/Date.hpp>
      38                 :            : #include <com/sun/star/util/Time.hpp>
      39                 :            : #include <com/sun/star/util/DateTime.hpp>
      40                 :            : #include <ucbhelper/resultsetmetadata.hxx>
      41                 :            : 
      42                 :            : using namespace com::sun::star::beans;
      43                 :            : using namespace com::sun::star::io;
      44                 :            : using namespace com::sun::star::lang;
      45                 :            : using namespace com::sun::star::sdbc;
      46                 :            : using namespace com::sun::star::uno;
      47                 :            : using namespace com::sun::star::util;
      48                 :            : 
      49                 :            : using ::rtl::OUString;
      50                 :            : 
      51                 :            : namespace ucbhelper_impl {
      52                 :            : 
      53                 :        146 : struct ResultSetMetaData_Impl
      54                 :            : {
      55                 :            :     osl::Mutex                                      m_aMutex;
      56                 :            :     std::vector< ::ucbhelper::ResultSetColumnData > m_aColumnData;
      57                 :            :     sal_Bool                                        m_bObtainedTypes;
      58                 :            :     sal_Bool                                        m_bGlobalReadOnlyValue;
      59                 :            : 
      60                 :          8 :     ResultSetMetaData_Impl( sal_Int32 nSize )
      61                 :            :     : m_aColumnData( nSize ), m_bObtainedTypes( sal_False ),
      62         [ +  - ]:          8 :       m_bGlobalReadOnlyValue( sal_True ) {}
      63                 :            : 
      64                 :        138 :     ResultSetMetaData_Impl(
      65                 :            :         const std::vector< ::ucbhelper::ResultSetColumnData >& rColumnData )
      66                 :            :     : m_aColumnData( rColumnData ), m_bObtainedTypes( sal_False ),
      67         [ +  - ]:        138 :       m_bGlobalReadOnlyValue( sal_False ) {}
      68                 :            : };
      69                 :            : 
      70                 :            : }
      71                 :            : 
      72                 :            : using namespace ucbhelper_impl;
      73                 :            : 
      74                 :            : namespace ucbhelper {
      75                 :            : 
      76                 :            : //=========================================================================
      77                 :            : //=========================================================================
      78                 :            : //
      79                 :            : // ResultSetMetaData Implementation.
      80                 :            : //
      81                 :            : //=========================================================================
      82                 :            : //=========================================================================
      83                 :            : 
      84                 :          8 : ResultSetMetaData::ResultSetMetaData(
      85                 :            :                         const Reference< XMultiServiceFactory >& rxSMgr,
      86                 :            :                         const Sequence< Property >& rProps,
      87                 :            :                         sal_Bool bReadOnly )
      88         [ +  - ]:          8 : : m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ),
      89                 :            :   m_xSMgr( rxSMgr ),
      90                 :            :   m_aProps( rProps ),
      91 [ +  - ][ +  - ]:         16 :   m_bReadOnly( bReadOnly )
      92                 :            : {
      93                 :          8 : }
      94                 :            : 
      95                 :            : //=========================================================================
      96                 :        138 : ResultSetMetaData::ResultSetMetaData(
      97                 :            :                         const Reference< XMultiServiceFactory >& rxSMgr,
      98                 :            :                         const Sequence< Property >& rProps,
      99                 :            :                         const std::vector< ResultSetColumnData >& rColumnData )
     100         [ +  - ]:        138 : : m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ),
     101                 :            :   m_xSMgr( rxSMgr ),
     102                 :            :   m_aProps( rProps ),
     103 [ +  - ][ +  - ]:        276 :   m_bReadOnly( sal_True )
     104                 :            : {
     105                 :            :     OSL_ENSURE( rColumnData.size() == sal_uInt32( rProps.getLength() ),
     106                 :            :                 "ResultSetMetaData ctor - different array sizes!" );
     107                 :        138 : }
     108                 :            : 
     109                 :            : //=========================================================================
     110                 :            : // virtual
     111         [ +  - ]:        146 : ResultSetMetaData::~ResultSetMetaData()
     112                 :            : {
     113 [ +  - ][ +  - ]:        146 :     delete m_pImpl;
     114         [ -  + ]:        292 : }
     115                 :            : 
     116                 :            : //=========================================================================
     117                 :            : //
     118                 :            : // XInterface methods.
     119                 :            : //
     120                 :            : //=========================================================================
     121                 :            : 
     122 [ #  # ][ #  # ]:        308 : XINTERFACE_IMPL_2( ResultSetMetaData,
                 [ #  # ]
     123                 :            :                    XTypeProvider,
     124                 :            :                    XResultSetMetaData );
     125                 :            : 
     126                 :            : //=========================================================================
     127                 :            : //
     128                 :            : // XTypeProvider methods.
     129                 :            : //
     130                 :            : //=========================================================================
     131                 :            : 
     132 [ #  # ][ #  # ]:          0 : XTYPEPROVIDER_IMPL_2( ResultSetMetaData,
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     133                 :            :                       XTypeProvider,
     134                 :            :                       XResultSetMetaData );
     135                 :            : 
     136                 :            : //=========================================================================
     137                 :            : //
     138                 :            : // XResultSetMetaData methods.
     139                 :            : //
     140                 :            : //=========================================================================
     141                 :            : 
     142                 :            : // virtual
     143                 :          0 : sal_Int32 SAL_CALL ResultSetMetaData::getColumnCount()
     144                 :            :     throw( SQLException, RuntimeException )
     145                 :            : {
     146                 :          0 :     return m_aProps.getLength();
     147                 :            : }
     148                 :            : 
     149                 :            : //=========================================================================
     150                 :            : // virtual
     151                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
     152                 :            :     throw( SQLException, RuntimeException )
     153                 :            : {
     154                 :            :     /*
     155                 :            :         Checks whether column is automatically numbered, which makes it
     156                 :            :         read-only.
     157                 :            :      */
     158                 :            : 
     159 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     160                 :          0 :         return sal_False;
     161                 :            : 
     162                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement;
     163                 :            : }
     164                 :            : 
     165                 :            : //=========================================================================
     166                 :            : // virtual
     167                 :        146 : sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
     168                 :            :     throw( SQLException, RuntimeException )
     169                 :            : {
     170 [ +  - ][ -  + ]:        146 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ -  + ]
     171                 :          0 :         return sal_False;
     172                 :            : 
     173                 :        146 :     return m_pImpl->m_aColumnData[ column - 1 ].isCaseSensitive;
     174                 :            : }
     175                 :            : 
     176                 :            : //=========================================================================
     177                 :            : // virtual
     178                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
     179                 :            :     throw( SQLException, RuntimeException )
     180                 :            : {
     181                 :            :     /*
     182                 :            :         Checks whether the value stored in column can be used in a
     183                 :            :         WHERE clause.
     184                 :            :      */
     185                 :            : 
     186 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     187                 :          0 :         return sal_False;
     188                 :            : 
     189                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isSearchable;
     190                 :            : }
     191                 :            : 
     192                 :            : //=========================================================================
     193                 :            : // virtual
     194                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
     195                 :            :     throw( SQLException, RuntimeException )
     196                 :            : {
     197                 :            :     /*
     198                 :            :         Checks whether column is a cash value.
     199                 :            :      */
     200                 :            : 
     201 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     202                 :          0 :         return sal_False;
     203                 :            : 
     204                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isCurrency;
     205                 :            : }
     206                 :            : 
     207                 :            : //=========================================================================
     208                 :            : // virtual
     209                 :          0 : sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
     210                 :            :     throw( SQLException, RuntimeException )
     211                 :            : {
     212                 :            :     /*
     213                 :            :         Checks whether a NULL can be stored in column.
     214                 :            :         Possible values: see com/sun/star/sdbc/ColumnValue.idl
     215                 :            :      */
     216                 :            : 
     217 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     218                 :          0 :         return ColumnValue::NULLABLE;
     219                 :            : 
     220                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isNullable;
     221                 :            : }
     222                 :            : 
     223                 :            : //=========================================================================
     224                 :            : // virtual
     225                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
     226                 :            :     throw( SQLException, RuntimeException )
     227                 :            : {
     228                 :            :     /*
     229                 :            :         Checks whether the value stored in column is a signed number.
     230                 :            :      */
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     233                 :          0 :         return sal_False;
     234                 :            : 
     235                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isSigned;
     236                 :            : }
     237                 :            : 
     238                 :            : //=========================================================================
     239                 :            : // virtual
     240                 :          0 : sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
     241                 :            :     throw( SQLException, RuntimeException )
     242                 :            : {
     243                 :            :     /*
     244                 :            :         Gets the normal maximum width in characters for column.
     245                 :            :      */
     246                 :            : 
     247 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     248                 :          0 :         return 16;
     249                 :            : 
     250                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].columnDisplaySize;
     251                 :            : }
     252                 :            : 
     253                 :            : //=========================================================================
     254                 :            : // virtual
     255                 :          0 : OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
     256                 :            :     throw( SQLException, RuntimeException )
     257                 :            : {
     258                 :            :     /*
     259                 :            :         Gets the suggested column title for column, to be used in print-
     260                 :            :         outs and displays.
     261                 :            :      */
     262                 :            : 
     263 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     264                 :          0 :         return OUString();
     265                 :            : 
     266                 :          0 :     OUString aLabel = m_pImpl->m_aColumnData[ column - 1 ].columnLabel;
     267         [ #  # ]:          0 :     if ( !aLabel.isEmpty() )
     268                 :          0 :         return aLabel;
     269                 :            : 
     270                 :          0 :     return m_aProps.getConstArray()[ column - 1 ].Name;
     271                 :            : }
     272                 :            : 
     273                 :            : //=========================================================================
     274                 :            : // virtual
     275                 :        146 : OUString SAL_CALL ResultSetMetaData::getColumnName( sal_Int32 column )
     276                 :            :     throw( SQLException, RuntimeException )
     277                 :            : {
     278                 :            :     /*
     279                 :            :         Gets the name of column.
     280                 :            :      */
     281                 :            : 
     282 [ +  - ][ -  + ]:        146 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ -  + ]
     283                 :          0 :         return OUString();
     284                 :            : 
     285                 :        146 :     return m_aProps.getConstArray()[ column - 1 ].Name;
     286                 :            : }
     287                 :            : 
     288                 :            : //=========================================================================
     289                 :            : // virtual
     290                 :          0 : OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
     291                 :            :     throw( SQLException, RuntimeException )
     292                 :            : {
     293                 :            :     /*
     294                 :            :         Gets the schema name for the table from which column of this
     295                 :            :         result set was derived.
     296                 :            :         Because this feature is not widely supported, the return value
     297                 :            :         for many DBMSs will be an empty string.
     298                 :            :      */
     299                 :            : 
     300 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     301                 :          0 :         return OUString();
     302                 :            : 
     303                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].schemaName;
     304                 :            : }
     305                 :            : 
     306                 :            : //=========================================================================
     307                 :            : // virtual
     308                 :          0 : sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
     309                 :            :     throw( SQLException, RuntimeException )
     310                 :            : {
     311                 :            :     /*
     312                 :            :         For number types, getprecision gets the number of decimal digits
     313                 :            :         in column.
     314                 :            :         For character types, it gets the maximum length in characters for
     315                 :            :         column.
     316                 :            :         For binary types, it gets the maximum length in bytes for column.
     317                 :            :      */
     318                 :            : 
     319 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     320                 :          0 :         return -1;
     321                 :            : 
     322                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].precision;
     323                 :            : }
     324                 :            : 
     325                 :            : //=========================================================================
     326                 :            : // virtual
     327                 :          0 : sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
     328                 :            :     throw( SQLException, RuntimeException )
     329                 :            : {
     330                 :            :     /*
     331                 :            :         Gets the number of digits to the right of the decimal point for
     332                 :            :         values in column.
     333                 :            :      */
     334                 :            : 
     335 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     336                 :          0 :         return 0;
     337                 :            : 
     338                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].scale;
     339                 :            : }
     340                 :            : 
     341                 :            : //=========================================================================
     342                 :            : // virtual
     343                 :          0 : OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
     344                 :            :     throw( SQLException, RuntimeException )
     345                 :            : {
     346                 :            :     /*
     347                 :            :         Gets the name of the table from which column of this result set
     348                 :            :         was derived or "" if there is none (for example, for a join).
     349                 :            :         Because this feature is not widely supported, the return value
     350                 :            :         for many DBMSs will be an empty string.
     351                 :            :      */
     352                 :            : 
     353 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     354                 :          0 :         return OUString();
     355                 :            : 
     356                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].tableName;
     357                 :            : }
     358                 :            : 
     359                 :            : //=========================================================================
     360                 :            : // virtual
     361                 :          0 : OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
     362                 :            :     throw( SQLException, RuntimeException )
     363                 :            : {
     364                 :            :     /*
     365                 :            :         Gets the catalog name for the table from which column of this
     366                 :            :         result set was derived.
     367                 :            :         Because this feature is not widely supported, the return value
     368                 :            :         for many DBMSs will be an empty string.
     369                 :            :      */
     370                 :            : 
     371 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     372                 :          0 :         return OUString();
     373                 :            : 
     374                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].catalogName;
     375                 :            : }
     376                 :            : 
     377                 :            : //=========================================================================
     378                 :            : // virtual
     379                 :        138 : sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column )
     380                 :            :     throw( SQLException, RuntimeException )
     381                 :            : {
     382                 :            :     /*
     383                 :            :         Gets the JDBC type for the value stored in column. ... The STRUCT
     384                 :            :         and DISTINCT type codes are always returned for structured and
     385                 :            :         distinct types, regardless of whether the value will be mapped
     386                 :            :         according to the standard mapping or be a custom mapping.
     387                 :            :      */
     388                 :            : 
     389 [ +  - ][ -  + ]:        138 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ -  + ]
     390                 :          0 :         return DataType::SQLNULL;
     391                 :            : 
     392         [ +  - ]:        276 :     if ( m_aProps.getConstArray()[ column - 1 ].Type
     393                 :        276 :             == getCppuVoidType() )
     394                 :            :     {
     395                 :            :         // No type given. Try UCB's Properties Manager...
     396                 :            : 
     397         [ +  - ]:        138 :         osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
     398                 :            : 
     399         [ +  - ]:        138 :         if ( !m_pImpl->m_bObtainedTypes )
     400                 :            :         {
     401                 :            :             try
     402                 :            :             {
     403                 :            :                 Reference< XPropertySetInfo > xInfo(
     404         [ +  - ]:        138 :                             m_xSMgr->createInstance(
     405                 :            :                                 OUString(
     406                 :        138 :                                     "com.sun.star.ucb.PropertiesManager" ) ),
     407 [ +  - ][ +  - ]:        138 :                             UNO_QUERY );
     408         [ +  - ]:        138 :                 if ( xInfo.is() )
     409                 :            :                 {
     410                 :            : 
     411                 :            :     // Less (remote) calls...
     412                 :            : 
     413 [ +  - ][ +  - ]:        138 :                     Sequence< Property > aProps = xInfo->getProperties();
     414                 :        138 :                     const Property* pProps1 = aProps.getConstArray();
     415                 :        138 :                     sal_Int32 nCount1 = aProps.getLength();
     416                 :            : 
     417                 :        138 :                     sal_Int32 nCount = m_aProps.getLength();
     418         [ +  - ]:        138 :                     Property* pProps = m_aProps.getArray();
     419         [ +  + ]:        276 :                     for ( sal_Int32 n = 0; n < nCount; ++n )
     420                 :            :                     {
     421                 :        138 :                         Property& rProp = pProps[ n ];
     422                 :            : 
     423         [ +  - ]:      11454 :                         for ( sal_Int32 m = 0; m < nCount1; ++m )
     424                 :            :                         {
     425                 :      11454 :                             const Property& rProp1 = pProps1[ m ];
     426         [ +  + ]:      11454 :                             if ( rProp.Name == rProp1.Name )
     427                 :            :                             {
     428                 :            :                                 // Found...
     429                 :        138 :                                 rProp.Type = rProp1.Type;
     430                 :        138 :                                 break;
     431                 :            :                             }
     432                 :            :                         }
     433         [ +  - ]:        138 :                     }
     434                 :        138 :                 }
     435                 :            :             }
     436      [ #  #  # ]:          0 :             catch ( RuntimeException& )
     437                 :            :             {
     438                 :          0 :                 throw;
     439                 :            :             }
     440         [ #  # ]:          0 :             catch ( Exception& )
     441                 :            :             {
     442                 :            :                 // createInstance
     443                 :            :             }
     444                 :            : 
     445                 :        138 :             m_pImpl->m_bObtainedTypes = sal_True;
     446         [ +  - ]:        138 :         }
     447                 :            :     }
     448                 :            : 
     449                 :        138 :     const Type& rType = m_aProps.getConstArray()[ column - 1 ].Type;
     450                 :        138 :     sal_Int32 nType = DataType::OTHER;
     451                 :            : 
     452         [ +  - ]:        138 :     if ( rType == getCppuType( static_cast< const rtl::OUString * >( 0 ) ) )
     453                 :        138 :         nType = DataType::VARCHAR;  // XRow::getString
     454         [ #  # ]:          0 :     else if ( rType == getCppuBooleanType() )
     455                 :          0 :         nType = DataType::BIT;      // XRow::getBoolean
     456         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
     457                 :          0 :         nType = DataType::INTEGER;  // XRow::getInt
     458         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const sal_Int64 * >( 0 ) ) )
     459                 :          0 :         nType = DataType::BIGINT;   // XRow::getLong
     460         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const sal_Int16 * >( 0 ) ) )
     461                 :          0 :         nType = DataType::SMALLINT; // XRow::getShort
     462         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const sal_Int8 * >( 0 ) ) )
     463                 :          0 :         nType = DataType::TINYINT;  // XRow::getByte
     464         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const float * >( 0 ) ) )
     465                 :          0 :         nType = DataType::REAL;     // XRow::getFloat
     466         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const double * >( 0 ) ) )
     467                 :          0 :         nType = DataType::DOUBLE;   // XRow::getDouble
     468         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const Sequence< sal_Int8 > * >( 0 ) ) )
     469                 :          0 :         nType = DataType::VARBINARY;// XRow::getBytes
     470         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const Date * >( 0 ) ) )
     471                 :          0 :         nType = DataType::DATE;     // XRow::getDate
     472         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const Time * >( 0 ) ) )
     473                 :          0 :         nType = DataType::TIME;     // XRow::getTime
     474         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< const DateTime * >( 0 ) ) )
     475                 :          0 :         nType = DataType::TIMESTAMP;// XRow::getTimestamp
     476         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< Reference< XInputStream > * >( 0 ) ) )
     477                 :          0 :         nType = DataType::LONGVARBINARY;    // XRow::getBinaryStream
     478                 :            : //      nType = DataType::LONGVARCHAR;      // XRow::getCharacterStream
     479         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< Reference< XClob > * >( 0 ) ) )
     480                 :          0 :         nType = DataType::CLOB; // XRow::getClob
     481         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< Reference< XBlob > * >( 0 ) ) )
     482                 :          0 :         nType = DataType::BLOB; // XRow::getBlob
     483         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< Reference< XArray > * >( 0 ) ) )
     484                 :          0 :         nType = DataType::ARRAY;// XRow::getArray
     485         [ #  # ]:          0 :     else if ( rType == getCppuType( static_cast< Reference< XRef > * >( 0 ) ) )
     486                 :          0 :         nType = DataType::REF;// XRow::getRef
     487                 :            :     else
     488                 :          0 :         nType = DataType::OBJECT;// XRow::getObject
     489                 :            : 
     490                 :        138 :     return nType;
     491                 :            : }
     492                 :            : 
     493                 :            : //=========================================================================
     494                 :            : // virtual
     495                 :          0 : OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
     496                 :            :     throw( SQLException, RuntimeException )
     497                 :            : {
     498                 :            :     /*
     499                 :            :         Gets the type name used by this particular data source for the
     500                 :            :         values stored in column. If the type code for the type of value
     501                 :            :         stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
     502                 :            :         returns a fully-qualified SQL type name.
     503                 :            :      */
     504                 :            : 
     505 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     506                 :          0 :         return OUString();
     507                 :            : 
     508                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].columnTypeName;
     509                 :            : }
     510                 :            : 
     511                 :            : //=========================================================================
     512                 :            : // virtual
     513                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
     514                 :            :     throw( SQLException, RuntimeException )
     515                 :            : {
     516         [ #  # ]:          0 :     if ( m_pImpl->m_bGlobalReadOnlyValue )
     517                 :          0 :         return m_bReadOnly;
     518                 :            : 
     519 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     520                 :          0 :         return sal_True;
     521                 :            : 
     522                 :            :     // autoincrement==true => readonly
     523                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement ||
     524 [ #  # ][ #  # ]:          0 :            m_pImpl->m_aColumnData[ column - 1 ].isReadOnly;
     525                 :            : }
     526                 :            : 
     527                 :            : //=========================================================================
     528                 :            : // virtual
     529                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
     530                 :            :     throw( SQLException, RuntimeException )
     531                 :            : {
     532         [ #  # ]:          0 :     if ( m_pImpl->m_bGlobalReadOnlyValue )
     533                 :          0 :         return !m_bReadOnly;
     534                 :            : 
     535 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     536                 :          0 :         return sal_False;
     537                 :            : 
     538                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isWritable;
     539                 :            : }
     540                 :            : 
     541                 :            : //=========================================================================
     542                 :            : // virtual
     543                 :          0 : sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
     544                 :            :     throw( SQLException, RuntimeException )
     545                 :            : {
     546         [ #  # ]:          0 :     if ( m_pImpl->m_bGlobalReadOnlyValue )
     547                 :          0 :         return !m_bReadOnly;
     548                 :            : 
     549 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     550                 :          0 :         return sal_False;
     551                 :            : 
     552                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].isDefinitelyWritable;
     553                 :            : }
     554                 :            : 
     555                 :            : //=========================================================================
     556                 :            : // virtual
     557                 :          0 : OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
     558                 :            :     throw( SQLException, RuntimeException )
     559                 :            : {
     560                 :            :     /*
     561                 :            :           Returns the fully-qualified name of the service whose instances
     562                 :            :          are manufactured if XResultSet::getObject is called to retrieve
     563                 :            :         a value from the column.
     564                 :            :      */
     565                 :            : 
     566 [ #  # ][ #  # ]:          0 :     if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
                 [ #  # ]
     567                 :          0 :         return OUString();
     568                 :            : 
     569                 :          0 :     return m_pImpl->m_aColumnData[ column - 1 ].columnServiceName;
     570                 :            : }
     571                 :            : 
     572                 :            : } // namespace ucbhelper
     573                 :            : 
     574                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10