LibreOffice Module connectivity (master) 1
pq_baseresultset.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * Effective License of whole file:
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1, as published by the Free Software Foundation.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 *
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 *
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
24 *
25 * Copyright: 2000 by Sun Microsystems, Inc.
26 *
27 * Contributor(s): Joerg Budischewski
28 *
29 * All parts contributed on or after August 2011:
30 *
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
34 *
35 ************************************************************************/
36
37#pragma once
38
41
42#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
43#include <com/sun/star/sdbc/XRow.hpp>
44#include <com/sun/star/sdbc/XCloseable.hpp>
45#include <com/sun/star/sdbc/XColumnLocate.hpp>
46#include "pq_connection.hxx"
47
48namespace pq_sdbc_driver
49{
50
51const sal_Int32 BASERESULTSET_CURSOR_NAME = 0;
54const sal_Int32 BASERESULTSET_FETCH_SIZE = 3;
58
59#define BASERESULTSET_SIZE 7
60
61typedef ::cppu::WeakComponentImplHelper< css::sdbc::XCloseable,
62 css::sdbc::XResultSetMetaDataSupplier,
63 css::sdbc::XResultSet,
64 css::sdbc::XRow,
65 css::sdbc::XColumnLocate
69{
70protected:
72 css::uno::Reference< css::uno::XInterface > m_owner;
73 css::uno::Reference< css::script::XTypeConverter > m_tc;
75 sal_Int32 m_row;
76 sal_Int32 m_rowCount;
77 sal_Int32 m_fieldCount;
79
80protected:
86 virtual void checkClosed() = 0;
89 void checkColumnIndex( sal_Int32 index );
90 void checkRowIndex();
91
92 virtual css::uno::Any getValue( sal_Int32 columnIndex ) = 0;
93 css::uno::Any convertTo(
94 const css::uno::Any &str, const css::uno::Type &type );
95
96protected:
98 const ::rtl::Reference< comphelper::RefCountedMutex > & mutex,
99 const css::uno::Reference< css::uno::XInterface > &owner,
100 sal_Int32 rowCount,
101 sal_Int32 columnCount,
102 const css::uno::Reference< css::script::XTypeConverter > &tc );
103 virtual ~BaseResultSet() override;
104
105public: // XInterface
106 virtual void SAL_CALL acquire() noexcept override { BaseResultSet_BASE::acquire(); }
107 virtual void SAL_CALL release() noexcept override { BaseResultSet_BASE::release(); }
108 virtual css::uno::Any SAL_CALL queryInterface(
109 const css::uno::Type & reqType ) override;
110
111public: // XCloseable
112// virtual void SAL_CALL close( )
113// throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
114
115public: // XTypeProvider, first implemented by OPropertySetHelper
116 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
117 virtual css::uno::Sequence< sal_Int8> SAL_CALL getImplementationId() override;
118
119public: // XResultSetMetaDataSupplier
120// virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( )
121// throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
122
123public: // XResultSet
124 // Methods
125 virtual sal_Bool SAL_CALL next( ) override;
126 virtual sal_Bool SAL_CALL isBeforeFirst( ) override;
127 virtual sal_Bool SAL_CALL isAfterLast( ) override;
128 virtual sal_Bool SAL_CALL isFirst( ) override;
129 virtual sal_Bool SAL_CALL isLast( ) override;
130 virtual void SAL_CALL beforeFirst( ) override;
131 virtual void SAL_CALL afterLast( ) override;
132 virtual sal_Bool SAL_CALL first( ) override;
133 virtual sal_Bool SAL_CALL last( ) override;
134 virtual sal_Int32 SAL_CALL getRow( ) override;
135 virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) override;
136 virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) override;
137 virtual sal_Bool SAL_CALL previous( ) override;
138 virtual void SAL_CALL refreshRow( ) override;
139 virtual sal_Bool SAL_CALL rowUpdated( ) override;
140 virtual sal_Bool SAL_CALL rowInserted( ) override;
141 virtual sal_Bool SAL_CALL rowDeleted( ) override;
142 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override;
143
144
145public: // XRow
146 virtual sal_Bool SAL_CALL wasNull( ) override;
147 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
148 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
149 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
150 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
151 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
152 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
153 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
154 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
155 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
156 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
157 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
158 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
159 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
160 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
161 virtual css::uno::Any SAL_CALL getObject(
162 sal_Int32 columnIndex,
163 const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
164 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
165 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
166 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
167 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
168
169public: // XColumnLocate
170// virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName )
171// throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
172
173public: // OPropertySetHelper
174 virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
175
176 virtual sal_Bool SAL_CALL convertFastPropertyValue(
177 css::uno::Any & rConvertedValue,
178 css::uno::Any & rOldValue,
179 sal_Int32 nHandle,
180 const css::uno::Any& rValue ) override;
181
182 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
183 sal_Int32 nHandle,
184 const css::uno::Any& rValue ) override;
185
186 using ::cppu::OPropertySetHelper::getFastPropertyValue;
187
188 void SAL_CALL getFastPropertyValue(
189 css::uno::Any& rValue,
190 sal_Int32 nHandle ) const override;
191
192 // XPropertySet
193 css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
194
195public: // OComponentHelper
196 virtual void SAL_CALL disposing() override;
197
198
199};
200
201}
202
203/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
css::uno::Reference< css::uno::XInterface > m_owner
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
BaseResultSet(const ::rtl::Reference< comphelper::RefCountedMutex > &mutex, const css::uno::Reference< css::uno::XInterface > &owner, sal_Int32 rowCount, sal_Int32 columnCount, const css::uno::Reference< css::script::XTypeConverter > &tc)
virtual sal_Bool SAL_CALL rowUpdated() override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL rowInserted() override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
virtual void checkClosed()=0
mutex should be locked before called
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getStatement() override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL previous() override
virtual void SAL_CALL beforeFirst() override
virtual sal_Int32 SAL_CALL getRow() override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
css::uno::Reference< css::script::XTypeConverter > m_tc
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL isAfterLast() override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
::rtl::Reference< comphelper::RefCountedMutex > m_xMutex
void checkColumnIndex(sal_Int32 index)
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual sal_Bool SAL_CALL rowDeleted() override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL disposing() override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL last() 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 css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL wasNull() override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
css::uno::Any convertTo(const css::uno::Any &str, const css::uno::Type &type)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL isLast() override
virtual sal_Bool SAL_CALL next() override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) override
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual void SAL_CALL release() noexcept override
css::uno::Any m_props[BASERESULTSET_SIZE]
virtual void SAL_CALL refreshRow() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &reqType) override
void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Any getValue(sal_Int32 columnIndex)=0
virtual sal_Bool SAL_CALL first() override
virtual void SAL_CALL afterLast() override
virtual sal_Bool SAL_CALL isFirst() override
virtual sal_Bool SAL_CALL isBeforeFirst() override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY
const sal_Int32 BASERESULTSET_FETCH_DIRECTION
const sal_Int32 BASERESULTSET_IS_BOOKMARKABLE
const sal_Int32 BASERESULTSET_RESULT_SET_TYPE
::cppu::WeakComponentImplHelper< css::sdbc::XCloseable, css::sdbc::XResultSetMetaDataSupplier, css::sdbc::XResultSet, css::sdbc::XRow, css::sdbc::XColumnLocate > BaseResultSet_BASE
const sal_Int32 BASERESULTSET_CURSOR_NAME
const sal_Int32 BASERESULTSET_ESCAPE_PROCESSING
const sal_Int32 BASERESULTSET_FETCH_SIZE
#define BASERESULTSET_SIZE
sal_Int32 type
Definition: pq_statics.cxx:60
unsigned char sal_Bool
signed char sal_Int8