merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / postgresql / pq_baseresultset.hxx
blob410122f0e2a253ddd6696af989d545eef2fd07cf
1 /*************************************************************************
3 * $RCSfile: pq_baseresultset.hxx,v $
5 * $Revision: 1.1.2.3 $
7 * last change: $Author: jbu $ $Date: 2007/08/26 20:40:40 $
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 * MA 02111-1307 USA
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Joerg Budischewski
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Joerg Budischewski
60 ************************************************************************/
62 #ifndef _PG_BASERESULTSET_HXX_
63 #define _PG_BASERESULTSET_HXX_
65 #include <cppuhelper/propshlp.hxx>
66 #include <cppuhelper/component.hxx>
68 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
69 #include <com/sun/star/sdbc/XRow.hpp>
70 #include <com/sun/star/sdbc/XCloseable.hpp>
71 #include <com/sun/star/sdbc/XColumnLocate.hpp>
72 #include "pq_connection.hxx"
74 namespace pq_sdbc_driver
77 static const sal_Int32 BASERESULTSET_CURSOR_NAME = 0;
78 static const sal_Int32 BASERESULTSET_ESCAPE_PROCESSING = 1;
79 static const sal_Int32 BASERESULTSET_FETCH_DIRECTION = 2;
80 static const sal_Int32 BASERESULTSET_FETCH_SIZE = 3;
81 static const sal_Int32 BASERESULTSET_RESULT_SET_CONCURRENCY = 4;
82 static const sal_Int32 BASERESULTSET_RESULT_SET_TYPE = 5;
84 #define BASERESULTSET_SIZE 6
86 class BaseResultSet : public cppu::OComponentHelper,
87 public cppu::OPropertySetHelper,
88 public com::sun::star::sdbc::XCloseable,
89 public com::sun::star::sdbc::XResultSetMetaDataSupplier,
90 public com::sun::star::sdbc::XResultSet,
91 public com::sun::star::sdbc::XRow,
92 public com::sun::star::sdbc::XColumnLocate
94 protected:
95 com::sun::star::uno::Any m_props[BASERESULTSET_SIZE];
96 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_owner;
97 com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter > m_tc;
98 ::rtl::Reference< RefCountedMutex > m_refMutex;
99 sal_Int32 m_row;
100 sal_Int32 m_rowCount;
101 sal_Int32 m_fieldCount;
102 sal_Bool m_wasNull;
104 public:
105 inline cppu::OBroadcastHelper & getRBHelper() { return OComponentHelper::rBHelper;}
107 protected:
108 /** mutex should be locked before called
110 virtual void checkClosed()
111 throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ) = 0;
112 virtual void checkColumnIndex( sal_Int32 index )
113 throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException );
114 virtual void checkRowIndex( sal_Bool mustBeOnValidRow );
116 virtual ::com::sun::star::uno::Any getValue( sal_Int32 columnIndex ) = 0;
117 com::sun::star::uno::Any convertTo(
118 const ::com::sun::star::uno::Any &str, const com::sun::star::uno::Type &type );
120 protected:
121 BaseResultSet(
122 const ::rtl::Reference< RefCountedMutex > & mutex,
123 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
124 sal_Int32 rowCount,
125 sal_Int32 columnCount,
126 const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > &tc );
127 ~BaseResultSet();
129 public: // XInterface
130 virtual void SAL_CALL acquire() throw() { OComponentHelper::acquire(); }
131 virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
132 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
133 const com::sun::star::uno::Type & reqType )
134 throw (com::sun::star::uno::RuntimeException);
136 public: // XCloseable
137 // virtual void SAL_CALL close( )
138 // throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0;
140 public: // XTypeProvider, first implemented by OPropertySetHelper
141 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
142 throw( com::sun::star::uno::RuntimeException );
143 virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
144 throw( com::sun::star::uno::RuntimeException );
146 public: // XResultSetMetaDataSupplier
147 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( )
148 // throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0;
150 public: // XResultSet
151 // Methods
152 virtual sal_Bool SAL_CALL next( )
153 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
154 virtual sal_Bool SAL_CALL isBeforeFirst( )
155 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
156 virtual sal_Bool SAL_CALL isAfterLast( )
157 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
158 virtual sal_Bool SAL_CALL isFirst( )
159 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
160 virtual sal_Bool SAL_CALL isLast( )
161 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
162 virtual void SAL_CALL beforeFirst( )
163 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
164 virtual void SAL_CALL afterLast( )
165 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
166 virtual sal_Bool SAL_CALL first( )
167 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
168 virtual sal_Bool SAL_CALL last( )
169 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
170 virtual sal_Int32 SAL_CALL getRow( )
171 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
172 virtual sal_Bool SAL_CALL absolute( sal_Int32 row )
173 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
174 virtual sal_Bool SAL_CALL relative( sal_Int32 rows )
175 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
176 virtual sal_Bool SAL_CALL previous( )
177 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
178 virtual void SAL_CALL refreshRow( )
179 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
180 virtual sal_Bool SAL_CALL rowUpdated( )
181 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
182 virtual sal_Bool SAL_CALL rowInserted( )
183 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
184 virtual sal_Bool SAL_CALL rowDeleted( )
185 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
186 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement()
187 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
190 public: // XRow
191 virtual sal_Bool SAL_CALL wasNull( )
192 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
193 virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex )
194 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
195 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex )
196 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
197 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex )
198 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
199 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex )
200 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
201 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex )
202 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
203 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex )
204 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
205 virtual float SAL_CALL getFloat( sal_Int32 columnIndex )
206 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
207 virtual double SAL_CALL getDouble( sal_Int32 columnIndex )
208 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
209 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex )
210 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
211 virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex )
212 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
213 virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex )
214 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
215 virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex )
216 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
217 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex )
218 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
219 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex )
220 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
221 virtual ::com::sun::star::uno::Any SAL_CALL getObject(
222 sal_Int32 columnIndex,
223 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap )
224 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
225 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex )
226 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
227 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex )
228 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
229 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex )
230 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
231 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex )
232 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
234 public: // XColumnLocate
235 // virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName )
236 // throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0;
238 public: // OPropertySetHelper
239 virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
241 virtual sal_Bool SAL_CALL convertFastPropertyValue(
242 ::com::sun::star::uno::Any & rConvertedValue,
243 ::com::sun::star::uno::Any & rOldValue,
244 sal_Int32 nHandle,
245 const ::com::sun::star::uno::Any& rValue )
246 throw (::com::sun::star::lang::IllegalArgumentException);
248 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
249 sal_Int32 nHandle,
250 const ::com::sun::star::uno::Any& rValue )
251 throw (::com::sun::star::uno::Exception);
253 virtual void SAL_CALL getFastPropertyValue(
254 ::com::sun::star::uno::Any& rValue,
255 sal_Int32 nHandle ) const;
257 // XPropertySet
258 ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
259 throw(com::sun::star::uno::RuntimeException);
261 public: // OComponentHelper
262 virtual void SAL_CALL disposing();
268 #endif