Line data Source code
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 : #ifndef INCLUDED_UCBHELPER_RESULTSET_HXX
21 : #define INCLUDED_UCBHELPER_RESULTSET_HXX
22 :
23 : #include <com/sun/star/lang/XTypeProvider.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/lang/XComponent.hpp>
26 : #include <com/sun/star/ucb/ResultSetException.hpp>
27 : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
28 : #include <com/sun/star/ucb/XContentAccess.hpp>
29 : #include <com/sun/star/sdbc/XResultSet.hpp>
30 : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
31 : #include <com/sun/star/sdbc/XRow.hpp>
32 : #include <com/sun/star/sdbc/XCloseable.hpp>
33 : #include <com/sun/star/beans/XPropertySet.hpp>
34 :
35 : #include <rtl/ref.hxx>
36 : #include <salhelper/simplereferenceobject.hxx>
37 : #include <cppuhelper/weak.hxx>
38 : #include <ucbhelper/macros.hxx>
39 : #include <ucbhelper/ucbhelperdllapi.h>
40 :
41 : namespace ucbhelper {
42 :
43 :
44 :
45 : #define RESULTSET_SERVICE_NAME "com.sun.star.ucb.ContentResultSet"
46 :
47 :
48 :
49 : class ResultSetDataSupplier;
50 : struct ResultSet_Impl;
51 :
52 : /**
53 : * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
54 : * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
55 : * which needs to be implemented for instance to implement the command "open"
56 : * at folder objects. This class uses a user supplied ResultSetDataSupplier
57 : * object to request data on demand.
58 : *
59 : * @see ResultSetDataSupplier
60 : */
61 : class UCBHELPER_DLLPUBLIC ResultSet :
62 : public cppu::OWeakObject,
63 : public com::sun::star::lang::XTypeProvider,
64 : public com::sun::star::lang::XServiceInfo,
65 : public com::sun::star::lang::XComponent,
66 : public com::sun::star::ucb::XContentAccess,
67 : public com::sun::star::sdbc::XResultSet,
68 : public com::sun::star::sdbc::XResultSetMetaDataSupplier,
69 : public com::sun::star::sdbc::XRow,
70 : public com::sun::star::sdbc::XCloseable,
71 : public com::sun::star::beans::XPropertySet
72 : {
73 : ResultSet_Impl* m_pImpl;
74 :
75 : public:
76 : /**
77 : * Construction.
78 : *
79 : * @param rxSMgr is a Service Manager.
80 : * @param rProperties is a sequence of properties for that the resultset
81 : * shall be able to obtain the values.
82 : * @param rDataSupplier is a supplier for the resultset data.
83 : */
84 : ResultSet(
85 : const com::sun::star::uno::Reference<
86 : com::sun::star::uno::XComponentContext >& rxContext,
87 : const com::sun::star::uno::Sequence<
88 : com::sun::star::beans::Property >& rProperties,
89 : const rtl::Reference< ResultSetDataSupplier >& rDataSupplier );
90 : /**
91 : * Construction.
92 : *
93 : * @param rxSMgr is a Service Manager.
94 : * @param rProperties is a sequence of properties for that the resultset
95 : * shall be able to obtain the values.
96 : * @param rDataSupplier is a supplier for the resultset data.
97 : * @param rxEnv is the environment for interactions, progress propagation,
98 : * ...
99 : */
100 : ResultSet(
101 : const com::sun::star::uno::Reference<
102 : com::sun::star::uno::XComponentContext >& rxContext,
103 : const com::sun::star::uno::Sequence<
104 : com::sun::star::beans::Property >& rProperties,
105 : const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
106 : const com::sun::star::uno::Reference<
107 : com::sun::star::ucb::XCommandEnvironment >& rxEnv );
108 : virtual ~ResultSet();
109 :
110 : // XInterface
111 : virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
112 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
113 : virtual void SAL_CALL acquire()
114 : throw() SAL_OVERRIDE;
115 : virtual void SAL_CALL release()
116 : throw() SAL_OVERRIDE;
117 :
118 : // XTypeProvider
119 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
120 : getImplementationId()
121 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
122 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
123 : getTypes()
124 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
125 :
126 : // XServiceInfo
127 : virtual OUString SAL_CALL getImplementationName()
128 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
129 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
130 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
131 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
132 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
133 :
134 : static OUString getImplementationName_Static();
135 : static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
136 :
137 : // XComponent
138 : virtual void SAL_CALL
139 : dispose()
140 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
141 : virtual void SAL_CALL
142 : addEventListener( const com::sun::star::uno::Reference<
143 : com::sun::star::lang::XEventListener >& Listener )
144 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
145 : virtual void SAL_CALL
146 : removeEventListener( const com::sun::star::uno::Reference<
147 : com::sun::star::lang::XEventListener >& Listener )
148 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
149 :
150 : // XContentAccess
151 : virtual OUString SAL_CALL
152 : queryContentIdentifierString()
153 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
154 : virtual com::sun::star::uno::Reference<
155 : com::sun::star::ucb::XContentIdentifier > SAL_CALL
156 : queryContentIdentifier()
157 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
158 : virtual com::sun::star::uno::Reference<
159 : com::sun::star::ucb::XContent > SAL_CALL
160 : queryContent()
161 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
162 :
163 : // XResultSetMetaDataSupplier
164 : virtual com::sun::star::uno::Reference<
165 : com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
166 : getMetaData()
167 : throw( com::sun::star::sdbc::SQLException,
168 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
169 :
170 : // XResultSet
171 : virtual sal_Bool SAL_CALL
172 : next()
173 : throw( com::sun::star::sdbc::SQLException,
174 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
175 : virtual sal_Bool SAL_CALL
176 : isBeforeFirst()
177 : throw( com::sun::star::sdbc::SQLException,
178 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
179 : virtual sal_Bool SAL_CALL
180 : isAfterLast()
181 : throw( com::sun::star::sdbc::SQLException,
182 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
183 : virtual sal_Bool SAL_CALL
184 : isFirst()
185 : throw( com::sun::star::sdbc::SQLException,
186 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
187 : virtual sal_Bool SAL_CALL
188 : isLast()
189 : throw( com::sun::star::sdbc::SQLException,
190 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
191 : virtual void SAL_CALL
192 : beforeFirst()
193 : throw( com::sun::star::sdbc::SQLException,
194 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
195 : virtual void SAL_CALL
196 : afterLast()
197 : throw( com::sun::star::sdbc::SQLException,
198 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
199 : virtual sal_Bool SAL_CALL
200 : first()
201 : throw( com::sun::star::sdbc::SQLException,
202 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
203 : virtual sal_Bool SAL_CALL
204 : last()
205 : throw( com::sun::star::sdbc::SQLException,
206 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
207 : virtual sal_Int32 SAL_CALL
208 : getRow()
209 : throw( com::sun::star::sdbc::SQLException,
210 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
211 : virtual sal_Bool SAL_CALL
212 : absolute( sal_Int32 row )
213 : throw( com::sun::star::sdbc::SQLException,
214 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
215 : virtual sal_Bool SAL_CALL
216 : relative( sal_Int32 rows )
217 : throw( com::sun::star::sdbc::SQLException,
218 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
219 : virtual sal_Bool SAL_CALL
220 : previous()
221 : throw( com::sun::star::sdbc::SQLException,
222 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
223 : virtual void SAL_CALL
224 : refreshRow()
225 : throw( com::sun::star::sdbc::SQLException,
226 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
227 : virtual sal_Bool SAL_CALL
228 : rowUpdated()
229 : throw( com::sun::star::sdbc::SQLException,
230 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
231 : virtual sal_Bool SAL_CALL
232 : rowInserted()
233 : throw( com::sun::star::sdbc::SQLException,
234 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
235 : virtual sal_Bool SAL_CALL
236 : rowDeleted()
237 : throw( com::sun::star::sdbc::SQLException,
238 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
239 : virtual com::sun::star::uno::Reference<
240 : com::sun::star::uno::XInterface > SAL_CALL
241 : getStatement()
242 : throw( com::sun::star::sdbc::SQLException,
243 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
244 :
245 : // XRow
246 : virtual sal_Bool SAL_CALL
247 : wasNull()
248 : throw( com::sun::star::sdbc::SQLException,
249 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
250 : virtual OUString SAL_CALL
251 : getString( sal_Int32 columnIndex )
252 : throw( com::sun::star::sdbc::SQLException,
253 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
254 : virtual sal_Bool SAL_CALL
255 : getBoolean( sal_Int32 columnIndex )
256 : throw( com::sun::star::sdbc::SQLException,
257 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
258 : virtual sal_Int8 SAL_CALL
259 : getByte( sal_Int32 columnIndex )
260 : throw( com::sun::star::sdbc::SQLException,
261 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
262 : virtual sal_Int16 SAL_CALL
263 : getShort( sal_Int32 columnIndex )
264 : throw( com::sun::star::sdbc::SQLException,
265 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
266 : virtual sal_Int32 SAL_CALL
267 : getInt( sal_Int32 columnIndex )
268 : throw( com::sun::star::sdbc::SQLException,
269 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
270 : virtual sal_Int64 SAL_CALL
271 : getLong( sal_Int32 columnIndex )
272 : throw( com::sun::star::sdbc::SQLException,
273 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
274 : virtual float SAL_CALL
275 : getFloat( sal_Int32 columnIndex )
276 : throw( com::sun::star::sdbc::SQLException,
277 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
278 : virtual double SAL_CALL
279 : getDouble( sal_Int32 columnIndex )
280 : throw( com::sun::star::sdbc::SQLException,
281 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
282 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
283 : getBytes( sal_Int32 columnIndex )
284 : throw( com::sun::star::sdbc::SQLException,
285 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
286 : virtual com::sun::star::util::Date SAL_CALL
287 : getDate( sal_Int32 columnIndex )
288 : throw( com::sun::star::sdbc::SQLException,
289 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
290 : virtual com::sun::star::util::Time SAL_CALL
291 : getTime( sal_Int32 columnIndex )
292 : throw( com::sun::star::sdbc::SQLException,
293 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
294 : virtual com::sun::star::util::DateTime SAL_CALL
295 : getTimestamp( sal_Int32 columnIndex )
296 : throw( com::sun::star::sdbc::SQLException,
297 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
298 : virtual com::sun::star::uno::Reference<
299 : com::sun::star::io::XInputStream > SAL_CALL
300 : getBinaryStream( sal_Int32 columnIndex )
301 : throw( com::sun::star::sdbc::SQLException,
302 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
303 : virtual com::sun::star::uno::Reference<
304 : com::sun::star::io::XInputStream > SAL_CALL
305 : getCharacterStream( sal_Int32 columnIndex )
306 : throw( com::sun::star::sdbc::SQLException,
307 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
308 : virtual com::sun::star::uno::Any SAL_CALL
309 : getObject( sal_Int32 columnIndex,
310 : const com::sun::star::uno::Reference<
311 : com::sun::star::container::XNameAccess >& typeMap )
312 : throw( com::sun::star::sdbc::SQLException,
313 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
314 : virtual com::sun::star::uno::Reference<
315 : com::sun::star::sdbc::XRef > SAL_CALL
316 : getRef( sal_Int32 columnIndex )
317 : throw( com::sun::star::sdbc::SQLException,
318 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
319 : virtual com::sun::star::uno::Reference<
320 : com::sun::star::sdbc::XBlob > SAL_CALL
321 : getBlob( sal_Int32 columnIndex )
322 : throw( com::sun::star::sdbc::SQLException,
323 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
324 : virtual com::sun::star::uno::Reference<
325 : com::sun::star::sdbc::XClob > SAL_CALL
326 : getClob( sal_Int32 columnIndex )
327 : throw( com::sun::star::sdbc::SQLException,
328 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
329 : virtual com::sun::star::uno::Reference<
330 : com::sun::star::sdbc::XArray > SAL_CALL
331 : getArray( sal_Int32 columnIndex )
332 : throw( com::sun::star::sdbc::SQLException,
333 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
334 :
335 : // XCloseable
336 : virtual void SAL_CALL
337 : close()
338 : throw( com::sun::star::sdbc::SQLException,
339 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
340 :
341 : // XPropertySet
342 : virtual com::sun::star::uno::Reference<
343 : com::sun::star::beans::XPropertySetInfo > SAL_CALL
344 : getPropertySetInfo()
345 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
346 : virtual void SAL_CALL
347 : setPropertyValue( const OUString& aPropertyName,
348 : const com::sun::star::uno::Any& aValue )
349 : throw( com::sun::star::beans::UnknownPropertyException,
350 : com::sun::star::beans::PropertyVetoException,
351 : com::sun::star::lang::IllegalArgumentException,
352 : com::sun::star::lang::WrappedTargetException,
353 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
354 : virtual com::sun::star::uno::Any SAL_CALL
355 : getPropertyValue( const OUString& PropertyName )
356 : throw( com::sun::star::beans::UnknownPropertyException,
357 : com::sun::star::lang::WrappedTargetException,
358 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
359 : virtual void SAL_CALL
360 : addPropertyChangeListener( const OUString& aPropertyName,
361 : const com::sun::star::uno::Reference<
362 : com::sun::star::beans::XPropertyChangeListener >& xListener )
363 : throw( com::sun::star::beans::UnknownPropertyException,
364 : com::sun::star::lang::WrappedTargetException,
365 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
366 : virtual void SAL_CALL
367 : removePropertyChangeListener( const OUString& aPropertyName,
368 : const com::sun::star::uno::Reference<
369 : com::sun::star::beans::XPropertyChangeListener >& aListener )
370 : throw( com::sun::star::beans::UnknownPropertyException,
371 : com::sun::star::lang::WrappedTargetException,
372 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
373 : virtual void SAL_CALL
374 : addVetoableChangeListener( const OUString& PropertyName,
375 : const com::sun::star::uno::Reference<
376 : com::sun::star::beans::XVetoableChangeListener >& aListener )
377 : throw( com::sun::star::beans::UnknownPropertyException,
378 : com::sun::star::lang::WrappedTargetException,
379 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
380 : virtual void SAL_CALL
381 : removeVetoableChangeListener( const OUString& PropertyName,
382 : const com::sun::star::uno::Reference<
383 : com::sun::star::beans::XVetoableChangeListener >& aListener )
384 : throw( com::sun::star::beans::UnknownPropertyException,
385 : com::sun::star::lang::WrappedTargetException,
386 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
387 :
388 :
389 : // Non-interface methods.
390 :
391 :
392 : /**
393 : * This method propagates property value changes to all registered
394 : * listeners.
395 : *
396 : * @param rEvt is a property change event.
397 : */
398 : void propertyChanged(
399 : const com::sun::star::beans::PropertyChangeEvent& rEvt );
400 :
401 : /**
402 : * This method should be called by the data supplier for the result set
403 : * to indicate that there were new data obtained from the data source.
404 : *
405 : * @param nOld is the old count of rows; must be non-negative.
406 : * @param nnew is the new count of rows; must be non-negative.
407 : */
408 : void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
409 :
410 : /**
411 : * This method should be called by the data supplier for the result set
412 : * to indicate that there were all rows obtained from the data source.
413 : */
414 : void rowCountFinal();
415 :
416 : /**
417 : * This method returns a sequence containing all properties ( not the
418 : * values! ) of the result set.
419 : *
420 : * @return a sequence of properties.
421 : */
422 : const com::sun::star::uno::Sequence< com::sun::star::beans::Property >&
423 : getProperties();
424 :
425 : /**
426 : * This method returns the environment to use for interactions, progress
427 : * propagation, ... It can by empty.
428 : *
429 : * @return an environment or an empty reference.
430 : */
431 : const com::sun::star::uno::Reference<
432 : com::sun::star::ucb::XCommandEnvironment >&
433 : getEnvironment();
434 : };
435 :
436 :
437 :
438 : /**
439 : * This is the base class for an object that supplies data to a result set
440 : *
441 : * @see ResultSet
442 : */
443 42 : class ResultSetDataSupplier : public salhelper::SimpleReferenceObject
444 : {
445 : friend class ResultSet;
446 :
447 : // No ref, otherwise we get a cyclic reference between supplier and set!
448 : // Will be set from ResultSet ctor.
449 : ResultSet* m_pResultSet;
450 :
451 : public:
452 42 : ResultSetDataSupplier() : m_pResultSet( 0 ) {}
453 :
454 : /**
455 : * This method returns the resultset this supplier belongs to.
456 : *
457 : * @return the resultset for that the supplier supplies data.
458 : */
459 98 : rtl::Reference< ResultSet > getResultSet() const { return m_pResultSet; }
460 :
461 : /**
462 : * This method returns the identifier string of the content at the
463 : * specified index.
464 : *
465 : * @param nIndex is the zero-based index within the logical data array
466 : * of the supplier; must be non-negative.
467 : * @return the content's identifier string.
468 : */
469 : virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
470 :
471 : /**
472 : * This method returns the identifier of the content at the specified index.
473 : *
474 : * @param nIndex is the zero-based index within the logical data array
475 : * of the supplier; must be non-negative.
476 : * @return the content's identifier.
477 : */
478 : virtual com::sun::star::uno::Reference<
479 : com::sun::star::ucb::XContentIdentifier >
480 : queryContentIdentifier( sal_uInt32 nIndex ) = 0;
481 :
482 : /**
483 : * This method returns the content at the specified index.
484 : *
485 : * @param nIndex is the zero-based index within the logical data array
486 : * of the supplier; must be non-negative.
487 : * @return the content.
488 : */
489 : virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
490 : queryContent( sal_uInt32 nIndex ) = 0;
491 :
492 : /**
493 : * This method returns whether there is a content at the specified index.
494 : *
495 : * @param nIndex is the zero-based index within the logical data array
496 : * of the supplier; must be non-negative.
497 : * @return true, if there is a content at the given index.
498 : */
499 : virtual bool getResult( sal_uInt32 nIndex ) = 0;
500 :
501 : /**
502 : * This method returns the total count of objects in the logical data array
503 : * of the supplier. The implementation of this method may be very
504 : * "expensive", because it can be necessary to obtain all data in order
505 : * to determine the count. Therefore the ResultSet implementation calls
506 : * it very seldom.
507 : *
508 : * @return the total count of objects; will always be non-negative.
509 : */
510 : virtual sal_uInt32 totalCount() = 0;
511 :
512 : /**
513 : * This method returns the count of objects obtained so far. There is no
514 : * for the implementation to obtain all objects at once. It can obtain
515 : * all data on demand.
516 : *
517 : * The implementation should call m_pResultSet->rowCountChanged(...)
518 : * every time it has inserted a new entry in its logical result array.
519 : *
520 : * @return the count of objects obtained so far; will always be
521 : * non-negative.
522 : */
523 : virtual sal_uInt32 currentCount() = 0;
524 :
525 : /**
526 : * This method returns whether the value returned by currentCount() is
527 : * "final". This is the case, if that there was all data obtained by the
528 : * supplier and the current count won't increase any more.
529 : *
530 : * The implementation should call m_pResultSet->rowCountFinal(...) if
531 : * it has inserted all entries in its logical result array.
532 : *
533 : * @return true, if the value returned by currentCount() won't change
534 : anymore.
535 : */
536 : virtual bool isCountFinal() = 0;
537 :
538 : /**
539 : * This method returns an object for accessing the property values at
540 : * the specified index. The implementation may use the helper class
541 : * ucb::PropertyValueSet to provide the return value.
542 : *
543 : * @param nIndex is the zero-based index within the logical data array
544 : * of the supplier.
545 : * @return the object for accessing the property values.
546 : */
547 : virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
548 : queryPropertyValues( sal_uInt32 nIndex ) = 0;
549 :
550 : /**
551 : * This method is called to instruct the supplier to release the (possibly
552 : * presnt) property values at the given index.
553 : *
554 : * @param nIndex is the zero-based index within the logical data array
555 : * of the supplier.
556 : */
557 : virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
558 :
559 : /**
560 : * This method will be called by the resultset implementation in order
561 : * to instruct the data supplier to release all resources it has
562 : * allocated so far. In case the supplier is collecting data
563 : * asynchronously, that process must be stopped.
564 : */
565 : virtual void close() = 0;
566 :
567 : /**
568 : * This method will be called by the resultset implementation in order
569 : * check, whether an error has occurred while collecting data. The
570 : * implementation of this method must throw an exception in that case.
571 : *
572 : * Note: An exception thrown to indicate an error must always be thrown
573 : * by the thread that created the data supplier. If the supplier collects
574 : * data asynchronously ( i.e. in a separate thread ) and an error
575 : * occurs, throwing of the appropriate exception must be deferred
576 : * until validate() is called by the ResultSet implementation from
577 : * inside the main thread.
578 : * In case data are obtained synchronously, the ResultSetException can
579 : * be thrown directly.
580 : *
581 : * @exception ResultSetException thrown, if an error has occurred
582 : */
583 : virtual void validate()
584 : throw( com::sun::star::ucb::ResultSetException ) = 0;
585 : };
586 :
587 : }
588 :
589 : #endif /* ! INCLUDED_UCBHELPER_RESULTSET_HXX */
590 :
591 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|