1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _CONNECTIVITY_ADABAS_BDATABASEMETADATA_HXX_ 32*cdf0e10cSrcweir #include "adabas/BDatabaseMetaData.hxx" 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #include "FDatabaseMetaDataResultSet.hxx" 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir using namespace connectivity::adabas; 37*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 38*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 39*cdf0e10cSrcweir // using namespace ::com::sun::star::sdbcx; 40*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 41*cdf0e10cSrcweir using namespace ::com::sun::star::container; 42*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAdabasDatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM("sdbc:adabas:")); 47*cdf0e10cSrcweir aValue += OAdabasDatabaseMetaData_BASE::getURLImpl(); 48*cdf0e10cSrcweir return aValue; 49*cdf0e10cSrcweir } 50*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 51*cdf0e10cSrcweir sal_Bool SAL_CALL OAdabasDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir return sal_True; 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 56*cdf0e10cSrcweir Reference< XResultSet > OAdabasDatabaseMetaData::impl_getTypeInfo_throw( ) 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo); 59*cdf0e10cSrcweir Reference< XResultSet > xNewRes = pResult; 60*cdf0e10cSrcweir static ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; 61*cdf0e10cSrcweir if(aRows.empty()) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir aRows.reserve(19); 64*cdf0e10cSrcweir Reference< XResultSet > xRes = OAdabasDatabaseMetaData_BASE::impl_getTypeInfo_throw(); 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir if(xRes.is()) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(19); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir Reference< XRow> xRow(xRes,UNO_QUERY); 71*cdf0e10cSrcweir while(xRes->next()) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir sal_Int32 nPos = 1; 74*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (1)); 75*cdf0e10cSrcweir if(xRow->wasNull()) 76*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 77*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (2)); 78*cdf0e10cSrcweir if(xRow->wasNull()) 79*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 80*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (3)); 81*cdf0e10cSrcweir if(xRow->wasNull()) 82*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 83*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (4)); 84*cdf0e10cSrcweir if(xRow->wasNull()) 85*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 86*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (5)); 87*cdf0e10cSrcweir if(xRow->wasNull()) 88*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 89*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (6)); 90*cdf0e10cSrcweir if(xRow->wasNull()) 91*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 92*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (7)); 93*cdf0e10cSrcweir if(xRow->wasNull()) 94*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 95*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (8)); 96*cdf0e10cSrcweir if(xRow->wasNull()) 97*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 98*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (9)); 99*cdf0e10cSrcweir if(xRow->wasNull()) 100*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 101*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (10)); 102*cdf0e10cSrcweir if(xRow->wasNull()) 103*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 104*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (11)); 105*cdf0e10cSrcweir if(xRow->wasNull()) 106*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 107*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getBoolean (12)); 108*cdf0e10cSrcweir if(xRow->wasNull()) 109*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 110*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getString (13)); 111*cdf0e10cSrcweir if(xRow->wasNull()) 112*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 113*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (14)); 114*cdf0e10cSrcweir if(xRow->wasNull()) 115*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 116*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getShort (15)); 117*cdf0e10cSrcweir if(xRow->wasNull()) 118*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 119*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (16)); 120*cdf0e10cSrcweir if(xRow->wasNull()) 121*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 122*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator(xRow->getInt (17)); 123*cdf0e10cSrcweir if(xRow->wasNull()) 124*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 125*cdf0e10cSrcweir aRow[nPos++] = new ::connectivity::ORowSetValueDecorator((sal_Int16)xRow->getInt(18)); 126*cdf0e10cSrcweir if(xRow->wasNull()) 127*cdf0e10cSrcweir aRow[nPos-1]->setNull(); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // we have to fix some incorrect entries 130*cdf0e10cSrcweir if(!aRow[2]->getValue().isNull()) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir switch((sal_Int32)aRow[2]->getValue()) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir case DataType::FLOAT: 135*cdf0e10cSrcweir // aRow[3] = sal_Int32(15); 136*cdf0e10cSrcweir // break; 137*cdf0e10cSrcweir case DataType::REAL: 138*cdf0e10cSrcweir // aRow[3] = sal_Int32(16); 139*cdf0e10cSrcweir // break; 140*cdf0e10cSrcweir case DataType::DOUBLE: 141*cdf0e10cSrcweir aRow[2]->setValue(DataType::DOUBLE); 142*cdf0e10cSrcweir aRow[3]->setValue(sal_Int32(18)); 143*cdf0e10cSrcweir break; 144*cdf0e10cSrcweir case DataType::TIMESTAMP: 145*cdf0e10cSrcweir aRow[3]->setValue(sal_Int32(27)); 146*cdf0e10cSrcweir break; 147*cdf0e10cSrcweir default: 148*cdf0e10cSrcweir break; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir aRows.push_back(aRow); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir pResult->setRows(aRows); 156*cdf0e10cSrcweir return xNewRes; 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162