Use correct object
[LibreOffice.git] / connectivity / source / drivers / postgresql / pq_baseresultset.hxx
blob90e6609a08606fc16b408ad05cbdc9293acf9a76
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
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.
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.
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
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
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/.
35 ************************************************************************/
37 #pragma once
39 #include <cppuhelper/propshlp.hxx>
40 #include <cppuhelper/component.hxx>
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"
48 namespace pq_sdbc_driver
51 const sal_Int32 BASERESULTSET_CURSOR_NAME = 0;
52 const sal_Int32 BASERESULTSET_ESCAPE_PROCESSING = 1;
53 const sal_Int32 BASERESULTSET_FETCH_DIRECTION = 2;
54 const sal_Int32 BASERESULTSET_FETCH_SIZE = 3;
55 const sal_Int32 BASERESULTSET_IS_BOOKMARKABLE = 4;
56 const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY = 5;
57 const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 6;
59 #define BASERESULTSET_SIZE 7
61 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XCloseable,
62 css::sdbc::XResultSetMetaDataSupplier,
63 css::sdbc::XResultSet,
64 css::sdbc::XRow,
65 css::sdbc::XColumnLocate
66 > BaseResultSet_BASE;
67 class BaseResultSet : public BaseResultSet_BASE,
68 public cppu::OPropertySetHelper
70 protected:
71 css::uno::Any m_props[BASERESULTSET_SIZE];
72 css::uno::Reference< css::uno::XInterface > m_owner;
73 css::uno::Reference< css::script::XTypeConverter > m_tc;
74 ::rtl::Reference< comphelper::RefCountedMutex > m_xMutex;
75 sal_Int32 m_row;
76 sal_Int32 m_rowCount;
77 sal_Int32 m_fieldCount;
78 bool m_wasNull;
80 protected:
81 /** mutex should be locked before called
83 @throws css::sdbc::SQLException
84 @throws css::uno::RuntimeException
86 virtual void checkClosed() = 0;
87 /// @throws css::sdbc::SQLException
88 /// @throws css::uno::RuntimeException
89 void checkColumnIndex( sal_Int32 index );
90 void checkRowIndex();
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 );
96 protected:
97 BaseResultSet(
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;
105 public: // 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;
111 public: // XCloseable
112 // virtual void SAL_CALL close( )
113 // throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
115 public: // 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;
119 public: // XResultSetMetaDataSupplier
120 // virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( )
121 // throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
123 public: // 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;
145 public: // 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;
169 public: // XColumnLocate
170 // virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName )
171 // throw (css::sdbc::SQLException, css::uno::RuntimeException) = 0;
173 public: // OPropertySetHelper
174 virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
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;
182 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
183 sal_Int32 nHandle,
184 const css::uno::Any& rValue ) override;
186 using ::cppu::OPropertySetHelper::getFastPropertyValue;
188 void SAL_CALL getFastPropertyValue(
189 css::uno::Any& rValue,
190 sal_Int32 nHandle ) const override;
192 // XPropertySet
193 css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
195 public: // OComponentHelper
196 virtual void SAL_CALL disposing() override;
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */