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: ftpresultsetbase.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 _FTP_FTPRESULTSETBASE_HXX_
31 #define _FTP_FTPRESULTSETBASE_HXX_
34 #include <cppuhelper/weak.hxx>
35 #include <cppuhelper/interfacecontainer.hxx>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/ucb/XContentAccess.hpp>
38 #include <com/sun/star/sdbc/XCloseable.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/sdbc/XResultSet.hpp>
41 #include <com/sun/star/sdbc/XRow.hpp>
42 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
43 #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
44 #include <com/sun/star/ucb/XContentProvider.hpp>
45 #include <com/sun/star/ucb/XContentIdentifier.hpp>
46 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47 #include <com/sun/star/beans/Property.hpp>
53 : public cppu::OWeakObject
,
54 public com::sun::star::lang::XComponent
,
55 public com::sun::star::sdbc::XRow
,
56 public com::sun::star::sdbc::XResultSet
,
57 public com::sun::star::sdbc::XCloseable
,
58 public com::sun::star::sdbc::XResultSetMetaDataSupplier
,
59 public com::sun::star::beans::XPropertySet
,
60 public com::sun::star::ucb::XContentAccess
64 ResultSetBase(const com::sun::star::uno::Reference
<
65 com::sun::star::lang::XMultiServiceFactory
>& xMSF
,
66 const com::sun::star::uno::Reference
<
67 com::sun::star::ucb::XContentProvider
>& xProvider
,
69 const com::sun::star::uno::Sequence
<
70 com::sun::star::beans::Property
>& seq
,
71 const com::sun::star::uno::Sequence
<
72 com::sun::star::ucb::NumberedSortingInfo
>& seqSort
);
74 virtual ~ResultSetBase();
77 virtual com::sun::star::uno::Any SAL_CALL
79 const com::sun::star::uno::Type
& aType
)
80 throw( com::sun::star::uno::RuntimeException
);
96 throw( com::sun::star::uno::RuntimeException
);
100 const com::sun::star::uno::Reference
<
101 com::sun::star::lang::XEventListener
>& xListener
)
102 throw( com::sun::star::uno::RuntimeException
);
104 virtual void SAL_CALL
105 removeEventListener( const com::sun::star::uno::Reference
<
106 com::sun::star::lang::XEventListener
>& aListener
)
107 throw( com::sun::star::uno::RuntimeException
);
111 virtual sal_Bool SAL_CALL
114 throw( com::sun::star::sdbc::SQLException
,
115 com::sun::star::uno::RuntimeException
)
117 if( 0<= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
118 m_nWasNull
= m_aItems
[m_nRow
]->wasNull();
124 virtual rtl::OUString SAL_CALL
126 sal_Int32 columnIndex
)
127 throw( com::sun::star::sdbc::SQLException
,
128 com::sun::star::uno::RuntimeException
)
131 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
132 ret
= m_aItems
[m_nRow
]->getString( columnIndex
);
137 virtual sal_Bool SAL_CALL
139 sal_Int32 columnIndex
)
140 throw( com::sun::star::sdbc::SQLException
,
141 com::sun::star::uno::RuntimeException
)
143 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
144 return m_aItems
[m_nRow
]->getBoolean( columnIndex
);
149 virtual sal_Int8 SAL_CALL
151 sal_Int32 columnIndex
)
152 throw( com::sun::star::sdbc::SQLException
,
153 com::sun::star::uno::RuntimeException
)
155 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
156 return m_aItems
[m_nRow
]->getByte( columnIndex
);
158 return sal_Int8( 0 );
161 virtual sal_Int16 SAL_CALL
163 sal_Int32 columnIndex
)
165 com::sun::star::sdbc::SQLException
,
166 com::sun::star::uno::RuntimeException
)
168 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
169 return m_aItems
[m_nRow
]->getShort( columnIndex
);
171 return sal_Int16( 0 );
174 virtual sal_Int32 SAL_CALL
176 sal_Int32 columnIndex
)
177 throw( com::sun::star::sdbc::SQLException
,
178 com::sun::star::uno::RuntimeException
)
180 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
181 return m_aItems
[m_nRow
]->getInt( columnIndex
);
183 return sal_Int32( 0 );
186 virtual sal_Int64 SAL_CALL
188 sal_Int32 columnIndex
)
189 throw( com::sun::star::sdbc::SQLException
,
190 com::sun::star::uno::RuntimeException
)
192 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
193 return m_aItems
[m_nRow
]->getLong( columnIndex
);
195 return sal_Int64( 0 );
198 virtual float SAL_CALL
200 sal_Int32 columnIndex
)
201 throw( com::sun::star::sdbc::SQLException
,
202 com::sun::star::uno::RuntimeException
)
204 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
205 return m_aItems
[m_nRow
]->getFloat( columnIndex
);
210 virtual double SAL_CALL
212 sal_Int32 columnIndex
)
213 throw( com::sun::star::sdbc::SQLException
,
214 com::sun::star::uno::RuntimeException
)
216 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
217 return m_aItems
[m_nRow
]->getDouble( columnIndex
);
222 virtual com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
224 sal_Int32 columnIndex
)
225 throw( com::sun::star::sdbc::SQLException
,
226 com::sun::star::uno::RuntimeException
)
228 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
229 return m_aItems
[m_nRow
]->getBytes( columnIndex
);
231 return com::sun::star::uno::Sequence
< sal_Int8
>();
234 virtual com::sun::star::util::Date SAL_CALL
236 sal_Int32 columnIndex
)
237 throw( com::sun::star::sdbc::SQLException
,
238 com::sun::star::uno::RuntimeException
)
240 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
241 return m_aItems
[m_nRow
]->getDate( columnIndex
);
243 return com::sun::star::util::Date();
246 virtual com::sun::star::util::Time SAL_CALL
248 sal_Int32 columnIndex
)
249 throw( com::sun::star::sdbc::SQLException
,
250 com::sun::star::uno::RuntimeException
)
252 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
253 return m_aItems
[m_nRow
]->getTime( columnIndex
);
255 return com::sun::star::util::Time();
258 virtual com::sun::star::util::DateTime SAL_CALL
260 sal_Int32 columnIndex
)
261 throw( com::sun::star::sdbc::SQLException
,
262 com::sun::star::uno::RuntimeException
)
264 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
265 return m_aItems
[m_nRow
]->getTimestamp( columnIndex
);
267 return com::sun::star::util::DateTime();
271 virtual com::sun::star::uno::Reference
<
272 com::sun::star::io::XInputStream
> SAL_CALL
274 sal_Int32 columnIndex
)
275 throw( com::sun::star::sdbc::SQLException
,
276 com::sun::star::uno::RuntimeException
)
278 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
279 return m_aItems
[m_nRow
]->getBinaryStream( columnIndex
);
281 return com::sun::star::uno::Reference
<
282 com::sun::star::io::XInputStream
>();
285 virtual com::sun::star::uno::Reference
<
286 com::sun::star::io::XInputStream
> SAL_CALL
288 sal_Int32 columnIndex
)
289 throw( com::sun::star::sdbc::SQLException
,
290 com::sun::star::uno::RuntimeException
)
292 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
293 return m_aItems
[m_nRow
]->getCharacterStream( columnIndex
);
295 return com::sun::star::uno::Reference
<
296 com::sun::star::io::XInputStream
>();
299 virtual com::sun::star::uno::Any SAL_CALL
301 sal_Int32 columnIndex
,
302 const com::sun::star::uno::Reference
<
303 com::sun::star::container::XNameAccess
>& typeMap
)
304 throw( com::sun::star::sdbc::SQLException
,
305 com::sun::star::uno::RuntimeException
)
307 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
308 return m_aItems
[m_nRow
]->getObject( columnIndex
,typeMap
);
310 return com::sun::star::uno::Any();
313 virtual com::sun::star::uno::Reference
<
314 com::sun::star::sdbc::XRef
> SAL_CALL
316 sal_Int32 columnIndex
)
317 throw( com::sun::star::sdbc::SQLException
,
318 com::sun::star::uno::RuntimeException
)
320 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
321 return m_aItems
[m_nRow
]->getRef( columnIndex
);
323 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XRef
>();
326 virtual com::sun::star::uno::Reference
<
327 com::sun::star::sdbc::XBlob
> SAL_CALL
329 sal_Int32 columnIndex
)
330 throw( com::sun::star::sdbc::SQLException
,
331 com::sun::star::uno::RuntimeException
)
333 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
334 return m_aItems
[m_nRow
]->getBlob( columnIndex
);
336 return com::sun::star::uno::Reference
< com::sun::star::sdbc::XBlob
>();
339 virtual com::sun::star::uno::Reference
<
340 com::sun::star::sdbc::XClob
> SAL_CALL
342 sal_Int32 columnIndex
)
343 throw( com::sun::star::sdbc::SQLException
,
344 com::sun::star::uno::RuntimeException
)
346 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
347 return m_aItems
[m_nRow
]->getClob( columnIndex
);
349 return com::sun::star::uno::Reference
<
350 com::sun::star::sdbc::XClob
>();
353 virtual com::sun::star::uno::Reference
<
354 com::sun::star::sdbc::XArray
> SAL_CALL
356 sal_Int32 columnIndex
)
357 throw( com::sun::star::sdbc::SQLException
,
358 com::sun::star::uno::RuntimeException
)
360 if( 0 <= m_nRow
&& m_nRow
< sal::static_int_cast
<sal_Int32
>(m_aItems
.size()) )
361 return m_aItems
[m_nRow
]->getArray( columnIndex
);
363 return com::sun::star::uno::Reference
<
364 com::sun::star::sdbc::XArray
>();
370 virtual sal_Bool SAL_CALL
373 throw( com::sun::star::sdbc::SQLException
,
374 com::sun::star::uno::RuntimeException
);
376 virtual sal_Bool SAL_CALL
379 throw( com::sun::star::sdbc::SQLException
,
380 com::sun::star::uno::RuntimeException
);
382 virtual sal_Bool SAL_CALL
385 throw( com::sun::star::sdbc::SQLException
,
386 com::sun::star::uno::RuntimeException
);
388 virtual sal_Bool SAL_CALL
391 throw( com::sun::star::sdbc::SQLException
,
392 com::sun::star::uno::RuntimeException
);
394 virtual sal_Bool SAL_CALL
397 throw( com::sun::star::sdbc::SQLException
,
398 com::sun::star::uno::RuntimeException
);
400 virtual void SAL_CALL
403 throw( com::sun::star::sdbc::SQLException
,
404 com::sun::star::uno::RuntimeException
);
406 virtual void SAL_CALL
409 throw( com::sun::star::sdbc::SQLException
,
410 com::sun::star::uno::RuntimeException
);
412 virtual sal_Bool SAL_CALL
415 throw( com::sun::star::sdbc::SQLException
,
416 com::sun::star::uno::RuntimeException
);
418 virtual sal_Bool SAL_CALL
421 throw( com::sun::star::sdbc::SQLException
,
422 com::sun::star::uno::RuntimeException
);
424 virtual sal_Int32 SAL_CALL
427 throw( com::sun::star::sdbc::SQLException
,
428 com::sun::star::uno::RuntimeException
);
430 virtual sal_Bool SAL_CALL
433 throw( com::sun::star::sdbc::SQLException
,
434 com::sun::star::uno::RuntimeException
);
436 virtual sal_Bool SAL_CALL
439 throw( com::sun::star::sdbc::SQLException
,
440 com::sun::star::uno::RuntimeException
);
442 virtual sal_Bool SAL_CALL
445 throw( com::sun::star::sdbc::SQLException
,
446 com::sun::star::uno::RuntimeException
);
448 virtual void SAL_CALL
451 throw( com::sun::star::sdbc::SQLException
,
452 com::sun::star::uno::RuntimeException
);
454 virtual sal_Bool SAL_CALL
457 throw( com::sun::star::sdbc::SQLException
,
458 com::sun::star::uno::RuntimeException
);
460 virtual sal_Bool SAL_CALL
463 throw( com::sun::star::sdbc::SQLException
,
464 com::sun::star::uno::RuntimeException
);
466 virtual sal_Bool SAL_CALL
469 throw( com::sun::star::sdbc::SQLException
,
470 com::sun::star::uno::RuntimeException
);
473 virtual com::sun::star::uno::Reference
<
474 com::sun::star::uno::XInterface
> SAL_CALL
477 throw( com::sun::star::sdbc::SQLException
,
478 com::sun::star::uno::RuntimeException
);
482 virtual void SAL_CALL
485 throw( com::sun::star::sdbc::SQLException
,
486 com::sun::star::uno::RuntimeException
);
490 virtual rtl::OUString SAL_CALL
491 queryContentIdentifierString(
493 throw( com::sun::star::uno::RuntimeException
);
495 virtual com::sun::star::uno::Reference
<
496 com::sun::star::ucb::XContentIdentifier
> SAL_CALL
497 queryContentIdentifier(
499 throw( com::sun::star::uno::RuntimeException
);
501 virtual com::sun::star::uno::Reference
<
502 com::sun::star::ucb::XContent
> SAL_CALL
505 throw( com::sun::star::uno::RuntimeException
);
507 // XResultSetMetaDataSupplier
508 virtual com::sun::star::uno::Reference
<
509 com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
512 throw( com::sun::star::sdbc::SQLException
,
513 com::sun::star::uno::RuntimeException
);
517 virtual com::sun::star::uno::Reference
<
518 com::sun::star::beans::XPropertySetInfo
> SAL_CALL
520 throw( com::sun::star::uno::RuntimeException
);
522 virtual void SAL_CALL
setPropertyValue(
523 const rtl::OUString
& aPropertyName
,
524 const com::sun::star::uno::Any
& aValue
)
525 throw( com::sun::star::beans::UnknownPropertyException
,
526 com::sun::star::beans::PropertyVetoException
,
527 com::sun::star::lang::IllegalArgumentException
,
528 com::sun::star::lang::WrappedTargetException
,
529 com::sun::star::uno::RuntimeException
);
531 virtual com::sun::star::uno::Any SAL_CALL
533 const rtl::OUString
& PropertyName
)
534 throw( com::sun::star::beans::UnknownPropertyException
,
535 com::sun::star::lang::WrappedTargetException
,
536 com::sun::star::uno::RuntimeException
);
538 virtual void SAL_CALL
539 addPropertyChangeListener(
540 const rtl::OUString
& aPropertyName
,
541 const com::sun::star::uno::Reference
<
542 com::sun::star::beans::XPropertyChangeListener
>& xListener
)
543 throw( com::sun::star::beans::UnknownPropertyException
,
544 com::sun::star::lang::WrappedTargetException
,
545 com::sun::star::uno::RuntimeException
);
547 virtual void SAL_CALL
548 removePropertyChangeListener(
549 const rtl::OUString
& aPropertyName
,
550 const com::sun::star::uno::Reference
<
551 com::sun::star::beans::XPropertyChangeListener
>& aListener
)
552 throw( com::sun::star::beans::UnknownPropertyException
,
553 com::sun::star::lang::WrappedTargetException
,
554 com::sun::star::uno::RuntimeException
);
556 virtual void SAL_CALL
557 addVetoableChangeListener(
558 const rtl::OUString
& PropertyName
,
559 const com::sun::star::uno::Reference
<
560 com::sun::star::beans::XVetoableChangeListener
>& aListener
)
561 throw( com::sun::star::beans::UnknownPropertyException
,
562 com::sun::star::lang::WrappedTargetException
,
563 com::sun::star::uno::RuntimeException
);
565 virtual void SAL_CALL
removeVetoableChangeListener(
566 const rtl::OUString
& PropertyName
,
567 const com::sun::star::uno::Reference
<
568 com::sun::star::beans::XVetoableChangeListener
>& aListener
)
569 throw( com::sun::star::beans::UnknownPropertyException
,
570 com::sun::star::lang::WrappedTargetException
,
571 com::sun::star::uno::RuntimeException
);
575 com::sun::star::uno::Reference
<
576 com::sun::star::lang::XMultiServiceFactory
> m_xMSF
;
577 com::sun::star::uno::Reference
<
578 com::sun::star::ucb::XContentProvider
> m_xProvider
;
581 sal_Int32 m_nOpenMode
;
582 sal_Bool m_bRowCountFinal
;
584 typedef std::vector
< com::sun::star::uno::Reference
<
585 com::sun::star::ucb::XContentIdentifier
> > IdentSet
;
586 typedef std::vector
< com::sun::star::uno::Reference
<
587 com::sun::star::sdbc::XRow
> > ItemSet
;
588 typedef std::vector
< rtl::OUString
>
595 com::sun::star::uno::Sequence
<
596 com::sun::star::beans::Property
> m_sProperty
;
597 com::sun::star::uno::Sequence
<
598 com::sun::star::ucb::NumberedSortingInfo
> m_sSortingInfo
;
601 cppu::OInterfaceContainerHelper
* m_pDisposeEventListeners
;
603 cppu::OInterfaceContainerHelper
* m_pRowCountListeners
;
604 cppu::OInterfaceContainerHelper
* m_pIsFinalListeners
;
608 } // end namespace fileaccess