1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: BDatabaseMetaData.cxx,v $
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"
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();
53 // -----------------------------------------------------------------------------
54 sal_Bool SAL_CALL
OAdabasDatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException
, RuntimeException
)
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
;
67 Reference
< XResultSet
> xRes
= OAdabasDatabaseMetaData_BASE::impl_getTypeInfo_throw();
71 ::connectivity::ODatabaseMetaDataResultSet::ORow
aRow(19);
73 Reference
< XRow
> xRow(xRes
,UNO_QUERY
);
77 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getString (1));
79 aRow
[nPos
-1]->setNull();
80 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (2));
82 aRow
[nPos
-1]->setNull();
83 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (3));
85 aRow
[nPos
-1]->setNull();
86 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getString (4));
88 aRow
[nPos
-1]->setNull();
89 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getString (5));
91 aRow
[nPos
-1]->setNull();
92 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getString (6));
94 aRow
[nPos
-1]->setNull();
95 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (7));
97 aRow
[nPos
-1]->setNull();
98 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getBoolean (8));
100 aRow
[nPos
-1]->setNull();
101 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getShort (9));
103 aRow
[nPos
-1]->setNull();
104 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getBoolean (10));
106 aRow
[nPos
-1]->setNull();
107 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (11));
109 aRow
[nPos
-1]->setNull();
110 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getBoolean (12));
112 aRow
[nPos
-1]->setNull();
113 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getString (13));
115 aRow
[nPos
-1]->setNull();
116 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getShort (14));
118 aRow
[nPos
-1]->setNull();
119 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getShort (15));
121 aRow
[nPos
-1]->setNull();
122 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (16));
124 aRow
[nPos
-1]->setNull();
125 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator(xRow
->getInt (17));
127 aRow
[nPos
-1]->setNull();
128 aRow
[nPos
++] = new ::connectivity::ORowSetValueDecorator((sal_Int16
)xRow
->getInt(18));
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);
141 // aRow[3] = sal_Int32(16);
143 case DataType::DOUBLE
:
144 aRow
[2]->setValue(DataType::DOUBLE
);
145 aRow
[3]->setValue(sal_Int32(18));
147 case DataType::TIMESTAMP
:
148 aRow
[3]->setValue(sal_Int32(27));
154 aRows
.push_back(aRow
);
158 pResult
->setRows(aRows
);
161 // -----------------------------------------------------------------------------