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