xref: /AOO41X/main/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmlhelp.hxx"
30*cdf0e10cSrcweir #include <ucbhelper/contentidentifier.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/ucb/OpenMode.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
34*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir #include <com/sun/star/ucb/ListActionType.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/ucb/XSourceInitialization.hpp>
38*cdf0e10cSrcweir #include <ucbhelper/resultsetmetadata.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include "resultsetbase.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir using namespace chelp;
43*cdf0e10cSrcweir using namespace com::sun::star;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir ResultSetBase::ResultSetBase( const uno::Reference< lang::XMultiServiceFactory >&  xMSF,
46*cdf0e10cSrcweir 							  const uno::Reference< ucb::XContentProvider >&  xProvider,
47*cdf0e10cSrcweir 							  sal_Int32 nOpenMode,
48*cdf0e10cSrcweir 							  const uno::Sequence< beans::Property >& seq,
49*cdf0e10cSrcweir 							  const uno::Sequence< ucb::NumberedSortingInfo >& seqSort )
50*cdf0e10cSrcweir 	: m_xMSF( xMSF ),
51*cdf0e10cSrcweir 	  m_xProvider( xProvider ),
52*cdf0e10cSrcweir 	  m_nRow( -1 ),
53*cdf0e10cSrcweir 	  m_nWasNull( true ),
54*cdf0e10cSrcweir 	  m_nOpenMode( nOpenMode ),
55*cdf0e10cSrcweir 	  m_bRowCountFinal( true ),
56*cdf0e10cSrcweir 	  m_sProperty( seq ),
57*cdf0e10cSrcweir 	  m_sSortingInfo( seqSort ),
58*cdf0e10cSrcweir 	  m_pDisposeEventListeners( 0 ),
59*cdf0e10cSrcweir 	  m_pRowCountListeners( 0 ),
60*cdf0e10cSrcweir 	  m_pIsFinalListeners( 0 )
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir }
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir ResultSetBase::~ResultSetBase()
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir 	delete m_pIsFinalListeners;
67*cdf0e10cSrcweir 	delete m_pRowCountListeners;
68*cdf0e10cSrcweir 	delete m_pDisposeEventListeners;
69*cdf0e10cSrcweir }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir // XInterface
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir void SAL_CALL
75*cdf0e10cSrcweir ResultSetBase::acquire(
76*cdf0e10cSrcweir 	void )
77*cdf0e10cSrcweir 	throw()
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir 	OWeakObject::acquire();
80*cdf0e10cSrcweir }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir void SAL_CALL
84*cdf0e10cSrcweir ResultSetBase::release(
85*cdf0e10cSrcweir 	void )
86*cdf0e10cSrcweir 	throw()
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir 	OWeakObject::release();
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir uno::Any SAL_CALL
94*cdf0e10cSrcweir ResultSetBase::queryInterface(
95*cdf0e10cSrcweir 	const uno::Type& rType )
96*cdf0e10cSrcweir 	throw( uno::RuntimeException )
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir 	uno::Any aRet = cppu::queryInterface( rType,
99*cdf0e10cSrcweir 										  SAL_STATIC_CAST( lang::XComponent*, this),
100*cdf0e10cSrcweir 										  SAL_STATIC_CAST( sdbc::XRow*, this),
101*cdf0e10cSrcweir 										  SAL_STATIC_CAST( sdbc::XResultSet*, this),
102*cdf0e10cSrcweir 										  SAL_STATIC_CAST( sdbc::XResultSetMetaDataSupplier*, this),
103*cdf0e10cSrcweir 										  SAL_STATIC_CAST( beans::XPropertySet*, this ),
104*cdf0e10cSrcweir 										  SAL_STATIC_CAST( ucb::XContentAccess*, this) );
105*cdf0e10cSrcweir 	return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir // XComponent
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir void SAL_CALL
114*cdf0e10cSrcweir ResultSetBase::addEventListener(
115*cdf0e10cSrcweir 	const uno::Reference< lang::XEventListener >& Listener )
116*cdf0e10cSrcweir 	throw( uno::RuntimeException )
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	if ( ! m_pDisposeEventListeners )
121*cdf0e10cSrcweir 		m_pDisposeEventListeners =
122*cdf0e10cSrcweir 			new cppu::OInterfaceContainerHelper( m_aMutex );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	m_pDisposeEventListeners->addInterface( Listener );
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir void SAL_CALL
129*cdf0e10cSrcweir ResultSetBase::removeEventListener(
130*cdf0e10cSrcweir 	const uno::Reference< lang::XEventListener >& Listener )
131*cdf0e10cSrcweir 	throw( uno::RuntimeException )
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	if ( m_pDisposeEventListeners )
136*cdf0e10cSrcweir 		m_pDisposeEventListeners->removeInterface( Listener );
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir void SAL_CALL
142*cdf0e10cSrcweir ResultSetBase::dispose()
143*cdf0e10cSrcweir 	throw( uno::RuntimeException )
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_aMutex );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 	lang::EventObject aEvt;
148*cdf0e10cSrcweir 	aEvt.Source = static_cast< lang::XComponent * >( this );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
151*cdf0e10cSrcweir 	{
152*cdf0e10cSrcweir 		m_pDisposeEventListeners->disposeAndClear( aEvt );
153*cdf0e10cSrcweir 	}
154*cdf0e10cSrcweir 	if( m_pRowCountListeners && m_pRowCountListeners->getLength() )
155*cdf0e10cSrcweir 	{
156*cdf0e10cSrcweir 		m_pRowCountListeners->disposeAndClear( aEvt );
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 	if( m_pIsFinalListeners && m_pIsFinalListeners->getLength() )
159*cdf0e10cSrcweir 	{
160*cdf0e10cSrcweir 		m_pIsFinalListeners->disposeAndClear( aEvt );
161*cdf0e10cSrcweir 	}
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir //  XResultSet
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir sal_Bool SAL_CALL
169*cdf0e10cSrcweir ResultSetBase::next(
170*cdf0e10cSrcweir 	void )
171*cdf0e10cSrcweir 	throw( sdbc::SQLException,
172*cdf0e10cSrcweir 		   uno::RuntimeException )
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir 	sal_Bool test;
175*cdf0e10cSrcweir 	m_nRow++;
176*cdf0e10cSrcweir 	if( sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size() )
177*cdf0e10cSrcweir 		test = true;
178*cdf0e10cSrcweir 	else
179*cdf0e10cSrcweir 		test = false;
180*cdf0e10cSrcweir 	return test;
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir sal_Bool SAL_CALL
185*cdf0e10cSrcweir ResultSetBase::isBeforeFirst(
186*cdf0e10cSrcweir 	void )
187*cdf0e10cSrcweir 	throw( sdbc::SQLException,
188*cdf0e10cSrcweir 		   uno::RuntimeException )
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir 	return m_nRow == -1;
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir sal_Bool SAL_CALL
195*cdf0e10cSrcweir ResultSetBase::isAfterLast(
196*cdf0e10cSrcweir 	void )
197*cdf0e10cSrcweir 	throw( sdbc::SQLException,
198*cdf0e10cSrcweir 		   uno::RuntimeException )
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir 	return sal::static_int_cast<sal_uInt32>( m_nRow ) >= m_aItems.size();   // Cannot happen, if m_aFolder.isOpen()
201*cdf0e10cSrcweir }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir sal_Bool SAL_CALL
205*cdf0e10cSrcweir ResultSetBase::isFirst(
206*cdf0e10cSrcweir 	void )
207*cdf0e10cSrcweir 	throw( sdbc::SQLException,
208*cdf0e10cSrcweir 		   uno::RuntimeException )
209*cdf0e10cSrcweir {
210*cdf0e10cSrcweir 	return m_nRow == 0;
211*cdf0e10cSrcweir }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir sal_Bool SAL_CALL
215*cdf0e10cSrcweir ResultSetBase::isLast(
216*cdf0e10cSrcweir 	void  )
217*cdf0e10cSrcweir 	throw( sdbc::SQLException,
218*cdf0e10cSrcweir 		   uno::RuntimeException)
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir 	if( sal::static_int_cast<sal_uInt32>( m_nRow ) ==  m_aItems.size() - 1 )
221*cdf0e10cSrcweir 		return true;
222*cdf0e10cSrcweir 	else
223*cdf0e10cSrcweir 		return false;
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir void SAL_CALL
228*cdf0e10cSrcweir ResultSetBase::beforeFirst(
229*cdf0e10cSrcweir 	void  )
230*cdf0e10cSrcweir 	throw( sdbc::SQLException,
231*cdf0e10cSrcweir 		   uno::RuntimeException)
232*cdf0e10cSrcweir {
233*cdf0e10cSrcweir 	m_nRow = -1;
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir void SAL_CALL
238*cdf0e10cSrcweir ResultSetBase::afterLast(
239*cdf0e10cSrcweir 	void  )
240*cdf0e10cSrcweir 	throw( sdbc::SQLException,
241*cdf0e10cSrcweir 		   uno::RuntimeException )
242*cdf0e10cSrcweir {
243*cdf0e10cSrcweir 	m_nRow = m_aItems.size();
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir sal_Bool SAL_CALL
248*cdf0e10cSrcweir ResultSetBase::first(
249*cdf0e10cSrcweir 	void  )
250*cdf0e10cSrcweir 	throw( sdbc::SQLException,
251*cdf0e10cSrcweir 		   uno::RuntimeException)
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir 	m_nRow = -1;
254*cdf0e10cSrcweir 	return next();
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir sal_Bool SAL_CALL
259*cdf0e10cSrcweir ResultSetBase::last(
260*cdf0e10cSrcweir 	void  )
261*cdf0e10cSrcweir 	throw( sdbc::SQLException,
262*cdf0e10cSrcweir 		   uno::RuntimeException )
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir 	m_nRow = m_aItems.size() - 1;
265*cdf0e10cSrcweir 	return true;
266*cdf0e10cSrcweir }
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir sal_Int32 SAL_CALL
270*cdf0e10cSrcweir ResultSetBase::getRow(
271*cdf0e10cSrcweir 	void )
272*cdf0e10cSrcweir 	throw( sdbc::SQLException,
273*cdf0e10cSrcweir 		   uno::RuntimeException)
274*cdf0e10cSrcweir {
275*cdf0e10cSrcweir 	// Test, whether behind last row
276*cdf0e10cSrcweir 	if( -1 == m_nRow || sal::static_int_cast<sal_uInt32>( m_nRow ) >= m_aItems.size() )
277*cdf0e10cSrcweir 		return 0;
278*cdf0e10cSrcweir 	else
279*cdf0e10cSrcweir 		return m_nRow+1;
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSetBase::absolute( sal_Int32 row )
284*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException)
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir 	if( row >= 0 )
287*cdf0e10cSrcweir 		m_nRow = row - 1;
288*cdf0e10cSrcweir 	else
289*cdf0e10cSrcweir 	{
290*cdf0e10cSrcweir 		last();
291*cdf0e10cSrcweir 		m_nRow += ( row + 1 );
292*cdf0e10cSrcweir 		if( m_nRow < -1 )
293*cdf0e10cSrcweir 			m_nRow = -1;
294*cdf0e10cSrcweir 	}
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	return 0<= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size();
297*cdf0e10cSrcweir }
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir sal_Bool SAL_CALL
303*cdf0e10cSrcweir ResultSetBase::relative(
304*cdf0e10cSrcweir 	sal_Int32 row )
305*cdf0e10cSrcweir 	throw( sdbc::SQLException,
306*cdf0e10cSrcweir 		   uno::RuntimeException)
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir 	if( isAfterLast() || isBeforeFirst() )
309*cdf0e10cSrcweir 		throw sdbc::SQLException();
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 	if( row > 0 )
312*cdf0e10cSrcweir 		while( row-- )
313*cdf0e10cSrcweir 			next();
314*cdf0e10cSrcweir 	else if( row < 0 )
315*cdf0e10cSrcweir 		while( row++ && m_nRow > -1 )
316*cdf0e10cSrcweir 			previous();
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	return 0 <= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size();
319*cdf0e10cSrcweir }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir sal_Bool SAL_CALL
324*cdf0e10cSrcweir ResultSetBase::previous(
325*cdf0e10cSrcweir 	void )
326*cdf0e10cSrcweir 	throw( sdbc::SQLException,
327*cdf0e10cSrcweir 		   uno::RuntimeException)
328*cdf0e10cSrcweir {
329*cdf0e10cSrcweir 	if( sal::static_int_cast<sal_uInt32>( m_nRow ) > m_aItems.size() )
330*cdf0e10cSrcweir 		m_nRow = m_aItems.size();  // Correct Handling of afterLast
331*cdf0e10cSrcweir 	if( 0 <= m_nRow ) -- m_nRow;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 	return 0 <= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size();
334*cdf0e10cSrcweir }
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir void SAL_CALL
338*cdf0e10cSrcweir ResultSetBase::refreshRow(
339*cdf0e10cSrcweir 	void )
340*cdf0e10cSrcweir 	throw( sdbc::SQLException,
341*cdf0e10cSrcweir 		   uno::RuntimeException)
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir sal_Bool SAL_CALL
347*cdf0e10cSrcweir ResultSetBase::rowUpdated(
348*cdf0e10cSrcweir 	void )
349*cdf0e10cSrcweir 	throw( sdbc::SQLException,
350*cdf0e10cSrcweir 		   uno::RuntimeException )
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir 	return false;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir sal_Bool SAL_CALL
356*cdf0e10cSrcweir ResultSetBase::rowInserted(
357*cdf0e10cSrcweir 	void  )
358*cdf0e10cSrcweir 	throw( sdbc::SQLException,
359*cdf0e10cSrcweir 		   uno::RuntimeException )
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir 	return false;
362*cdf0e10cSrcweir }
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir sal_Bool SAL_CALL
365*cdf0e10cSrcweir ResultSetBase::rowDeleted(
366*cdf0e10cSrcweir 	void  )
367*cdf0e10cSrcweir 	throw( sdbc::SQLException,
368*cdf0e10cSrcweir 		   uno::RuntimeException )
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir 	return false;
371*cdf0e10cSrcweir }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL
375*cdf0e10cSrcweir ResultSetBase::getStatement(
376*cdf0e10cSrcweir 	void  )
377*cdf0e10cSrcweir 	throw( sdbc::SQLException,
378*cdf0e10cSrcweir 		   uno::RuntimeException )
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir 	uno::Reference< uno::XInterface > test( 0 );
381*cdf0e10cSrcweir 	return test;
382*cdf0e10cSrcweir }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir // XCloseable
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir void SAL_CALL
388*cdf0e10cSrcweir ResultSetBase::close(
389*cdf0e10cSrcweir 	void )
390*cdf0e10cSrcweir 	throw( sdbc::SQLException,
391*cdf0e10cSrcweir 		   uno::RuntimeException)
392*cdf0e10cSrcweir {
393*cdf0e10cSrcweir }
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir rtl::OUString SAL_CALL
397*cdf0e10cSrcweir ResultSetBase::queryContentIdentifierString(
398*cdf0e10cSrcweir 	void )
399*cdf0e10cSrcweir 	throw( uno::RuntimeException )
400*cdf0e10cSrcweir {
401*cdf0e10cSrcweir 	if( 0 <= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size() )
402*cdf0e10cSrcweir 		return m_aPath[m_nRow];
403*cdf0e10cSrcweir 	else
404*cdf0e10cSrcweir 		return rtl::OUString();
405*cdf0e10cSrcweir }
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir uno::Reference< ucb::XContentIdentifier > SAL_CALL
409*cdf0e10cSrcweir ResultSetBase::queryContentIdentifier(
410*cdf0e10cSrcweir 	void )
411*cdf0e10cSrcweir 	throw( uno::RuntimeException )
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir 	if( 0 <= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size() )
414*cdf0e10cSrcweir 	{
415*cdf0e10cSrcweir 		rtl::OUString url = queryContentIdentifierString();
416*cdf0e10cSrcweir 		if( ! m_aIdents[m_nRow].is() && url.getLength() )
417*cdf0e10cSrcweir 			m_aIdents[m_nRow] = uno::Reference< ucb::XContentIdentifier >(
418*cdf0e10cSrcweir                 new ::ucbhelper::ContentIdentifier( m_xMSF,url ) );
419*cdf0e10cSrcweir 		return m_aIdents[m_nRow];
420*cdf0e10cSrcweir 	}
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 	return uno::Reference< ucb::XContentIdentifier >();
423*cdf0e10cSrcweir }
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir uno::Reference< ucb::XContent > SAL_CALL
427*cdf0e10cSrcweir ResultSetBase::queryContent(
428*cdf0e10cSrcweir 	void )
429*cdf0e10cSrcweir 	throw( uno::RuntimeException )
430*cdf0e10cSrcweir {
431*cdf0e10cSrcweir 	if( 0 <= m_nRow && sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size() )
432*cdf0e10cSrcweir 		return m_xProvider->queryContent( queryContentIdentifier() );
433*cdf0e10cSrcweir 	else
434*cdf0e10cSrcweir 		return uno::Reference< ucb::XContent >();
435*cdf0e10cSrcweir }
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir class XPropertySetInfoImpl
440*cdf0e10cSrcweir     : public cppu::OWeakObject,
441*cdf0e10cSrcweir       public beans::XPropertySetInfo
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir public:
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir     XPropertySetInfoImpl( const uno::Sequence< beans::Property >& aSeq )
446*cdf0e10cSrcweir         : m_aSeq( aSeq )
447*cdf0e10cSrcweir     {
448*cdf0e10cSrcweir     }
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir     void SAL_CALL acquire( void )
451*cdf0e10cSrcweir         throw()
452*cdf0e10cSrcweir     {
453*cdf0e10cSrcweir         OWeakObject::acquire();
454*cdf0e10cSrcweir     }
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir     void SAL_CALL release( void )
458*cdf0e10cSrcweir         throw()
459*cdf0e10cSrcweir     {
460*cdf0e10cSrcweir         OWeakObject::release();
461*cdf0e10cSrcweir     }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir     uno::Any SAL_CALL queryInterface( const uno::Type& rType )
464*cdf0e10cSrcweir         throw( uno::RuntimeException )
465*cdf0e10cSrcweir     {
466*cdf0e10cSrcweir         uno::Any aRet = cppu::queryInterface( rType,
467*cdf0e10cSrcweir                                               SAL_STATIC_CAST( beans::XPropertySetInfo*, this ) );
468*cdf0e10cSrcweir         return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
469*cdf0e10cSrcweir     }
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir     uno::Sequence< beans::Property > SAL_CALL getProperties()
472*cdf0e10cSrcweir         throw( uno::RuntimeException )
473*cdf0e10cSrcweir     {
474*cdf0e10cSrcweir         return m_aSeq;
475*cdf0e10cSrcweir     }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir     beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName )
478*cdf0e10cSrcweir         throw( beans::UnknownPropertyException,
479*cdf0e10cSrcweir                uno::RuntimeException)
480*cdf0e10cSrcweir     {
481*cdf0e10cSrcweir         for( int i = 0; i < m_aSeq.getLength(); ++i )
482*cdf0e10cSrcweir             if( aName == m_aSeq[i].Name )
483*cdf0e10cSrcweir                 return m_aSeq[i];
484*cdf0e10cSrcweir         throw beans::UnknownPropertyException();
485*cdf0e10cSrcweir     }
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir     sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name )
488*cdf0e10cSrcweir         throw( uno::RuntimeException )
489*cdf0e10cSrcweir     {
490*cdf0e10cSrcweir         for( int i = 0; i < m_aSeq.getLength(); ++i )
491*cdf0e10cSrcweir             if( Name == m_aSeq[i].Name )
492*cdf0e10cSrcweir                 return true;
493*cdf0e10cSrcweir         return false;
494*cdf0e10cSrcweir     }
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir private:
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir     uno::Sequence< beans::Property > m_aSeq;
499*cdf0e10cSrcweir };
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir // XPropertySet
504*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL
505*cdf0e10cSrcweir ResultSetBase::getPropertySetInfo()
506*cdf0e10cSrcweir 	throw( uno::RuntimeException)
507*cdf0e10cSrcweir {
508*cdf0e10cSrcweir 	uno::Sequence< beans::Property > seq(2);
509*cdf0e10cSrcweir 	seq[0].Name = rtl::OUString::createFromAscii( "RowCount" );
510*cdf0e10cSrcweir 	seq[0].Handle = -1;
511*cdf0e10cSrcweir 	seq[0].Type = getCppuType( static_cast< sal_Int32* >(0) );
512*cdf0e10cSrcweir 	seq[0].Attributes = beans::PropertyAttribute::READONLY;
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir 	seq[1].Name = rtl::OUString::createFromAscii( "IsRowCountFinal" );
515*cdf0e10cSrcweir 	seq[1].Handle = -1;
516*cdf0e10cSrcweir 	seq[1].Type = getCppuType( static_cast< sal_Bool* >(0) );
517*cdf0e10cSrcweir 	seq[1].Attributes = beans::PropertyAttribute::READONLY;
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 	//t
520*cdf0e10cSrcweir 	return uno::Reference< beans::XPropertySetInfo > ( new XPropertySetInfoImpl( seq ) );
521*cdf0e10cSrcweir }
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir void SAL_CALL ResultSetBase::setPropertyValue(
526*cdf0e10cSrcweir 	const rtl::OUString& aPropertyName, const uno::Any& aValue )
527*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
528*cdf0e10cSrcweir 		   beans::PropertyVetoException,
529*cdf0e10cSrcweir 		   lang::IllegalArgumentException,
530*cdf0e10cSrcweir 		   lang::WrappedTargetException,
531*cdf0e10cSrcweir 		   uno::RuntimeException)
532*cdf0e10cSrcweir {
533*cdf0e10cSrcweir 	(void)aValue;
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir 	if( aPropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) ||
536*cdf0e10cSrcweir 		aPropertyName == rtl::OUString::createFromAscii( "RowCount" ) )
537*cdf0e10cSrcweir 		return;
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir 	throw beans::UnknownPropertyException();
540*cdf0e10cSrcweir }
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir uno::Any SAL_CALL ResultSetBase::getPropertyValue(
544*cdf0e10cSrcweir 	const rtl::OUString& PropertyName )
545*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
546*cdf0e10cSrcweir 		   lang::WrappedTargetException,
547*cdf0e10cSrcweir 		   uno::RuntimeException)
548*cdf0e10cSrcweir {
549*cdf0e10cSrcweir 	if( PropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) )
550*cdf0e10cSrcweir 	{
551*cdf0e10cSrcweir 		uno::Any aAny;
552*cdf0e10cSrcweir 		aAny <<= m_bRowCountFinal;
553*cdf0e10cSrcweir 		return aAny;
554*cdf0e10cSrcweir 	}
555*cdf0e10cSrcweir 	else if ( PropertyName == rtl::OUString::createFromAscii( "RowCount" ) )
556*cdf0e10cSrcweir 	{
557*cdf0e10cSrcweir 		uno::Any aAny;
558*cdf0e10cSrcweir 		sal_Int32 count = m_aItems.size();
559*cdf0e10cSrcweir 		aAny <<= count;
560*cdf0e10cSrcweir 		return aAny;
561*cdf0e10cSrcweir 	}
562*cdf0e10cSrcweir 	else
563*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
564*cdf0e10cSrcweir }
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir void SAL_CALL ResultSetBase::addPropertyChangeListener(
568*cdf0e10cSrcweir 	const rtl::OUString& aPropertyName,
569*cdf0e10cSrcweir 	const uno::Reference< beans::XPropertyChangeListener >& xListener )
570*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
571*cdf0e10cSrcweir 		   lang::WrappedTargetException,
572*cdf0e10cSrcweir 		   uno::RuntimeException)
573*cdf0e10cSrcweir {
574*cdf0e10cSrcweir 	if( aPropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) )
575*cdf0e10cSrcweir 	{
576*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
577*cdf0e10cSrcweir 		if ( ! m_pIsFinalListeners )
578*cdf0e10cSrcweir 			m_pIsFinalListeners =
579*cdf0e10cSrcweir 				new cppu::OInterfaceContainerHelper( m_aMutex );
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir 		m_pIsFinalListeners->addInterface( xListener );
582*cdf0e10cSrcweir 	}
583*cdf0e10cSrcweir 	else if ( aPropertyName == rtl::OUString::createFromAscii( "RowCount" ) )
584*cdf0e10cSrcweir 	{
585*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
586*cdf0e10cSrcweir 		if ( ! m_pRowCountListeners )
587*cdf0e10cSrcweir 			m_pRowCountListeners =
588*cdf0e10cSrcweir 				new cppu::OInterfaceContainerHelper( m_aMutex );
589*cdf0e10cSrcweir 		m_pRowCountListeners->addInterface( xListener );
590*cdf0e10cSrcweir 	}
591*cdf0e10cSrcweir 	else
592*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
593*cdf0e10cSrcweir }
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir void SAL_CALL ResultSetBase::removePropertyChangeListener(
597*cdf0e10cSrcweir 	const rtl::OUString& aPropertyName,
598*cdf0e10cSrcweir 	const uno::Reference< beans::XPropertyChangeListener >& aListener )
599*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
600*cdf0e10cSrcweir 		   lang::WrappedTargetException,
601*cdf0e10cSrcweir 		   uno::RuntimeException)
602*cdf0e10cSrcweir {
603*cdf0e10cSrcweir 	if( aPropertyName == rtl::OUString::createFromAscii( "IsRowCountFinal" ) &&
604*cdf0e10cSrcweir 		m_pIsFinalListeners )
605*cdf0e10cSrcweir 	{
606*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
607*cdf0e10cSrcweir 		m_pIsFinalListeners->removeInterface( aListener );
608*cdf0e10cSrcweir 	}
609*cdf0e10cSrcweir 	else if ( aPropertyName == rtl::OUString::createFromAscii( "RowCount" ) &&
610*cdf0e10cSrcweir 			  m_pRowCountListeners )
611*cdf0e10cSrcweir 	{
612*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_aMutex );
613*cdf0e10cSrcweir 		m_pRowCountListeners->removeInterface( aListener );
614*cdf0e10cSrcweir 	}
615*cdf0e10cSrcweir 	else
616*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
617*cdf0e10cSrcweir }
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir void SAL_CALL ResultSetBase::addVetoableChangeListener(
621*cdf0e10cSrcweir 	const rtl::OUString& PropertyName,
622*cdf0e10cSrcweir 	const uno::Reference< beans::XVetoableChangeListener >& aListener )
623*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
624*cdf0e10cSrcweir 		   lang::WrappedTargetException,
625*cdf0e10cSrcweir 		   uno::RuntimeException)
626*cdf0e10cSrcweir {
627*cdf0e10cSrcweir 	(void)PropertyName;
628*cdf0e10cSrcweir 	(void)aListener;
629*cdf0e10cSrcweir }
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir void SAL_CALL ResultSetBase::removeVetoableChangeListener(
633*cdf0e10cSrcweir 	const rtl::OUString& PropertyName,
634*cdf0e10cSrcweir 	const uno::Reference< beans::XVetoableChangeListener >& aListener )
635*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
636*cdf0e10cSrcweir 		   lang::WrappedTargetException,
637*cdf0e10cSrcweir 		   uno::RuntimeException)
638*cdf0e10cSrcweir {
639*cdf0e10cSrcweir 	(void)PropertyName;
640*cdf0e10cSrcweir 	(void)aListener;
641*cdf0e10cSrcweir }
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir // XResultSetMetaDataSupplier
646*cdf0e10cSrcweir uno::Reference< sdbc::XResultSetMetaData > SAL_CALL
647*cdf0e10cSrcweir ResultSetBase::getMetaData(
648*cdf0e10cSrcweir 	void )
649*cdf0e10cSrcweir 	throw( sdbc::SQLException,
650*cdf0e10cSrcweir 		   uno::RuntimeException )
651*cdf0e10cSrcweir {
652*cdf0e10cSrcweir 	::ucbhelper::ResultSetMetaData* p =
653*cdf0e10cSrcweir 		  new ::ucbhelper::ResultSetMetaData(
654*cdf0e10cSrcweir 			  m_xMSF, m_sProperty );
655*cdf0e10cSrcweir 	return uno::Reference< sdbc::XResultSetMetaData >( p );
656*cdf0e10cSrcweir }
657