LibreOffice Module connectivity (master) 1
FDatabaseMetaDataResultSet.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <vector>
25
26#include <com/sun/star/sdbc/XResultSet.hpp>
27#include <com/sun/star/sdbc/XRow.hpp>
28#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
29#include <com/sun/star/sdbc/XCloseable.hpp>
30#include <com/sun/star/sdbc/XColumnLocate.hpp>
31#include <com/sun/star/util/XCancellable.hpp>
32#include <com/sun/star/lang/XInitialization.hpp>
33#include <com/sun/star/lang/XServiceInfo.hpp>
34#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
41
42namespace connectivity
43{
44 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
45 css::sdbc::XRow,
46 css::sdbc::XResultSetMetaDataSupplier,
47 css::util::XCancellable,
48 css::sdbc::XWarningsSupplier,
49 css::sdbc::XCloseable,
50 css::lang::XInitialization,
51 css::lang::XServiceInfo,
52 css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
53
54 // typedef ORefVector<ORowSetValue> ORow;
55 // typedef ORefVector<ORow> ORows;
56
58 public cppu::BaseMutex,
61 public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
62 {
63
64 public:
65 typedef std::vector<ORowSetValueDecoratorRef> ORow;
66 typedef std::vector<ORow> ORows;
67
69 {
71 eCatalogs = 0,
73 eSchemas = 1,
75 eColumnPrivileges = 2,
77 eColumns = 3,
79 eTables = 4,
81 eTableTypes = 5,
83 eProcedureColumns = 6,
85 eProcedures = 7,
87 eExportedKeys = 8,
89 eImportedKeys = 9,
91 ePrimaryKeys = 10,
93 eIndexInfo = 11,
95 eTablePrivileges = 12,
97 eCrossReference = 13,
99 eTypeInfo = 14,
101 eBestRowIdentifier = 15,
103 eVersionColumns = 16,
105 eUDTs = 17
106 };
107
108 private:
110 css::uno::WeakReferenceHelper m_aStatement;
111 css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
112 sal_Int32 m_nColPos;
113
114 sal_Int32 m_nFetchSize;
118
119 void construct();
121 void checkIndex(sal_Int32 columnIndex );
122 void setType(MetaDataResultSetType _eType);
123
124 protected:
126 ORows::iterator m_aRowsIter;
127 bool m_bBOF;
128 bool m_bEOF;
129
130 virtual const ORowSetValue& getValue(sal_Int32 columnIndex);
131
132 // OPropertyArrayUsageHelper
133 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
134 // OPropertySetHelper
135 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
136
137 virtual ~ODatabaseMetaDataResultSet() override;
138 public:
139
140 virtual void SAL_CALL acquire() noexcept override;
141 virtual void SAL_CALL release() noexcept override;
142
147
148 void setRows(ORows&& _rRows);
149
150 // XServiceInfo
151
152 protected:
153 virtual OUString SAL_CALL getImplementationName( ) override;
154 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
155 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
156 // ::cppu::OComponentHelper
157 virtual void SAL_CALL disposing() override;
158 // XInterface
159 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
160 //XTypeProvider
161 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
162 // XPropertySet
163 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
164 // XResultSet
165 virtual sal_Bool SAL_CALL next( ) override;
166 virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
167 virtual sal_Bool SAL_CALL isAfterLast( ) override;
168 virtual sal_Bool SAL_CALL isFirst( ) override;
169 virtual sal_Bool SAL_CALL isLast( ) override;
170 virtual void SAL_CALL beforeFirst( ) override;
171 virtual void SAL_CALL afterLast( ) override;
172 virtual sal_Bool SAL_CALL first( ) override;
173 virtual sal_Bool SAL_CALL last( ) override;
174 virtual sal_Int32 SAL_CALL getRow( ) override;
175 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
176 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
177 virtual sal_Bool SAL_CALL previous( ) override;
178 virtual void SAL_CALL refreshRow( ) override;
179 virtual sal_Bool SAL_CALL rowUpdated( ) override;
180 virtual sal_Bool SAL_CALL rowInserted( ) override;
181 virtual sal_Bool SAL_CALL rowDeleted( ) override;
182 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
183 // XRow
184 virtual sal_Bool SAL_CALL wasNull( ) override;
185 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
186 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
187 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
188 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
189 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
190 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
191 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
192 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
193 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
194 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
195 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
196 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
197 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
198 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
199 virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
200 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
201 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
202 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
203 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
204 // XResultSetMetaDataSupplier
205 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
206 // XCancellable
207 virtual void SAL_CALL cancel( ) override;
208 // XCloseable
209 virtual void SAL_CALL close( ) override;
210 // XWarningsSupplier
211 virtual css::uno::Any SAL_CALL getWarnings( ) override;
212 virtual void SAL_CALL clearWarnings( ) override;
213 // XColumnLocate
214 virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
215
216 // XInitialization
217 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
218
219 void setCatalogsMap();
220 void setSchemasMap();
221 void setColumnPrivilegesMap();
222 void setColumnsMap();
223 void setTablesMap();
224 void setTableTypes();
225 void setProcedureColumnsMap();
226 void setProceduresMap();
227 void setExportedKeysMap();
228 void setImportedKeysMap();
229 void setPrimaryKeysMap();
230 void setIndexInfoMap();
231 void setTablePrivilegesMap();
232 void setCrossReferenceMap();
233 void setTypeInfoMap();
234 void setBestRowIdentifierMap();
235 void setVersionColumnsMap();
236 void setUDTsMap();
237 public:
238 // some methods to get already defined ORowSetValues
239 // this increase the reuse of ORowSetValues
241 static ORowSetValueDecoratorRef const & getEmptyValue();
243 static ORowSetValueDecoratorRef const & get0Value();
245 static ORowSetValueDecoratorRef const & get1Value();
247 static ORowSetValueDecoratorRef const & getBasicValue();
249 static ORowSetValueDecoratorRef const & getSelectValue();
251 static ORowSetValueDecoratorRef const & getInsertValue();
253 static ORowSetValueDecoratorRef const & getDeleteValue();
255 static ORowSetValueDecoratorRef const & getUpdateValue();
257 static ORowSetValueDecoratorRef const & getCreateValue();
259 static ORowSetValueDecoratorRef const & getReadValue();
261 static ORowSetValueDecoratorRef const & getAlterValue();
263 static ORowSetValueDecoratorRef const & getDropValue();
265 static ORowSetValueDecoratorRef const & getQuoteValue();
266
267 };
268}
269
270/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< ORowSetValueDecoratorRef > ORow
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData
#define OOO_DLLPUBLIC_DBTOOLS
Type
static bool getValue(EContact *pContact, sal_Int32 nColumnNum, GType nType, GValue *pStackValue, bool &_out_rWasNull)
Definition: NResultSet.cxx:243
::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, css::sdbc::XRow, css::sdbc::XResultSetMetaDataSupplier, css::util::XCancellable, css::sdbc::XWarningsSupplier, css::sdbc::XCloseable, css::lang::XInitialization, css::lang::XServiceInfo, css::sdbc::XColumnLocate > ODatabaseMetaDataResultSet_BASE
const char * columnName
Definition: pq_statics.cxx:56
unsigned char sal_Bool
signed char sal_Int8