LibreOffice Module connectivity (master) 1
ADatabaseMetaDataResultSet.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 <com/sun/star/sdbc/XResultSet.hpp>
23#include <com/sun/star/sdbc/XRow.hpp>
24#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
25#include <com/sun/star/sdbc/XCloseable.hpp>
26#include <com/sun/star/sdbc/XColumnLocate.hpp>
27#include <com/sun/star/util/XCancellable.hpp>
28#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
29#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
30#include <com/sun/star/sdbc/XRowUpdate.hpp>
34#include <ado/AStatement.hxx>
35
36namespace connectivity::ado
37{
38 /*
39 ** java_sql_ResultSet
40 */
41 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XResultSet,
42 css::sdbc::XRow,
43 css::sdbc::XResultSetMetaDataSupplier,
44 css::util::XCancellable,
45 css::sdbc::XWarningsSupplier,
46 css::sdbc::XCloseable,
47 css::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE;
48
52 public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet>
53 {
54 std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 every time
55
56 std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> > m_aValueRange;
57 std::map<sal_Int32, ::std::map<sal_Int32,sal_Int32> >::iterator m_aValueRangeIter;
58
59 std::map<sal_Int32, std::map< OUString,sal_Int32> > m_aStrValueRange;
60 std::map<sal_Int32, std::map< OUString,sal_Int32> >::iterator m_aStrValueRangeIter;
61
62 std::map<sal_Int32, std::map< sal_Int32,OUString> > m_aIntValueRange;
63 std::map<sal_Int32, std::map< sal_Int32,OUString> >::iterator m_aIntValueRangeIter;
64
65 ADORecordset* m_pRecordSet;
66 css::uno::WeakReferenceHelper m_aStatement;
67 css::uno::Reference< css::sdbc::XResultSetMetaData> m_xMetaData;
69 sal_Int32 m_nRowPos;
71 bool m_bEOF;
73
76 static sal_Int32 getResultSetConcurrency();
79 static sal_Int32 getResultSetType();
82 static sal_Int32 getFetchDirection();
85 sal_Int32 getFetchSize() const;
88 static OUString getCursorName();
89
92 void setFetchDirection(sal_Int32 _par0);
95 void setFetchSize(sal_Int32 _par0);
96
97
98 inline sal_Int32 mapColumn (sal_Int32 column);
100 void checkRecordSet();
103 OLEVariant getValue(sal_Int32 columnIndex );
104
105 protected:
106
107 // OPropertyArrayUsageHelper
108 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
109 // OPropertySetHelper
110 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
111
113 css::uno::Any & rConvertedValue,
114 css::uno::Any & rOldValue,
115 sal_Int32 nHandle,
116 const css::uno::Any& rValue ) override;
117 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
118 sal_Int32 nHandle,
119 const css::uno::Any& rValue
120 ) override;
121 virtual void SAL_CALL getFastPropertyValue(
122 css::uno::Any& rValue,
123 sal_Int32 nHandle
124 ) const override;
125 public:
126 // a Constructor, that is needed for when Returning the Object is needed:
127 ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet);
129
130 // ::cppu::OComponentHelper
131 virtual void SAL_CALL disposing() override;
132 // XInterface
133 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
134 virtual void SAL_CALL acquire() noexcept override;
135 virtual void SAL_CALL release() noexcept override;
136 //XTypeProvider
137 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
138 // XPropertySet
139 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
140 // XResultSet
141 virtual sal_Bool SAL_CALL next( ) override;
142 virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
143 virtual sal_Bool SAL_CALL isAfterLast( ) override;
144 virtual sal_Bool SAL_CALL isFirst( ) override;
145 virtual sal_Bool SAL_CALL isLast( ) override;
146 virtual void SAL_CALL beforeFirst( ) override;
147 virtual void SAL_CALL afterLast( ) override;
148 virtual sal_Bool SAL_CALL first( ) override;
149 virtual sal_Bool SAL_CALL last( ) override;
150 virtual sal_Int32 SAL_CALL getRow( ) override;
151 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
152 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
153 virtual sal_Bool SAL_CALL previous( ) override;
154 virtual void SAL_CALL refreshRow( ) override;
155 virtual sal_Bool SAL_CALL rowUpdated( ) override;
156 virtual sal_Bool SAL_CALL rowInserted( ) override;
157 virtual sal_Bool SAL_CALL rowDeleted( ) override;
158 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement( ) override;
159 // XRow
160 virtual sal_Bool SAL_CALL wasNull( ) override;
161 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
162 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
163 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
164 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
165 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
166 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
167 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
168 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
169 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
170 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
171 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
172 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
173 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
174 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
175 virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
176 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
177 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
178 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
179 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
180 // XResultSetMetaDataSupplier
181 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) override;
182 // XCancellable
183 virtual void SAL_CALL cancel( ) override;
184 // XCloseable
185 virtual void SAL_CALL close( ) override;
186 // XWarningsSupplier
187 virtual css::uno::Any SAL_CALL getWarnings( ) override;
188 virtual void SAL_CALL clearWarnings( ) override;
189 // XColumnLocate
190 virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) override;
191
192 const std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; }
193
194 void setCatalogsMap();
195 void setSchemasMap();
197 void setColumnsMap();
198 void setTablesMap();
200 void setProceduresMap();
203 void setPrimaryKeysMap();
204 void setIndexInfoMap();
207 void setTypeInfoMap(bool _bJetEngine);
208 };
209
210 inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column)
211 {
212 sal_Int32 map = column;
213
214 if (!m_aColMapping.empty())
215 {
216 // Validate column number
217 map = m_aColMapping[column];
218 }
219
220 return map;
221 }
222
223}
224
225/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
std::map< sal_Int32,::std::map< sal_Int32, sal_Int32 > >::iterator m_aValueRangeIter
virtual sal_Int32 SAL_CALL findColumn(const OUString &columnName) override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
std::map< sal_Int32, ::std::map< sal_Int32, sal_Int32 > > m_aValueRange
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< OUString, sal_Int32 > >::iterator m_aStrValueRangeIter
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< OUString, sal_Int32 > > m_aStrValueRange
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< sal_Int32, OUString > >::iterator m_aIntValueRangeIter
virtual void SAL_CALL release() noexcept override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getWarnings() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
std::map< sal_Int32, std::map< sal_Int32, OUString > > m_aIntValueRange
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
Type
::cppu::WeakComponentImplHelper< css::sdbc::XResultSet, css::sdbc::XRow, css::sdbc::XResultSetMetaDataSupplier, css::util::XCancellable, css::sdbc::XWarningsSupplier, css::sdbc::XCloseable, css::sdbc::XColumnLocate > ODatabaseMetaDataResultSet_BASE
const char * columnName
Definition: pq_statics.cxx:56
std::map< OUString, rtl::Reference< Entity > > map
unsigned char sal_Bool
signed char sal_Int8