merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / inc / FDatabaseMetaDataResultSet.hxx
blobb42280117f9cc637e5c0fff90ff220b4d41421eb
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: FDatabaseMetaDataResultSet.hxx,v $
10 * $Revision: 1.16 $
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 #ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
32 #define _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
34 #include <com/sun/star/sdbc/XResultSet.hpp>
35 #include <com/sun/star/sdbc/XRow.hpp>
36 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
37 #include <com/sun/star/sdbc/XCloseable.hpp>
38 #include <com/sun/star/sdbc/XColumnLocate.hpp>
39 #include <com/sun/star/util/XCancellable.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
43 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
44 #include <com/sun/star/sdbc/XRowUpdate.hpp>
45 #include <cppuhelper/compbase9.hxx>
46 #include <comphelper/proparrhlp.hxx>
47 #include "connectivity/CommonTools.hxx"
48 #include <comphelper/propertycontainer.hxx>
49 #include "connectivity/FValue.hxx"
50 #include "connectivity/dbtoolsdllapi.hxx"
51 #include <comphelper/broadcasthelper.hxx>
52 #include <vos/refernce.hxx>
54 namespace connectivity
56 class ODatabaseMetaDataResultSetMetaData;
57 typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::sdbc::XResultSet,
58 ::com::sun::star::sdbc::XRow,
59 ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
60 ::com::sun::star::util::XCancellable,
61 ::com::sun::star::sdbc::XWarningsSupplier,
62 ::com::sun::star::sdbc::XCloseable,
63 ::com::sun::star::lang::XInitialization,
64 ::com::sun::star::lang::XServiceInfo,
65 ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
67 // typedef ORefVector<ORowSetValue> ORow;
68 // typedef ORefVector<ORow> ORows;
70 class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSet :
71 public comphelper::OBaseMutex,
72 public ODatabaseMetaDataResultSet_BASE,
73 public ::comphelper::OPropertyContainer,
74 public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
77 public:
78 DECLARE_STL_VECTOR(ORowSetValueDecoratorRef,ORow);
79 DECLARE_STL_VECTOR(ORow, ORows);
81 enum MetaDataResultSetType
83 /// describes a result set as expected by XDatabaseMetaData::getCatalogs
84 eCatalogs = 0,
85 /// describes a result set as expected by XDatabaseMetaData::getSchemas
86 eSchemas = 1,
87 /// describes a result set as expected by XDatabaseMetaData::getColumnPrivileges
88 eColumnPrivileges = 2,
89 /// describes a result set as expected by XDatabaseMetaData::getColumns
90 eColumns = 3,
91 /// describes a result set as expected by XDatabaseMetaData::getTables
92 eTables = 4,
93 /// describes a result set as expected by XDatabaseMetaData::getTableTypes
94 eTableTypes = 5,
95 /// describes a result set as expected by XDatabaseMetaData::getProcedureColumns
96 eProcedureColumns = 6,
97 /// describes a result set as expected by XDatabaseMetaData::getProcedures
98 eProcedures = 7,
99 /// describes a result set as expected by XDatabaseMetaData::getExportedKeys
100 eExportedKeys = 8,
101 /// describes a result set as expected by XDatabaseMetaData::getImportedKeys
102 eImportedKeys = 9,
103 /// describes a result set as expected by XDatabaseMetaData::getPrimaryKeys
104 ePrimaryKeys = 10,
105 /// describes a result set as expected by XDatabaseMetaData::getIndexInfo
106 eIndexInfo = 11,
107 /// describes a result set as expected by XDatabaseMetaData::getTablePrivileges
108 eTablePrivileges = 12,
109 /// describes a result set as expected by XDatabaseMetaData::getCrossReference
110 eCrossReference = 13,
111 /// describes a result set as expected by XDatabaseMetaData::getTypeInfo
112 eTypeInfo = 14,
113 /// describes a result set as expected by XDatabaseMetaData::getBestRowIdentifier
114 eBestRowIdentifier = 15,
115 /// describes a result set as expected by XDatabaseMetaData::getVersionColumns
116 eVersionColumns = 16
119 private:
120 ORowSetValue m_aEmptyValue;
121 ::com::sun::star::uno::WeakReferenceHelper m_aStatement;
122 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData;
123 sal_Int32 m_nColPos;
125 sal_Int32 m_nFetchSize;
126 sal_Int32 m_nResultSetType;
127 sal_Int32 m_nFetchDirection;
128 sal_Int32 m_nResultSetConcurrency;
130 void construct();
131 void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException);
132 void setType(MetaDataResultSetType _eType);
134 protected:
135 ORows m_aRows;
136 ORows::iterator m_aRowsIter;
137 sal_Bool m_bBOF;
138 sal_Bool m_bEOF;
140 virtual const ORowSetValue& getValue(sal_Int32 columnIndex);
142 // OPropertyArrayUsageHelper
143 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
144 // OPropertySetHelper
145 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
147 virtual ~ODatabaseMetaDataResultSet();
148 public:
150 virtual void SAL_CALL acquire() throw();
151 virtual void SAL_CALL release() throw();
153 /// default construction
154 ODatabaseMetaDataResultSet();
155 /// construction of a pre-defined result set type
156 ODatabaseMetaDataResultSet( MetaDataResultSetType _eType );
158 void setRows(const ORows& _rRows);
160 // XServiceInfo
162 static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
163 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
165 protected:
166 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
167 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
168 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
169 // ::cppu::OComponentHelper
170 virtual void SAL_CALL disposing(void);
171 // XInterface
172 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
173 //XTypeProvider
174 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
175 // XPropertySet
176 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
177 // XResultSet
178 virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
179 virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
180 virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
181 virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
182 virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
183 virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
184 virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
185 virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
186 virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
187 virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
188 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
189 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
190 virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
191 virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
192 virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
193 virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
194 virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
195 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
196 // XRow
197 virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
198 virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
199 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
200 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
201 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
202 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
203 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
204 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
205 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
206 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
207 virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
208 virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
209 virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
210 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
212 virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
213 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
214 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
215 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
216 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
217 // XResultSetMetaDataSupplier
218 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
219 // XCancellable
220 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
221 // XCloseable
222 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
223 // XWarningsSupplier
224 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
225 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
226 // XColumnLocate
227 virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
229 // XInitialization
230 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
232 void setCatalogsMap();
233 void setSchemasMap();
234 void setColumnPrivilegesMap();
235 void setColumnsMap();
236 void setTablesMap();
237 void setTableTypes();
238 void setProcedureColumnsMap();
239 void setProceduresMap();
240 void setExportedKeysMap();
241 void setImportedKeysMap();
242 void setPrimaryKeysMap();
243 void setIndexInfoMap();
244 void setTablePrivilegesMap();
245 void setCrossReferenceMap();
246 void setTypeInfoMap();
247 void setBestRowIdentifierMap();
248 void setVersionColumnsMap();
249 public:
250 // some methods to get already defined ORowSetValues
251 // this increase the reuse of ORowSetValues
252 /// return an empty ORowSetValueDecorator
253 static ORowSetValueDecoratorRef getEmptyValue();
254 /// return an ORowSetValueDecorator with 0 as value
255 static ORowSetValueDecoratorRef get0Value();
256 /// return an ORowSetValueDecorator with 1 as value
257 static ORowSetValueDecoratorRef get1Value();
258 /// return an ORowSetValueDecorator with ColumnSearch::BASIC as value
259 static ORowSetValueDecoratorRef getBasicValue();
260 /// return an ORowSetValueDecorator with string SELECT as value
261 static ORowSetValueDecoratorRef getSelectValue();
262 /// return an ORowSetValueDecorator with string INSERT as value
263 static ORowSetValueDecoratorRef getInsertValue();
264 /// return an ORowSetValueDecorator with string DELETE as value
265 static ORowSetValueDecoratorRef getDeleteValue();
266 /// return an ORowSetValueDecorator with string UPDATE as value
267 static ORowSetValueDecoratorRef getUpdateValue();
268 /// return an ORowSetValueDecorator with string CREATE as value
269 static ORowSetValueDecoratorRef getCreateValue();
270 /// return an ORowSetValueDecorator with string READ as value
271 static ORowSetValueDecoratorRef getReadValue();
272 /// return an ORowSetValueDecorator with string ALTER as value
273 static ORowSetValueDecoratorRef getAlterValue();
274 /// return an ORowSetValueDecorator with string DROP as value
275 static ORowSetValueDecoratorRef getDropValue();
276 /// return an ORowSetValueDecorator with string ' as value
277 static ORowSetValueDecoratorRef getQuoteValue();
281 #endif // _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_