LCOV - code coverage report
Current view: top level - connectivity/source/drivers/dbase - DDatabaseMetaData.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 93 217 42.9 %
Date: 2012-08-25 Functions: 8 17 47.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 309 1164 26.5 %

           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                 :            : #include "dbase/DDatabaseMetaData.hxx"
      21                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      22                 :            : #include <com/sun/star/sdbc/ResultSetType.hpp>
      23                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      24                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      25                 :            : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
      26                 :            : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      27                 :            : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
      28                 :            : #include "FDatabaseMetaDataResultSet.hxx"
      29                 :            : #include <com/sun/star/lang/XUnoTunnel.hpp>
      30                 :            : #include "dbase/DIndex.hxx"
      31                 :            : #include "connectivity/FValue.hxx"
      32                 :            : #include <comphelper/extract.hxx>
      33                 :            : #include <comphelper/types.hxx>
      34                 :            : #include <ucbhelper/content.hxx>
      35                 :            : #include <rtl/logfile.hxx>
      36                 :            : 
      37                 :            : using namespace ::comphelper;
      38                 :            : using namespace connectivity::dbase;
      39                 :            : using namespace connectivity;
      40                 :            : using namespace ::com::sun::star::uno;
      41                 :            : using namespace ::com::sun::star::beans;
      42                 :            : using namespace ::com::sun::star::sdbcx;
      43                 :            : using namespace ::com::sun::star::sdbc;
      44                 :            : using namespace ::com::sun::star::container;
      45                 :            : using namespace ::com::sun::star::ucb;
      46                 :            : using namespace ::com::sun::star::lang;
      47                 :            : 
      48                 :         56 : ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(::connectivity::file::OConnection* _pCon)    :ODatabaseMetaData(_pCon)
      49                 :            : {
      50                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::ODbaseDatabaseMetaData" );
      51                 :         56 : }
      52                 :            : // -------------------------------------------------------------------------
      53                 :         56 : ODbaseDatabaseMetaData::~ODbaseDatabaseMetaData()
      54                 :            : {
      55         [ -  + ]:        112 : }
      56                 :            : // -------------------------------------------------------------------------
      57                 :          2 : Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw(  )
      58                 :            : {
      59                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_getTypeInfo_throw" );
      60         [ +  - ]:          2 :     ::osl::MutexGuard aGuard( m_aMutex );
      61                 :            : 
      62         [ +  - ]:          2 :     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
      63 [ +  - ][ +  - ]:          2 :     Reference< XResultSet > xRef = pResult;
      64                 :            : 
      65 [ +  - ][ +  - ]:          2 :     static ODatabaseMetaDataResultSet::ORows aRows;
         [ +  - ][ #  # ]
      66         [ +  - ]:          2 :     if(aRows.empty())
      67                 :            :     {
      68         [ +  - ]:          2 :         ODatabaseMetaDataResultSet::ORow aRow;
      69         [ +  - ]:          2 :         aRow.reserve(18);
      70                 :            : 
      71 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
                 [ +  - ]
      72 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator(::rtl::OUString("VARCHAR")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      73 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      74 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator((sal_Int32)254));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      75 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
                 [ +  - ]
      76 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
                 [ +  - ]
      77 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator(::rtl::OUString("length")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      78 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      79 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
                 [ +  - ]
      80 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      81 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
                 [ +  - ]
      82 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
                 [ +  - ]
      83 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
                 [ +  - ]
      84 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator(::rtl::OUString("C")));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      85 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
                 [ +  - ]
      86 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
                 [ +  - ]
      87 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
                 [ +  - ]
      88 [ +  - ][ +  - ]:          2 :         aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
                 [ +  - ]
      89 [ +  - ][ +  - ]:          2 :         aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      90                 :            : 
      91         [ +  - ]:          2 :         aRows.push_back(aRow);
      92                 :            : 
      93 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("LONGVARCHAR"));
         [ +  - ][ +  - ]
                 [ +  - ]
      94 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR);
         [ +  - ][ +  - ]
                 [ +  - ]
      95 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)2147483647);
         [ +  - ][ +  - ]
                 [ +  - ]
      96 [ +  - ][ +  - ]:          2 :         aRow[6] = new ORowSetValueDecorator();
                 [ +  - ]
      97 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("M"));
         [ +  - ][ +  - ]
                 [ +  - ]
      98         [ +  - ]:          2 :         aRows.push_back(aRow);
      99                 :            : 
     100 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("DATE"));
         [ +  - ][ +  - ]
                 [ +  - ]
     101 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::DATE);
         [ +  - ][ +  - ]
                 [ +  - ]
     102 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
         [ +  - ][ +  - ]
                 [ +  - ]
     103 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("D"));
         [ +  - ][ +  - ]
                 [ +  - ]
     104         [ +  - ]:          2 :         aRows.push_back(aRow);
     105                 :            : 
     106 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("BOOLEAN"));
         [ +  - ][ +  - ]
                 [ +  - ]
     107 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::BIT);
         [ +  - ][ +  - ]
                 [ +  - ]
     108 [ +  - ][ +  - ]:          2 :         aRow[3] = ODatabaseMetaDataResultSet::get1Value();
                 [ +  - ]
     109 [ +  - ][ +  - ]:          2 :         aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue();
                 [ +  - ]
     110 [ +  - ][ +  - ]:          2 :         aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue();
                 [ +  - ]
     111 [ +  - ][ +  - ]:          2 :         aRow[6] = new ORowSetValueDecorator(::rtl::OUString());
         [ +  - ][ +  - ]
                 [ +  - ]
     112 [ +  - ][ +  - ]:          2 :         aRow[9] = ODatabaseMetaDataResultSet::getBasicValue();
                 [ +  - ]
     113 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("L"));
         [ +  - ][ +  - ]
                 [ +  - ]
     114         [ +  - ]:          2 :         aRows.push_back(aRow);
     115                 :            : 
     116 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("DOUBLE"));
         [ +  - ][ +  - ]
                 [ +  - ]
     117 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
         [ +  - ][ +  - ]
                 [ +  - ]
     118 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)8);
         [ +  - ][ +  - ]
                 [ +  - ]
     119 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("B"));
         [ +  - ][ +  - ]
                 [ +  - ]
     120         [ +  - ]:          2 :         aRows.push_back(aRow);
     121                 :            : 
     122 [ +  - ][ +  - ]:          2 :         aRow[11] = new ORowSetValueDecorator(sal_True);
         [ +  - ][ +  - ]
                 [ +  - ]
     123 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("Y"));
         [ +  - ][ +  - ]
                 [ +  - ]
     124         [ +  - ]:          2 :         aRows.push_back(aRow);
     125                 :            : 
     126 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("TIMESTAMP"));
         [ +  - ][ +  - ]
                 [ +  - ]
     127 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
         [ +  - ][ +  - ]
                 [ +  - ]
     128 [ +  - ][ +  - ]:          2 :         aRow[11] = new ORowSetValueDecorator(sal_False);
         [ +  - ][ +  - ]
                 [ +  - ]
     129 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("T"));
         [ +  - ][ +  - ]
                 [ +  - ]
     130         [ +  - ]:          2 :         aRows.push_back(aRow);
     131                 :            : 
     132 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("INTEGER"));
         [ +  - ][ +  - ]
                 [ +  - ]
     133 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
         [ +  - ][ +  - ]
                 [ +  - ]
     134 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)10);
         [ +  - ][ +  - ]
                 [ +  - ]
     135 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("I"));
         [ +  - ][ +  - ]
                 [ +  - ]
     136         [ +  - ]:          2 :         aRows.push_back(aRow);
     137                 :            : 
     138 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("DECIMAL"));
         [ +  - ][ +  - ]
                 [ +  - ]
     139 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
         [ +  - ][ +  - ]
                 [ +  - ]
     140 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)20);
         [ +  - ][ +  - ]
                 [ +  - ]
     141 [ +  - ][ +  - ]:          2 :         aRow[6] = new ORowSetValueDecorator(::rtl::OUString("length,scale"));
         [ +  - ][ +  - ]
                 [ +  - ]
     142 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("F"));
         [ +  - ][ +  - ]
                 [ +  - ]
     143         [ +  - ]:          2 :         aRows.push_back(aRow);
     144                 :            : 
     145 [ +  - ][ +  - ]:          2 :         aRow[1] = new ORowSetValueDecorator(::rtl::OUString("NUMERIC"));
         [ +  - ][ +  - ]
                 [ +  - ]
     146 [ +  - ][ +  - ]:          2 :         aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
         [ +  - ][ +  - ]
                 [ +  - ]
     147 [ +  - ][ +  - ]:          2 :         aRow[3] = new ORowSetValueDecorator((sal_Int32)16);
         [ +  - ][ +  - ]
                 [ +  - ]
     148 [ +  - ][ +  - ]:          2 :         aRow[13] = new ORowSetValueDecorator(::rtl::OUString("N"));
         [ +  - ][ +  - ]
                 [ +  - ]
     149 [ +  - ][ +  - ]:          2 :         aRow[15] = new ORowSetValueDecorator((sal_Int32)16);
         [ +  - ][ +  - ]
                 [ +  - ]
     150         [ +  - ]:          2 :         aRows.push_back(aRow);
     151                 :            :     }
     152                 :            : 
     153         [ +  - ]:          2 :     pResult->setRows(aRows);
     154         [ +  - ]:          2 :     return xRef;
     155                 :            : }
     156                 :            : // -------------------------------------------------------------------------
     157                 :          0 : Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
     158                 :            :     const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& tableNamePattern,
     159                 :            :         const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
     160                 :            : {
     161                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getColumns" );
     162         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     163                 :            : 
     164                 :            : 
     165         [ #  # ]:          0 :     Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
     166         [ #  # ]:          0 :     if(!xTables.is())
     167         [ #  # ]:          0 :         throw SQLException();
     168                 :            : 
     169 [ #  # ][ #  # ]:          0 :     Reference< XNameAccess> xNames = xTables->getTables();
     170         [ #  # ]:          0 :     if(!xNames.is())
     171         [ #  # ]:          0 :         throw SQLException();
     172                 :            : 
     173         [ #  # ]:          0 :     ODatabaseMetaDataResultSet::ORows aRows;
     174         [ #  # ]:          0 :     ODatabaseMetaDataResultSet::ORow aRow(19);
     175                 :            : 
     176 [ #  # ][ #  # ]:          0 :     aRow[10] = new ORowSetValueDecorator((sal_Int32)10);
         [ #  # ][ #  # ]
                 [ #  # ]
     177 [ #  # ][ #  # ]:          0 :     Sequence< ::rtl::OUString> aTabNames(xNames->getElementNames());
     178                 :          0 :     const ::rtl::OUString* pTabBegin    = aTabNames.getConstArray();
     179                 :          0 :     const ::rtl::OUString* pTabEnd      = pTabBegin + aTabNames.getLength();
     180         [ #  # ]:          0 :     for(;pTabBegin != pTabEnd;++pTabBegin)
     181                 :            :     {
     182 [ #  # ][ #  # ]:          0 :         if(match(tableNamePattern,*pTabBegin,'\0'))
     183                 :            :         {
     184                 :          0 :             Reference< XColumnsSupplier> xTable;
     185 [ #  # ][ #  # ]:          0 :             ::cppu::extractInterface(xTable,xNames->getByName(*pTabBegin));
                 [ #  # ]
     186                 :            :             OSL_ENSURE(xTable.is(),"Table not found! Normallya exception had to be thrown here!");
     187 [ #  # ][ #  # ]:          0 :             aRow[3] = new ORowSetValueDecorator(*pTabBegin);
         [ #  # ][ #  # ]
                 [ #  # ]
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :             Reference< XNameAccess> xColumns = xTable->getColumns();
     190         [ #  # ]:          0 :             if(!xColumns.is())
     191         [ #  # ]:          0 :                 throw SQLException();
     192                 :            : 
     193 [ #  # ][ #  # ]:          0 :             Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
     194                 :            : 
     195                 :          0 :             const ::rtl::OUString* pBegin = aColNames.getConstArray();
     196                 :          0 :             const ::rtl::OUString* pEnd = pBegin + aColNames.getLength();
     197                 :          0 :             Reference< XPropertySet> xColumn;
     198         [ #  # ]:          0 :             for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i)
     199                 :            :             {
     200 [ #  # ][ #  # ]:          0 :                 if(match(columnNamePattern,*pBegin,'\0'))
     201                 :            :                 {
     202 [ #  # ][ #  # ]:          0 :                     aRow[4] = new ORowSetValueDecorator(*pBegin);
         [ #  # ][ #  # ]
                 [ #  # ]
     203                 :            : 
     204 [ #  # ][ #  # ]:          0 :                     ::cppu::extractInterface(xColumn,xColumns->getByName(*pBegin));
                 [ #  # ]
     205                 :            :                     OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!");
     206 [ #  # ][ #  # ]:          0 :                     aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     207 [ #  # ][ #  # ]:          0 :                     aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     208 [ #  # ][ #  # ]:          0 :                     aRow[7] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     209 [ #  # ][ #  # ]:          0 :                     aRow[9] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     210 [ #  # ][ #  # ]:          0 :                     aRow[11] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     211 [ #  # ][ #  # ]:          0 :                     aRow[13] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     212      [ #  #  # ]:          0 :                     switch((sal_Int32)aRow[5]->getValue())
                 [ #  # ]
     213                 :            :                     {
     214                 :            :                     case DataType::CHAR:
     215                 :            :                     case DataType::VARCHAR:
     216 [ #  # ][ #  # ]:          0 :                         aRow[16] = new ORowSetValueDecorator((sal_Int32)254);
         [ #  # ][ #  # ]
                 [ #  # ]
     217                 :          0 :                         break;
     218                 :            :                     case DataType::LONGVARCHAR:
     219 [ #  # ][ #  # ]:          0 :                         aRow[16] = new ORowSetValueDecorator((sal_Int32)65535);
         [ #  # ][ #  # ]
                 [ #  # ]
     220                 :          0 :                         break;
     221                 :            :                     default:
     222 [ #  # ][ #  # ]:          0 :                         aRow[16] = new ORowSetValueDecorator((sal_Int32)0);
         [ #  # ][ #  # ]
                 [ #  # ]
     223                 :            :                     }
     224 [ #  # ][ #  # ]:          0 :                     aRow[17] = new ORowSetValueDecorator(i);
         [ #  # ][ #  # ]
                 [ #  # ]
     225         [ #  # ]:          0 :                     switch(sal_Int32(aRow[11]->getValue()))
              [ #  #  # ]
     226                 :            :                     {
     227                 :            :                     case ColumnValue::NO_NULLS:
     228 [ #  # ][ #  # ]:          0 :                         aRow[18] = new ORowSetValueDecorator(::rtl::OUString("NO"));
         [ #  # ][ #  # ]
                 [ #  # ]
     229                 :          0 :                         break;
     230                 :            :                     case ColumnValue::NULLABLE:
     231 [ #  # ][ #  # ]:          0 :                         aRow[18] = new ORowSetValueDecorator(::rtl::OUString("YES"));
         [ #  # ][ #  # ]
                 [ #  # ]
     232                 :          0 :                         break;
     233                 :            :                     default:
     234 [ #  # ][ #  # ]:          0 :                         aRow[18] = new ORowSetValueDecorator(::rtl::OUString());
         [ #  # ][ #  # ]
                 [ #  # ]
     235                 :            :                     }
     236         [ #  # ]:          0 :                     aRows.push_back(aRow);
     237                 :            :                 }
     238         [ #  # ]:          0 :             }
     239                 :            :         }
     240                 :            :     }
     241         [ #  # ]:          0 :     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
     242 [ #  # ][ #  # ]:          0 :     Reference< XResultSet > xRef = pResult;
     243         [ #  # ]:          0 :     pResult->setRows(aRows);
     244                 :            : 
     245 [ #  # ][ #  # ]:          0 :     return xRef;
     246                 :            : }
     247                 :            : // -------------------------------------------------------------------------
     248                 :          0 : Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
     249                 :            :     const Any& /*catalog*/, const ::rtl::OUString& /*schema*/, const ::rtl::OUString& table,
     250                 :            :         sal_Bool unique, sal_Bool /*approximate*/ ) throw(SQLException, RuntimeException)
     251                 :            : {
     252                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getIndexInfo" );
     253         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     254                 :            : 
     255         [ #  # ]:          0 :         Reference< XTablesSupplier > xTables = m_pConnection->createCatalog();
     256         [ #  # ]:          0 :     if(!xTables.is())
     257         [ #  # ]:          0 :                 throw SQLException();
     258                 :            : 
     259 [ #  # ][ #  # ]:          0 :     Reference< XNameAccess> xNames = xTables->getTables();
     260         [ #  # ]:          0 :     if(!xNames.is())
     261         [ #  # ]:          0 :                 throw SQLException();
     262                 :            : 
     263         [ #  # ]:          0 :     ODatabaseMetaDataResultSet::ORows aRows;
     264         [ #  # ]:          0 :     ODatabaseMetaDataResultSet::ORow aRow(14);
     265                 :            : 
     266 [ #  # ][ #  # ]:          0 :     aRow[5]     = new ORowSetValueDecorator(::rtl::OUString());
         [ #  # ][ #  # ]
                 [ #  # ]
     267 [ #  # ][ #  # ]:          0 :     aRow[10]    = new ORowSetValueDecorator(::rtl::OUString("A"));
         [ #  # ][ #  # ]
                 [ #  # ]
     268                 :            : 
     269                 :          0 :     Reference< XIndexesSupplier> xTable;
     270 [ #  # ][ #  # ]:          0 :     ::cppu::extractInterface(xTable,xNames->getByName(table));
                 [ #  # ]
     271 [ #  # ][ #  # ]:          0 :     aRow[3] = new ORowSetValueDecorator(table);
         [ #  # ][ #  # ]
                 [ #  # ]
     272 [ #  # ][ #  # ]:          0 :     aRow[7] = new ORowSetValueDecorator((sal_Int32)3);
         [ #  # ][ #  # ]
                 [ #  # ]
     273                 :            : 
     274 [ #  # ][ #  # ]:          0 :     Reference< XNameAccess> xIndexes = xTable->getIndexes();
     275         [ #  # ]:          0 :     if(!xIndexes.is())
     276         [ #  # ]:          0 :         throw SQLException();
     277                 :            : 
     278 [ #  # ][ #  # ]:          0 :     Sequence< ::rtl::OUString> aIdxNames(xIndexes->getElementNames());
     279                 :            : 
     280                 :          0 :     const ::rtl::OUString* pBegin = aIdxNames.getConstArray();
     281                 :          0 :     const ::rtl::OUString* pEnd = pBegin + aIdxNames.getLength();
     282                 :          0 :     Reference< XPropertySet> xIndex;
     283         [ #  # ]:          0 :     for(;pBegin != pEnd;++pBegin)
     284                 :            :     {
     285 [ #  # ][ #  # ]:          0 :         ::cppu::extractInterface(xIndex,xIndexes->getByName(*pBegin));
                 [ #  # ]
     286                 :            :         OSL_ENSURE(xIndex.is(),"Indexes contains a column who isn't a fastpropertyset!");
     287                 :            : 
     288 [ #  # ][ #  # ]:          0 :         if(unique && !getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
           #  # ][ #  # ]
     289                 :          0 :             continue;
     290 [ #  # ][ #  # ]:          0 :         aRow[4] = new ORowSetValueDecorator(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     291 [ #  # ][ #  # ]:          0 :         aRow[6] = new ORowSetValueDecorator(*pBegin);
         [ #  # ][ #  # ]
                 [ #  # ]
     292                 :            : 
     293         [ #  # ]:          0 :         Reference< XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
     294         [ #  # ]:          0 :         if(xTunnel.is())
     295                 :            :         {
     296 [ #  # ][ #  # ]:          0 :             ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
         [ #  # ][ #  # ]
     297         [ #  # ]:          0 :             if(pIndex)
     298                 :            :             {
     299 [ #  # ][ #  # ]:          0 :                 aRow[11] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_maxkeys);
         [ #  # ][ #  # ]
                 [ #  # ]
     300 [ #  # ][ #  # ]:          0 :                 aRow[12] = new ORowSetValueDecorator((sal_Int32)pIndex->getHeader().db_pagecount);
         [ #  # ][ #  # ]
                 [ #  # ]
     301                 :            :             }
     302                 :            :         }
     303                 :            : 
     304         [ #  # ]:          0 :         Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY);
     305 [ #  # ][ #  # ]:          0 :         Reference< XNameAccess> xColumns = xColumnsSup->getColumns();
     306 [ #  # ][ #  # ]:          0 :         Sequence< ::rtl::OUString> aColNames(xColumns->getElementNames());
     307                 :            : 
     308                 :          0 :         const ::rtl::OUString* pColBegin = aColNames.getConstArray();
     309                 :          0 :         const ::rtl::OUString* pColEnd = pColBegin + aColNames.getLength();
     310                 :          0 :         Reference< XPropertySet> xColumn;
     311         [ #  # ]:          0 :         for(sal_Int32 j=1;pColBegin != pColEnd;++pColBegin,++j)
     312                 :            :         {
     313 [ #  # ][ #  # ]:          0 :             aRow[8] = new ORowSetValueDecorator(j);
         [ #  # ][ #  # ]
                 [ #  # ]
     314 [ #  # ][ #  # ]:          0 :             aRow[9] = new ORowSetValueDecorator(*pColBegin);
         [ #  # ][ #  # ]
                 [ #  # ]
     315         [ #  # ]:          0 :             aRows.push_back(aRow);
     316                 :            :         }
     317         [ #  # ]:          0 :     }
     318                 :            : 
     319         [ #  # ]:          0 :     ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
     320 [ #  # ][ #  # ]:          0 :     Reference< XResultSet > xRef = pResult;
     321         [ #  # ]:          0 :     pResult->setRows(aRows);
     322 [ #  # ][ #  # ]:          0 :     return xRef;
     323                 :            : }
     324                 :            : // -------------------------------------------------------------------------
     325                 :         56 : ::rtl::OUString SAL_CALL ODbaseDatabaseMetaData::getURL(  ) throw(SQLException, RuntimeException)
     326                 :            : {
     327                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getURL" );
     328         [ +  - ]:         56 :     ::osl::MutexGuard aGuard( m_aMutex );
     329         [ +  - ]:         56 :     return ::rtl::OUString("sdbc:dbase:") + m_pConnection->getURL();
     330                 :            : }
     331                 :            : // -------------------------------------------------------------------------
     332                 :          0 : sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxBinaryLiteralLength(  ) throw(SQLException, RuntimeException)
     333                 :            : {
     334                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxBinaryLiteralLength" );
     335                 :          0 :     return STRING_MAXLEN;
     336                 :            : }
     337                 :            : // -------------------------------------------------------------------------
     338                 :          0 : sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxCharLiteralLength(  ) throw(SQLException, RuntimeException)
     339                 :            : {
     340                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxCharLiteralLength" );
     341                 :          0 :     return 254;
     342                 :            : }
     343                 :            : // -------------------------------------------------------------------------
     344                 :          0 : sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnNameLength(  ) throw(SQLException, RuntimeException)
     345                 :            : {
     346                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnNameLength" );
     347                 :          0 :     return 10;
     348                 :            : }
     349                 :            : // -------------------------------------------------------------------------
     350                 :          0 : sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInIndex(  ) throw(SQLException, RuntimeException)
     351                 :            : {
     352                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInIndex" );
     353                 :          0 :     return 1;
     354                 :            : }
     355                 :            : // -------------------------------------------------------------------------
     356                 :          0 : sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInTable(  ) throw(SQLException, RuntimeException)
     357                 :            : {
     358                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::getMaxColumnsInTable" );
     359                 :          0 :     return 128;
     360                 :            : }
     361                 :            : // -----------------------------------------------------------------------------
     362                 :         28 : sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn(  ) throw(SQLException, RuntimeException)
     363                 :            : {
     364                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn" );
     365                 :         28 :     return sal_True;
     366                 :            : }
     367                 :            : // -------------------------------------------------------------------------
     368                 :         28 : sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn(  ) throw(SQLException, RuntimeException)
     369                 :            : {
     370                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn" );
     371                 :         28 :     return sal_False;
     372                 :            : }
     373                 :            : // -----------------------------------------------------------------------------
     374                 :          0 : sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly(  ) throw(SQLException, RuntimeException)
     375                 :            : {
     376                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::isReadOnly" );
     377         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( m_aMutex );
     378                 :            : 
     379                 :          0 :     sal_Bool bReadOnly = sal_False;
     380 [ #  # ][ #  # ]:          0 :     static ::rtl::OUString sReadOnly(  "IsReadOnly" );
     381 [ #  # ][ #  # ]:          0 :     ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >());
     382         [ #  # ]:          0 :     aFile.getPropertyValue(sReadOnly) >>= bReadOnly;
     383                 :            : 
     384 [ #  # ][ #  # ]:          0 :     return bReadOnly;
     385                 :            : }
     386                 :            : // -----------------------------------------------------------------------------
     387                 :          0 : sal_Bool ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw(  )
     388                 :            : {
     389                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw" );
     390                 :          0 :     return sal_True;
     391                 :            : }
     392                 :            : // -----------------------------------------------------------------------------
     393                 :         56 : sal_Bool ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw(  )
     394                 :            : {
     395                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseDatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw" );
     396                 :         56 :     return sal_True;
     397                 :            : }
     398                 :            : // -----------------------------------------------------------------------------
     399                 :            : 
     400                 :            : 
     401                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10