nss: upgrade to release 3.73
[LibreOffice.git] / connectivity / source / inc / FDatabaseMetaDataResultSet.hxx
blobde20771f978787b607b4bb93adfd5291bbadc48a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FDATABASEMETADATARESULTSET_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FDATABASEMETADATARESULTSET_HXX
23 #include <sal/config.h>
25 #include <vector>
27 #include <com/sun/star/sdbc/XResultSet.hpp>
28 #include <com/sun/star/sdbc/XRow.hpp>
29 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
30 #include <com/sun/star/sdbc/XCloseable.hpp>
31 #include <com/sun/star/sdbc/XColumnLocate.hpp>
32 #include <com/sun/star/util/XCancellable.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
36 #include <cppuhelper/compbase.hxx>
37 #include <cppuhelper/basemutex.hxx>
38 #include <comphelper/proparrhlp.hxx>
39 #include <comphelper/propertycontainer.hxx>
40 #include <connectivity/FValue.hxx>
41 #include <connectivity/dbtoolsdllapi.hxx>
43 namespace connectivity
45 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
46 css::sdbc::XRow,
47 css::sdbc::XResultSetMetaDataSupplier,
48 css::util::XCancellable,
49 css::sdbc::XWarningsSupplier,
50 css::sdbc::XCloseable,
51 css::lang::XInitialization,
52 css::lang::XServiceInfo,
53 css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
55 // typedef ORefVector<ORowSetValue> ORow;
56 // typedef ORefVector<ORow> ORows;
58 class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSet :
59 public cppu::BaseMutex,
60 public ODatabaseMetaDataResultSet_BASE,
61 public ::comphelper::OPropertyContainer,
62 public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
65 public:
66 typedef std::vector<ORowSetValueDecoratorRef> ORow;
67 typedef std::vector<ORow> ORows;
69 enum MetaDataResultSetType
71 /// describes a result set as expected by XDatabaseMetaData::getCatalogs
72 eCatalogs = 0,
73 /// describes a result set as expected by XDatabaseMetaData::getSchemas
74 eSchemas = 1,
75 /// describes a result set as expected by XDatabaseMetaData::getColumnPrivileges
76 eColumnPrivileges = 2,
77 /// describes a result set as expected by XDatabaseMetaData::getColumns
78 eColumns = 3,
79 /// describes a result set as expected by XDatabaseMetaData::getTables
80 eTables = 4,
81 /// describes a result set as expected by XDatabaseMetaData::getTableTypes
82 eTableTypes = 5,
83 /// describes a result set as expected by XDatabaseMetaData::getProcedureColumns
84 eProcedureColumns = 6,
85 /// describes a result set as expected by XDatabaseMetaData::getProcedures
86 eProcedures = 7,
87 /// describes a result set as expected by XDatabaseMetaData::getExportedKeys
88 eExportedKeys = 8,
89 /// describes a result set as expected by XDatabaseMetaData::getImportedKeys
90 eImportedKeys = 9,
91 /// describes a result set as expected by XDatabaseMetaData::getPrimaryKeys
92 ePrimaryKeys = 10,
93 /// describes a result set as expected by XDatabaseMetaData::getIndexInfo
94 eIndexInfo = 11,
95 /// describes a result set as expected by XDatabaseMetaData::getTablePrivileges
96 eTablePrivileges = 12,
97 /// describes a result set as expected by XDatabaseMetaData::getCrossReference
98 eCrossReference = 13,
99 /// describes a result set as expected by XDatabaseMetaData::getTypeInfo
100 eTypeInfo = 14,
101 /// describes a result set as expected by XDatabaseMetaData::getBestRowIdentifier
102 eBestRowIdentifier = 15,
103 /// describes a result set as expected by XDatabaseMetaData::getVersionColumns
104 eVersionColumns = 16,
105 /// describes a result set as expected by XDatabaseMetaData::getUDTs
106 eUDTs = 17
109 private:
110 ORowSetValue m_aEmptyValue;
111 css::uno::WeakReferenceHelper m_aStatement;
112 css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
113 sal_Int32 m_nColPos;
115 sal_Int32 m_nFetchSize;
116 sal_Int32 m_nResultSetType;
117 sal_Int32 m_nFetchDirection;
118 sal_Int32 m_nResultSetConcurrency;
120 void construct();
121 /// @throws css::sdbc::SQLException
122 void checkIndex(sal_Int32 columnIndex );
123 void setType(MetaDataResultSetType _eType);
125 protected:
126 ORows m_aRows;
127 ORows::iterator m_aRowsIter;
128 bool m_bBOF;
129 bool m_bEOF;
131 virtual const ORowSetValue& getValue(sal_Int32 columnIndex);
133 // OPropertyArrayUsageHelper
134 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
135 // OPropertySetHelper
136 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
138 virtual ~ODatabaseMetaDataResultSet() override;
139 public:
141 virtual void SAL_CALL acquire() throw() override;
142 virtual void SAL_CALL release() throw() override;
144 /// default construction
145 ODatabaseMetaDataResultSet();
146 /// construction of a pre-defined result set type
147 ODatabaseMetaDataResultSet( MetaDataResultSetType _eType );
149 void setRows(const ORows& _rRows);
151 // XServiceInfo
153 protected:
154 virtual OUString SAL_CALL getImplementationName( ) override;
155 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
156 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
157 // ::cppu::OComponentHelper
158 virtual void SAL_CALL disposing() override;
159 // XInterface
160 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
161 //XTypeProvider
162 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
163 // XPropertySet
164 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
165 // XResultSet
166 virtual sal_Bool SAL_CALL next( ) override;
167 virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
168 virtual sal_Bool SAL_CALL isAfterLast( ) override;
169 virtual sal_Bool SAL_CALL isFirst( ) override;
170 virtual sal_Bool SAL_CALL isLast( ) override;
171 virtual void SAL_CALL beforeFirst( ) override;
172 virtual void SAL_CALL afterLast( ) override;
173 virtual sal_Bool SAL_CALL first( ) override;
174 virtual sal_Bool SAL_CALL last( ) override;
175 virtual sal_Int32 SAL_CALL getRow( ) override;
176 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
177 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
178 virtual sal_Bool SAL_CALL previous( ) override;
179 virtual void SAL_CALL refreshRow( ) override;
180 virtual sal_Bool SAL_CALL rowUpdated( ) override;
181 virtual sal_Bool SAL_CALL rowInserted( ) override;
182 virtual sal_Bool SAL_CALL rowDeleted( ) override;
183 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
184 // XRow
185 virtual sal_Bool SAL_CALL wasNull( ) override;
186 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
187 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
188 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
189 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
190 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
191 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
192 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
193 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
194 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
195 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
196 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
197 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
198 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
199 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
200 virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
201 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
202 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
203 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
204 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
205 // XResultSetMetaDataSupplier
206 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
207 // XCancellable
208 virtual void SAL_CALL cancel( ) override;
209 // XCloseable
210 virtual void SAL_CALL close( ) override;
211 // XWarningsSupplier
212 virtual css::uno::Any SAL_CALL getWarnings( ) override;
213 virtual void SAL_CALL clearWarnings( ) override;
214 // XColumnLocate
215 virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
217 // XInitialization
218 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
220 void setCatalogsMap();
221 void setSchemasMap();
222 void setColumnPrivilegesMap();
223 void setColumnsMap();
224 void setTablesMap();
225 void setTableTypes();
226 void setProcedureColumnsMap();
227 void setProceduresMap();
228 void setExportedKeysMap();
229 void setImportedKeysMap();
230 void setPrimaryKeysMap();
231 void setIndexInfoMap();
232 void setTablePrivilegesMap();
233 void setCrossReferenceMap();
234 void setTypeInfoMap();
235 void setBestRowIdentifierMap();
236 void setVersionColumnsMap();
237 void setUDTsMap();
238 public:
239 // some methods to get already defined ORowSetValues
240 // this increase the reuse of ORowSetValues
241 /// return an empty ORowSetValueDecorator
242 static ORowSetValueDecoratorRef const & getEmptyValue();
243 /// return an ORowSetValueDecorator with 0 as value
244 static ORowSetValueDecoratorRef const & get0Value();
245 /// return an ORowSetValueDecorator with 1 as value
246 static ORowSetValueDecoratorRef const & get1Value();
247 /// return an ORowSetValueDecorator with ColumnSearch::BASIC as value
248 static ORowSetValueDecoratorRef const & getBasicValue();
249 /// return an ORowSetValueDecorator with string SELECT as value
250 static ORowSetValueDecoratorRef const & getSelectValue();
251 /// return an ORowSetValueDecorator with string INSERT as value
252 static ORowSetValueDecoratorRef const & getInsertValue();
253 /// return an ORowSetValueDecorator with string DELETE as value
254 static ORowSetValueDecoratorRef const & getDeleteValue();
255 /// return an ORowSetValueDecorator with string UPDATE as value
256 static ORowSetValueDecoratorRef const & getUpdateValue();
257 /// return an ORowSetValueDecorator with string CREATE as value
258 static ORowSetValueDecoratorRef const & getCreateValue();
259 /// return an ORowSetValueDecorator with string READ as value
260 static ORowSetValueDecoratorRef const & getReadValue();
261 /// return an ORowSetValueDecorator with string ALTER as value
262 static ORowSetValueDecoratorRef const & getAlterValue();
263 /// return an ORowSetValueDecorator with string DROP as value
264 static ORowSetValueDecoratorRef const & getDropValue();
265 /// return an ORowSetValueDecorator with string ' as value
266 static ORowSetValueDecoratorRef const & getQuoteValue();
270 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FDATABASEMETADATARESULTSET_HXX
272 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */