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