1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: resultsetbase.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _RESULTSETBASE_HXX
31 #define _RESULTSETBASE_HXX
33 #ifndef INCLUDED_STL_VECTOR
35 #define INCLUDED_STL_VECTOR
37 #include <cppuhelper/weak.hxx>
38 #include <cppuhelper/interfacecontainer.hxx>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/ucb/XContentAccess.hpp>
41 #include <com/sun/star/sdbc/XCloseable.hpp>
42 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <com/sun/star/sdbc/XResultSet.hpp>
44 #include <com/sun/star/sdbc/XRow.hpp>
45 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
46 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
47 #include <com/sun/star/ucb/XContentProvider.hpp>
48 #include <com/sun/star/ucb/XContentIdentifier.hpp>
49 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 #include <com/sun/star/beans/Property.hpp>
56 : public cppu::OWeakObject
,
57 public com::sun::star::lang::XComponent
,
58 public com::sun::star::sdbc::XRow
,
59 public com::sun::star::sdbc::XResultSet
,
60 public com::sun::star::sdbc::XCloseable
,
61 public com::sun::star::sdbc::XResultSetMetaDataSupplier
,
62 public com::sun::star::beans::XPropertySet
,
63 public com::sun::star::ucb::XContentAccess
67 ResultSetBase( const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& xMSF
,
68 const com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>& xProvider
,
70 const com::sun::star::uno::Sequence
< com::sun::star::beans::Property
>& seq
,
71 const com::sun::star::uno::Sequence
< com::sun::star::ucb::NumberedSortingInfo
>& seqSort
);
73 virtual ~ResultSetBase();
76 virtual com::sun::star::uno::Any SAL_CALL
78 const com::sun::star::uno::Type
& aType
)
79 throw( com::sun::star::uno::RuntimeException
);
95 throw( com::sun::star::uno::RuntimeException
);
99 const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& xListener
)
100 throw( com::sun::star::uno::RuntimeException
);
102 virtual void SAL_CALL
103 removeEventListener( const com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>& aListener
)
104 throw( com::sun::star::uno::RuntimeException
);
108 virtual sal_Bool SAL_CALL
111 throw( com::sun::star::sdbc::SQLException
,
112 com::sun::star::uno::RuntimeException
)
114 if( 0<= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
115 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
121 virtual rtl::OUString SAL_CALL
123 sal_Int32 columnIndex
)
124 throw( com::sun::star::sdbc::SQLException
,
125 com::sun::star::uno::RuntimeException
)
127 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
128 return m_aItems
[m_nRow
]->getString( columnIndex
);
130 return rtl::OUString();
133 virtual sal_Bool SAL_CALL
135 sal_Int32 columnIndex
)
136 throw( com::sun::star::sdbc::SQLException
,
137 com::sun::star::uno::RuntimeException
)
139 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
140 return m_aItems
[m_nRow
]->getBoolean( columnIndex
);
145 virtual sal_Int8 SAL_CALL
147 sal_Int32 columnIndex
)
148 throw( com::sun::star::sdbc::SQLException
,
149 com::sun::star::uno::RuntimeException
)
151 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
152 return m_aItems
[m_nRow
]->getByte( columnIndex
);
154 return sal_Int8( 0 );
157 virtual sal_Int16 SAL_CALL
159 sal_Int32 columnIndex
)
161 com::sun::star::sdbc::SQLException
,
162 com::sun::star::uno::RuntimeException
)
164 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
165 return m_aItems
[m_nRow
]->getShort( columnIndex
);
167 return sal_Int16( 0 );
170 virtual sal_Int32 SAL_CALL
172 sal_Int32 columnIndex
)
173 throw( com::sun::star::sdbc::SQLException
,
174 com::sun::star::uno::RuntimeException
)
176 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
177 return m_aItems
[m_nRow
]->getInt( columnIndex
);
179 return sal_Int32( 0 );
182 virtual sal_Int64 SAL_CALL
184 sal_Int32 columnIndex
)
185 throw( com::sun::star::sdbc::SQLException
,
186 com::sun::star::uno::RuntimeException
)
188 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
189 return m_aItems
[m_nRow
]->getLong( columnIndex
);
191 return sal_Int64( 0 );
194 virtual float SAL_CALL
196 sal_Int32 columnIndex
)
197 throw( com::sun::star::sdbc::SQLException
,
198 com::sun::star::uno::RuntimeException
)
200 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
201 return m_aItems
[m_nRow
]->getFloat( columnIndex
);
206 virtual double SAL_CALL
208 sal_Int32 columnIndex
)
209 throw( com::sun::star::sdbc::SQLException
,
210 com::sun::star::uno::RuntimeException
)
212 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
213 return m_aItems
[m_nRow
]->getDouble( columnIndex
);
218 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
220 sal_Int32 columnIndex
)
221 throw( com::sun::star::sdbc::SQLException
,
222 com::sun::star::uno::RuntimeException
)
224 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
225 return m_aItems
[m_nRow
]->getBytes( columnIndex
);
227 return com::sun::star::uno::Sequence
< sal_Int8
>();
230 virtual com::sun::star::util::Date SAL_CALL
232 sal_Int32 columnIndex
)
233 throw( com::sun::star::sdbc::SQLException
,
234 com::sun::star::uno::RuntimeException
)
236 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
237 return m_aItems
[m_nRow
]->getDate( columnIndex
);
239 return com::sun::star::util::Date();
242 virtual com::sun::star::util::Time SAL_CALL
244 sal_Int32 columnIndex
)
245 throw( com::sun::star::sdbc::SQLException
,
246 com::sun::star::uno::RuntimeException
)
248 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
249 return m_aItems
[m_nRow
]->getTime( columnIndex
);
251 return com::sun::star::util::Time();
254 virtual com::sun::star::util::DateTime SAL_CALL
256 sal_Int32 columnIndex
)
257 throw( com::sun::star::sdbc::SQLException
,
258 com::sun::star::uno::RuntimeException
)
260 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
261 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
263 return com::sun::star::util::DateTime();
266 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
268 sal_Int32 columnIndex
)
269 throw( com::sun::star::sdbc::SQLException
,
270 com::sun::star::uno::RuntimeException
)
272 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
273 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
275 return com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>();
278 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
280 sal_Int32 columnIndex
)
281 throw( com::sun::star::sdbc::SQLException
,
282 com::sun::star::uno::RuntimeException
)
284 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
285 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
287 return com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
>();
290 virtual com::sun::star::uno::Any SAL_CALL
292 sal_Int32 columnIndex
,
293 const com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
>& typeMap
)
294 throw( com::sun::star::sdbc::SQLException
,
295 com::sun::star::uno::RuntimeException
)
297 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
298 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
300 return com::sun::star::uno::Any();
303 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XRef
> SAL_CALL
305 sal_Int32 columnIndex
)
306 throw( com::sun::star::sdbc::SQLException
,
307 com::sun::star::uno::RuntimeException
)
309 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
310 return m_aItems
[m_nRow
]->getRef( columnIndex
);
312 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XRef
>();
315 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XBlob
> SAL_CALL
317 sal_Int32 columnIndex
)
318 throw( com::sun::star::sdbc::SQLException
,
319 com::sun::star::uno::RuntimeException
)
321 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
322 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
324 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XBlob
>();
327 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XClob
> SAL_CALL
329 sal_Int32 columnIndex
)
330 throw( com::sun::star::sdbc::SQLException
,
331 com::sun::star::uno::RuntimeException
)
333 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
334 return m_aItems
[m_nRow
]->getClob( columnIndex
);
336 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XClob
>();
339 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XArray
> SAL_CALL
341 sal_Int32 columnIndex
)
342 throw( com::sun::star::sdbc::SQLException
,
343 com::sun::star::uno::RuntimeException
)
345 if( 0 <= m_nRow
&& sal::static_int_cast
<sal_uInt32
>( m_nRow
) < m_aItems
.size() )
346 return m_aItems
[m_nRow
]->getArray( columnIndex
);
348 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XArray
>();
354 virtual sal_Bool SAL_CALL
357 throw( com::sun::star::sdbc::SQLException
,
358 com::sun::star::uno::RuntimeException
);
360 virtual sal_Bool SAL_CALL
363 throw( com::sun::star::sdbc::SQLException
,
364 com::sun::star::uno::RuntimeException
);
366 virtual sal_Bool SAL_CALL
369 throw( com::sun::star::sdbc::SQLException
,
370 com::sun::star::uno::RuntimeException
);
372 virtual sal_Bool SAL_CALL
375 throw( com::sun::star::sdbc::SQLException
,
376 com::sun::star::uno::RuntimeException
);
378 virtual sal_Bool SAL_CALL
381 throw( com::sun::star::sdbc::SQLException
,
382 com::sun::star::uno::RuntimeException
);
384 virtual void SAL_CALL
387 throw( com::sun::star::sdbc::SQLException
,
388 com::sun::star::uno::RuntimeException
);
390 virtual void SAL_CALL
393 throw( com::sun::star::sdbc::SQLException
,
394 com::sun::star::uno::RuntimeException
);
396 virtual sal_Bool SAL_CALL
399 throw( com::sun::star::sdbc::SQLException
,
400 com::sun::star::uno::RuntimeException
);
402 virtual sal_Bool SAL_CALL
405 throw( com::sun::star::sdbc::SQLException
,
406 com::sun::star::uno::RuntimeException
);
408 virtual sal_Int32 SAL_CALL
411 throw( com::sun::star::sdbc::SQLException
,
412 com::sun::star::uno::RuntimeException
);
414 virtual sal_Bool SAL_CALL
417 throw( com::sun::star::sdbc::SQLException
,
418 com::sun::star::uno::RuntimeException
);
420 virtual sal_Bool SAL_CALL
423 throw( com::sun::star::sdbc::SQLException
,
424 com::sun::star::uno::RuntimeException
);
426 virtual sal_Bool SAL_CALL
429 throw( com::sun::star::sdbc::SQLException
,
430 com::sun::star::uno::RuntimeException
);
432 virtual void SAL_CALL
435 throw( com::sun::star::sdbc::SQLException
,
436 com::sun::star::uno::RuntimeException
);
438 virtual sal_Bool SAL_CALL
441 throw( com::sun::star::sdbc::SQLException
,
442 com::sun::star::uno::RuntimeException
);
444 virtual sal_Bool SAL_CALL
447 throw( com::sun::star::sdbc::SQLException
,
448 com::sun::star::uno::RuntimeException
);
450 virtual sal_Bool SAL_CALL
453 throw( com::sun::star::sdbc::SQLException
,
454 com::sun::star::uno::RuntimeException
);
457 virtual com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
460 throw( com::sun::star::sdbc::SQLException
,
461 com::sun::star::uno::RuntimeException
);
465 virtual void SAL_CALL
468 throw( com::sun::star::sdbc::SQLException
,
469 com::sun::star::uno::RuntimeException
);
473 virtual rtl::OUString SAL_CALL
474 queryContentIdentifierString(
476 throw( com::sun::star::uno::RuntimeException
);
478 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> SAL_CALL
479 queryContentIdentifier(
481 throw( com::sun::star::uno::RuntimeException
);
483 virtual com::sun::star::uno::Reference
< com::sun::star::ucb::XContent
> SAL_CALL
486 throw( com::sun::star::uno::RuntimeException
);
488 // XResultSetMetaDataSupplier
489 virtual com::sun::star::uno::Reference
< com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
492 throw( com::sun::star::sdbc::SQLException
,
493 com::sun::star::uno::RuntimeException
);
497 virtual com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySetInfo
> SAL_CALL
499 throw( com::sun::star::uno::RuntimeException
);
501 virtual void SAL_CALL
setPropertyValue(
502 const rtl::OUString
& aPropertyName
,
503 const com::sun::star::uno::Any
& aValue
)
504 throw( com::sun::star::beans::UnknownPropertyException
,
505 com::sun::star::beans::PropertyVetoException
,
506 com::sun::star::lang::IllegalArgumentException
,
507 com::sun::star::lang::WrappedTargetException
,
508 com::sun::star::uno::RuntimeException
);
510 virtual com::sun::star::uno::Any SAL_CALL
512 const rtl::OUString
& PropertyName
)
513 throw( com::sun::star::beans::UnknownPropertyException
,
514 com::sun::star::lang::WrappedTargetException
,
515 com::sun::star::uno::RuntimeException
);
517 virtual void SAL_CALL
518 addPropertyChangeListener(
519 const rtl::OUString
& aPropertyName
,
520 const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertyChangeListener
>& xListener
)
521 throw( com::sun::star::beans::UnknownPropertyException
,
522 com::sun::star::lang::WrappedTargetException
,
523 com::sun::star::uno::RuntimeException
);
525 virtual void SAL_CALL
526 removePropertyChangeListener(
527 const rtl::OUString
& aPropertyName
,
528 const com::sun::star::uno::Reference
< com::sun::star::beans::XPropertyChangeListener
>& aListener
)
529 throw( com::sun::star::beans::UnknownPropertyException
,
530 com::sun::star::lang::WrappedTargetException
,
531 com::sun::star::uno::RuntimeException
);
533 virtual void SAL_CALL
534 addVetoableChangeListener(
535 const rtl::OUString
& PropertyName
,
536 const com::sun::star::uno::Reference
< com::sun::star::beans::XVetoableChangeListener
>& aListener
)
537 throw( com::sun::star::beans::UnknownPropertyException
,
538 com::sun::star::lang::WrappedTargetException
,
539 com::sun::star::uno::RuntimeException
);
541 virtual void SAL_CALL
removeVetoableChangeListener(
542 const rtl::OUString
& PropertyName
,
543 const com::sun::star::uno::Reference
< com::sun::star::beans::XVetoableChangeListener
>& aListener
)
544 throw( com::sun::star::beans::UnknownPropertyException
,
545 com::sun::star::lang::WrappedTargetException
,
546 com::sun::star::uno::RuntimeException
);
550 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> m_xMSF
;
551 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
> m_xProvider
;
554 sal_Int32 m_nOpenMode
;
555 sal_Bool m_bRowCountFinal
;
557 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::ucb::XContentIdentifier
> > IdentSet
;
558 typedef std::vector
< com::sun::star::uno::Reference
< com::sun::star::sdbc::XRow
> > ItemSet
;
559 typedef std::vector
< rtl::OUString
> PathSet
;
565 com::sun::star::uno::Sequence
< com::sun::star::beans::Property
> m_sProperty
;
566 com::sun::star::uno::Sequence
< com::sun::star::ucb::NumberedSortingInfo
> m_sSortingInfo
;
569 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
571 cppu::OInterfaceContainerHelper
* m_pRowCountListeners
;
572 cppu::OInterfaceContainerHelper
* m_pIsFinalListeners
;
576 } // end namespace fileaccess