xref: /AOO41X/main/ucbhelper/source/provider/resultset.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_ucbhelper.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir /**************************************************************************
32*cdf0e10cSrcweir 								TODO
33*cdf0e10cSrcweir  **************************************************************************
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir  *************************************************************************/
36*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
37*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
38*cdf0e10cSrcweir #include <ucbhelper/resultset.hxx>
39*cdf0e10cSrcweir #include <ucbhelper/resultsetmetadata.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir using namespace com::sun::star;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //=========================================================================
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir namespace ucbhelper_impl
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir struct PropertyInfo
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 	const char*	pName;
51*cdf0e10cSrcweir 	sal_Int32   nHandle;
52*cdf0e10cSrcweir 	sal_Int16   nAttributes;
53*cdf0e10cSrcweir 	const uno::Type& (*pGetCppuType)();
54*cdf0e10cSrcweir };
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir static const uno::Type& sal_Int32_getCppuType()
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir 	return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir static const uno::Type& sal_Bool_getCppuType()
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 	return getCppuBooleanType();
64*cdf0e10cSrcweir }
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir static const PropertyInfo aPropertyTable[] =
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir 	{ "IsRowCountFinal",
69*cdf0e10cSrcweir 	  1000,
70*cdf0e10cSrcweir 	  beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
71*cdf0e10cSrcweir 	  &sal_Bool_getCppuType
72*cdf0e10cSrcweir 	},
73*cdf0e10cSrcweir 	{ "RowCount",
74*cdf0e10cSrcweir 	  1001,
75*cdf0e10cSrcweir 	  beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
76*cdf0e10cSrcweir 	  &sal_Int32_getCppuType
77*cdf0e10cSrcweir 	},
78*cdf0e10cSrcweir 	{ 0,
79*cdf0e10cSrcweir 	  0,
80*cdf0e10cSrcweir 	  0,
81*cdf0e10cSrcweir 	  0
82*cdf0e10cSrcweir 	}
83*cdf0e10cSrcweir };
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir #define RESULTSET_PROPERTY_COUNT 2
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir //=========================================================================
88*cdf0e10cSrcweir //
89*cdf0e10cSrcweir // class PropertySetInfo
90*cdf0e10cSrcweir //
91*cdf0e10cSrcweir //=========================================================================
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir class PropertySetInfo :
94*cdf0e10cSrcweir 		public cppu::OWeakObject,
95*cdf0e10cSrcweir         public lang::XTypeProvider,
96*cdf0e10cSrcweir         public beans::XPropertySetInfo
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir 	uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
99*cdf0e10cSrcweir 	uno::Sequence< beans::Property >* 			 m_pProps;
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir private:
102*cdf0e10cSrcweir 	sal_Bool queryProperty(
103*cdf0e10cSrcweir         const rtl::OUString& aName, beans::Property& rProp );
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir public:
106*cdf0e10cSrcweir 	PropertySetInfo(
107*cdf0e10cSrcweir         const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
108*cdf0e10cSrcweir         const PropertyInfo* pProps,
109*cdf0e10cSrcweir         sal_Int32 nProps );
110*cdf0e10cSrcweir 	virtual ~PropertySetInfo();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	// XInterface
113*cdf0e10cSrcweir 	XINTERFACE_DECL()
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	// XTypeProvider
116*cdf0e10cSrcweir 	XTYPEPROVIDER_DECL()
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	// XPropertySetInfo
119*cdf0e10cSrcweir     virtual uno::Sequence< beans::Property > SAL_CALL getProperties()
120*cdf0e10cSrcweir 		throw( uno::RuntimeException );
121*cdf0e10cSrcweir     virtual beans::Property SAL_CALL getPropertyByName(
122*cdf0e10cSrcweir             const rtl::OUString& aName )
123*cdf0e10cSrcweir 		throw( beans::UnknownPropertyException, uno::RuntimeException );
124*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasPropertyByName( const rtl::OUString& Name )
125*cdf0e10cSrcweir 		throw( uno::RuntimeException );
126*cdf0e10cSrcweir };
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir //=========================================================================
129*cdf0e10cSrcweir //
130*cdf0e10cSrcweir // PropertyChangeListenerContainer.
131*cdf0e10cSrcweir //
132*cdf0e10cSrcweir //=========================================================================
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir struct equalStr_Impl
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	bool operator()( const rtl::OUString& s1, const rtl::OUString& s2 ) const
137*cdf0e10cSrcweir   	{
138*cdf0e10cSrcweir 		return !!( s1 == s2 );
139*cdf0e10cSrcweir 	}
140*cdf0e10cSrcweir };
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir struct hashStr_Impl
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir 	size_t operator()( const rtl::OUString& rName ) const
145*cdf0e10cSrcweir 	{
146*cdf0e10cSrcweir 		return rName.hashCode();
147*cdf0e10cSrcweir 	}
148*cdf0e10cSrcweir };
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir typedef cppu::OMultiTypeInterfaceContainerHelperVar
151*cdf0e10cSrcweir <
152*cdf0e10cSrcweir 	rtl::OUString,
153*cdf0e10cSrcweir 	hashStr_Impl,
154*cdf0e10cSrcweir 	equalStr_Impl
155*cdf0e10cSrcweir > PropertyChangeListenerContainer;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir //=========================================================================
158*cdf0e10cSrcweir //
159*cdf0e10cSrcweir // class PropertyChangeListeners.
160*cdf0e10cSrcweir //
161*cdf0e10cSrcweir //=========================================================================
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir class PropertyChangeListeners : public PropertyChangeListenerContainer
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir public:
166*cdf0e10cSrcweir 	PropertyChangeListeners( osl::Mutex& rMtx )
167*cdf0e10cSrcweir 	: PropertyChangeListenerContainer( rMtx ) {}
168*cdf0e10cSrcweir };
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir } // namespace ucbhelper_impl
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir using namespace ucbhelper_impl;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir namespace ucbhelper
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir //=========================================================================
178*cdf0e10cSrcweir //
179*cdf0e10cSrcweir // struct ResultSet_Impl.
180*cdf0e10cSrcweir //
181*cdf0e10cSrcweir //=========================================================================
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir struct ResultSet_Impl
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	uno::Reference< lang::XMultiServiceFactory > 	m_xSMgr;
186*cdf0e10cSrcweir 	uno::Reference< com::sun::star::ucb::XCommandEnvironment > 	m_xEnv;
187*cdf0e10cSrcweir 	uno::Reference< beans::XPropertySetInfo >     	m_xPropSetInfo;
188*cdf0e10cSrcweir 	uno::Reference< sdbc::XResultSetMetaData >   	m_xMetaData;
189*cdf0e10cSrcweir 	uno::Sequence< beans::Property >              	m_aProperties;
190*cdf0e10cSrcweir 	rtl::Reference< ResultSetDataSupplier >	        m_xDataSupplier;
191*cdf0e10cSrcweir 	osl::Mutex						 	m_aMutex;
192*cdf0e10cSrcweir 	cppu::OInterfaceContainerHelper* 	m_pDisposeEventListeners;
193*cdf0e10cSrcweir 	PropertyChangeListeners*			m_pPropertyChangeListeners;
194*cdf0e10cSrcweir 	sal_Int32						 	m_nPos;
195*cdf0e10cSrcweir 	sal_Bool 						 	m_bWasNull;
196*cdf0e10cSrcweir 	sal_Bool 						 	m_bAfterLast;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 	inline ResultSet_Impl(
199*cdf0e10cSrcweir         const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
200*cdf0e10cSrcweir         const uno::Sequence< beans::Property >& rProperties,
201*cdf0e10cSrcweir         const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
202*cdf0e10cSrcweir         const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
203*cdf0e10cSrcweir             rxEnv );
204*cdf0e10cSrcweir 	inline ~ResultSet_Impl();
205*cdf0e10cSrcweir };
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir inline ResultSet_Impl::ResultSet_Impl(
208*cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
209*cdf0e10cSrcweir     const uno::Sequence< beans::Property >& rProperties,
210*cdf0e10cSrcweir     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
211*cdf0e10cSrcweir     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
212*cdf0e10cSrcweir : m_xSMgr( rxSMgr ),
213*cdf0e10cSrcweir   m_xEnv( rxEnv ),
214*cdf0e10cSrcweir   m_aProperties( rProperties ),
215*cdf0e10cSrcweir   m_xDataSupplier( rDataSupplier ),
216*cdf0e10cSrcweir   m_pDisposeEventListeners( 0 ),
217*cdf0e10cSrcweir   m_pPropertyChangeListeners( 0 ),
218*cdf0e10cSrcweir   m_nPos( 0 ), // Position is one-based. Zero means: before first element.
219*cdf0e10cSrcweir   m_bWasNull( sal_False ),
220*cdf0e10cSrcweir   m_bAfterLast( sal_False )
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir //=========================================================================
225*cdf0e10cSrcweir inline ResultSet_Impl::~ResultSet_Impl()
226*cdf0e10cSrcweir {
227*cdf0e10cSrcweir 	delete m_pDisposeEventListeners;
228*cdf0e10cSrcweir 	delete m_pPropertyChangeListeners;
229*cdf0e10cSrcweir }
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir //=========================================================================
232*cdf0e10cSrcweir //=========================================================================
233*cdf0e10cSrcweir //
234*cdf0e10cSrcweir // ResultSet Implementation.
235*cdf0e10cSrcweir //
236*cdf0e10cSrcweir //=========================================================================
237*cdf0e10cSrcweir //=========================================================================
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir ResultSet::ResultSet(
240*cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
241*cdf0e10cSrcweir     const uno::Sequence< beans::Property >& rProperties,
242*cdf0e10cSrcweir     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier )
243*cdf0e10cSrcweir : m_pImpl( new ResultSet_Impl(
244*cdf0e10cSrcweir                rxSMgr,
245*cdf0e10cSrcweir                rProperties,
246*cdf0e10cSrcweir                rDataSupplier,
247*cdf0e10cSrcweir                uno::Reference< com::sun::star::ucb::XCommandEnvironment >() ) )
248*cdf0e10cSrcweir {
249*cdf0e10cSrcweir 	rDataSupplier->m_pResultSet = this;
250*cdf0e10cSrcweir }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir //=========================================================================
253*cdf0e10cSrcweir ResultSet::ResultSet(
254*cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
255*cdf0e10cSrcweir     const uno::Sequence< beans::Property >& rProperties,
256*cdf0e10cSrcweir     const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
257*cdf0e10cSrcweir     const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
258*cdf0e10cSrcweir : m_pImpl( new ResultSet_Impl( rxSMgr, rProperties, rDataSupplier, rxEnv ) )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir 	rDataSupplier->m_pResultSet = this;
261*cdf0e10cSrcweir }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir //=========================================================================
264*cdf0e10cSrcweir // virtual
265*cdf0e10cSrcweir ResultSet::~ResultSet()
266*cdf0e10cSrcweir {
267*cdf0e10cSrcweir 	delete m_pImpl;
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir //=========================================================================
271*cdf0e10cSrcweir //
272*cdf0e10cSrcweir // XInterface methods.
273*cdf0e10cSrcweir //
274*cdf0e10cSrcweir //=========================================================================
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir XINTERFACE_IMPL_9( ResultSet,
277*cdf0e10cSrcweir 				   lang::XTypeProvider,
278*cdf0e10cSrcweir 				   lang::XServiceInfo,
279*cdf0e10cSrcweir 				   lang::XComponent,
280*cdf0e10cSrcweir 				   com::sun::star::ucb::XContentAccess,
281*cdf0e10cSrcweir 				   sdbc::XResultSet,
282*cdf0e10cSrcweir 				   sdbc::XResultSetMetaDataSupplier,
283*cdf0e10cSrcweir 				   sdbc::XRow,
284*cdf0e10cSrcweir 				   sdbc::XCloseable,
285*cdf0e10cSrcweir 				   beans::XPropertySet );
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir //=========================================================================
288*cdf0e10cSrcweir //
289*cdf0e10cSrcweir // XTypeProvider methods.
290*cdf0e10cSrcweir //
291*cdf0e10cSrcweir //=========================================================================
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir XTYPEPROVIDER_IMPL_9( ResultSet,
294*cdf0e10cSrcweir 					  lang::XTypeProvider,
295*cdf0e10cSrcweir 				   	  lang::XServiceInfo,
296*cdf0e10cSrcweir 					  lang::XComponent,
297*cdf0e10cSrcweir 					  com::sun::star::ucb::XContentAccess,
298*cdf0e10cSrcweir 					  sdbc::XResultSet,
299*cdf0e10cSrcweir 					  sdbc::XResultSetMetaDataSupplier,
300*cdf0e10cSrcweir 					  sdbc::XRow,
301*cdf0e10cSrcweir 					  sdbc::XCloseable,
302*cdf0e10cSrcweir 					  beans::XPropertySet );
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir //=========================================================================
305*cdf0e10cSrcweir //
306*cdf0e10cSrcweir // XServiceInfo methods.
307*cdf0e10cSrcweir //
308*cdf0e10cSrcweir //=========================================================================
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
311*cdf0e10cSrcweir 		 		   rtl::OUString::createFromAscii( "ResultSet" ),
312*cdf0e10cSrcweir 		 		   rtl::OUString::createFromAscii( RESULTSET_SERVICE_NAME ) );
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir //=========================================================================
315*cdf0e10cSrcweir //
316*cdf0e10cSrcweir // XComponent methods.
317*cdf0e10cSrcweir //
318*cdf0e10cSrcweir //=========================================================================
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir // virtual
321*cdf0e10cSrcweir void SAL_CALL ResultSet::dispose()
322*cdf0e10cSrcweir 	throw( uno::RuntimeException )
323*cdf0e10cSrcweir {
324*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir 	if ( m_pImpl->m_pDisposeEventListeners &&
327*cdf0e10cSrcweir 		 m_pImpl->m_pDisposeEventListeners->getLength() )
328*cdf0e10cSrcweir 	{
329*cdf0e10cSrcweir 		lang::EventObject aEvt;
330*cdf0e10cSrcweir 		aEvt.Source = static_cast< lang::XComponent * >( this );
331*cdf0e10cSrcweir 		m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
332*cdf0e10cSrcweir 	}
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 	if ( m_pImpl->m_pPropertyChangeListeners )
335*cdf0e10cSrcweir 	{
336*cdf0e10cSrcweir 		lang::EventObject aEvt;
337*cdf0e10cSrcweir 		aEvt.Source = static_cast< beans::XPropertySet * >( this );
338*cdf0e10cSrcweir 		m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
339*cdf0e10cSrcweir 	}
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->close();
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir //=========================================================================
345*cdf0e10cSrcweir // virtual
346*cdf0e10cSrcweir void SAL_CALL ResultSet::addEventListener(
347*cdf0e10cSrcweir         const uno::Reference< lang::XEventListener >& Listener )
348*cdf0e10cSrcweir 	throw( uno::RuntimeException )
349*cdf0e10cSrcweir {
350*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	if ( !m_pImpl->m_pDisposeEventListeners )
353*cdf0e10cSrcweir 		m_pImpl->m_pDisposeEventListeners =
354*cdf0e10cSrcweir             new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex );
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 	m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
357*cdf0e10cSrcweir }
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir //=========================================================================
360*cdf0e10cSrcweir // virtual
361*cdf0e10cSrcweir void SAL_CALL ResultSet::removeEventListener(
362*cdf0e10cSrcweir         const uno::Reference< lang::XEventListener >& Listener )
363*cdf0e10cSrcweir 	throw( uno::RuntimeException )
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 	if ( m_pImpl->m_pDisposeEventListeners )
368*cdf0e10cSrcweir 		m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir //=========================================================================
372*cdf0e10cSrcweir //
373*cdf0e10cSrcweir // XResultSetMetaDataSupplier methods.
374*cdf0e10cSrcweir //
375*cdf0e10cSrcweir //=========================================================================
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir // virtual
378*cdf0e10cSrcweir uno::Reference< sdbc::XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
379*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
380*cdf0e10cSrcweir {
381*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 	if ( !m_pImpl->m_xMetaData.is() )
384*cdf0e10cSrcweir 		m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr,
385*cdf0e10cSrcweir 													  m_pImpl->m_aProperties );
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 	return m_pImpl->m_xMetaData;
388*cdf0e10cSrcweir }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir //=========================================================================
391*cdf0e10cSrcweir //
392*cdf0e10cSrcweir // XResultSet methods.
393*cdf0e10cSrcweir //
394*cdf0e10cSrcweir //=========================================================================
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir // virtual
397*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::next()
398*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
399*cdf0e10cSrcweir {
400*cdf0e10cSrcweir 	// Note: Cursor is initially positioned before the first row.
401*cdf0e10cSrcweir 	//       First call to 'next()' moves it to first row.
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
406*cdf0e10cSrcweir 	{
407*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
408*cdf0e10cSrcweir 		return sal_False;
409*cdf0e10cSrcweir 	}
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 	// getResult works zero-based!
412*cdf0e10cSrcweir 	if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
413*cdf0e10cSrcweir 	{
414*cdf0e10cSrcweir 		m_pImpl->m_bAfterLast = sal_True;
415*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
416*cdf0e10cSrcweir 		return sal_False;
417*cdf0e10cSrcweir 	}
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir 	m_pImpl->m_nPos++;
420*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
421*cdf0e10cSrcweir 	return sal_True;
422*cdf0e10cSrcweir }
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir //=========================================================================
425*cdf0e10cSrcweir // virtual
426*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::isBeforeFirst()
427*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
428*cdf0e10cSrcweir {
429*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
430*cdf0e10cSrcweir 	{
431*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
432*cdf0e10cSrcweir 		return sal_False;
433*cdf0e10cSrcweir 	}
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 	// getResult works zero-based!
436*cdf0e10cSrcweir 	if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
437*cdf0e10cSrcweir 	{
438*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
439*cdf0e10cSrcweir 		return sal_False;
440*cdf0e10cSrcweir 	}
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
443*cdf0e10cSrcweir 	return ( m_pImpl->m_nPos == 0 );
444*cdf0e10cSrcweir }
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir //=========================================================================
447*cdf0e10cSrcweir // virtual
448*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::isAfterLast()
449*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
450*cdf0e10cSrcweir {
451*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
452*cdf0e10cSrcweir 	return m_pImpl->m_bAfterLast;
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir //=========================================================================
456*cdf0e10cSrcweir // virtual
457*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::isFirst()
458*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
459*cdf0e10cSrcweir {
460*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
461*cdf0e10cSrcweir 	{
462*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
463*cdf0e10cSrcweir 		return sal_False;
464*cdf0e10cSrcweir 	}
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
467*cdf0e10cSrcweir 	return ( m_pImpl->m_nPos == 1 );
468*cdf0e10cSrcweir }
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir //=========================================================================
471*cdf0e10cSrcweir // virtual
472*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::isLast()
473*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
474*cdf0e10cSrcweir {
475*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
476*cdf0e10cSrcweir 	{
477*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
478*cdf0e10cSrcweir 		return sal_False;
479*cdf0e10cSrcweir 	}
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 	sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
482*cdf0e10cSrcweir 	if ( !nCount )
483*cdf0e10cSrcweir 	{
484*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
485*cdf0e10cSrcweir 		return sal_False;
486*cdf0e10cSrcweir 	}
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
489*cdf0e10cSrcweir 	return ( m_pImpl->m_nPos == nCount );
490*cdf0e10cSrcweir }
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir //=========================================================================
493*cdf0e10cSrcweir // virtual
494*cdf0e10cSrcweir void SAL_CALL ResultSet::beforeFirst()
495*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
496*cdf0e10cSrcweir {
497*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
498*cdf0e10cSrcweir 	m_pImpl->m_bAfterLast = sal_False;
499*cdf0e10cSrcweir 	m_pImpl->m_nPos = 0;
500*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir //=========================================================================
504*cdf0e10cSrcweir // virtual
505*cdf0e10cSrcweir void SAL_CALL ResultSet::afterLast()
506*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
507*cdf0e10cSrcweir {
508*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
509*cdf0e10cSrcweir 	m_pImpl->m_bAfterLast = sal_True;
510*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir //=========================================================================
514*cdf0e10cSrcweir // virtual
515*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::first()
516*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
517*cdf0e10cSrcweir {
518*cdf0e10cSrcweir 	// getResult works zero-based!
519*cdf0e10cSrcweir 	if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
520*cdf0e10cSrcweir 	{
521*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_pImpl->m_aMutex );
522*cdf0e10cSrcweir 		m_pImpl->m_bAfterLast = sal_False;
523*cdf0e10cSrcweir 		m_pImpl->m_nPos = 1;
524*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
525*cdf0e10cSrcweir 		return sal_True;
526*cdf0e10cSrcweir 	}
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
529*cdf0e10cSrcweir 	return sal_False;
530*cdf0e10cSrcweir }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir //=========================================================================
533*cdf0e10cSrcweir // virtual
534*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::last()
535*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
536*cdf0e10cSrcweir {
537*cdf0e10cSrcweir 	sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
538*cdf0e10cSrcweir 	if ( nCount )
539*cdf0e10cSrcweir 	{
540*cdf0e10cSrcweir 		osl::MutexGuard aGuard( m_pImpl->m_aMutex );
541*cdf0e10cSrcweir 		m_pImpl->m_bAfterLast = sal_False;
542*cdf0e10cSrcweir 		m_pImpl->m_nPos = nCount;
543*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
544*cdf0e10cSrcweir 		return sal_True;
545*cdf0e10cSrcweir 	}
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
548*cdf0e10cSrcweir 	return sal_False;
549*cdf0e10cSrcweir }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir //=========================================================================
552*cdf0e10cSrcweir // virtual
553*cdf0e10cSrcweir sal_Int32 SAL_CALL ResultSet::getRow()
554*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
555*cdf0e10cSrcweir {
556*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
557*cdf0e10cSrcweir 	{
558*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
559*cdf0e10cSrcweir 		return 0;
560*cdf0e10cSrcweir 	}
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
563*cdf0e10cSrcweir 	return m_pImpl->m_nPos;
564*cdf0e10cSrcweir }
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir //=========================================================================
567*cdf0e10cSrcweir // virtual
568*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
569*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
570*cdf0e10cSrcweir {
571*cdf0e10cSrcweir /*
572*cdf0e10cSrcweir 	If the row number is positive, the cursor moves to the given row number
573*cdf0e10cSrcweir 	with respect to the beginning of the result set. The first row is row 1,
574*cdf0e10cSrcweir 	the second is row 2, and so on.
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir 	If the given row number is negative, the cursor moves to an absolute row
577*cdf0e10cSrcweir 	position with respect to the end of the result set. For example, calling
578*cdf0e10cSrcweir 	absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
579*cdf0e10cSrcweir 	indicates the next-to-last row, and so on.
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir 	An attempt to position the cursor beyond the first/last row in the result
582*cdf0e10cSrcweir 	set leaves the cursor before/after the first/last row, respectively.
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir 	Calling absolute( 1 ) is the same as calling first().
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir     Calling absolute( -1 ) is the same as calling last().
587*cdf0e10cSrcweir */
588*cdf0e10cSrcweir 	if ( row < 0 )
589*cdf0e10cSrcweir 	{
590*cdf0e10cSrcweir 		sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 		if ( ( row * -1 ) > nCount )
593*cdf0e10cSrcweir 		{
594*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
595*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
596*cdf0e10cSrcweir 			m_pImpl->m_nPos = 0;
597*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
598*cdf0e10cSrcweir 			return sal_False;
599*cdf0e10cSrcweir 		}
600*cdf0e10cSrcweir 		else // |row| <= nCount
601*cdf0e10cSrcweir 		{
602*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
603*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
604*cdf0e10cSrcweir 			m_pImpl->m_nPos = ( nCount + row + 1 );
605*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
606*cdf0e10cSrcweir 			return sal_True;
607*cdf0e10cSrcweir 		}
608*cdf0e10cSrcweir 	}
609*cdf0e10cSrcweir 	else if ( row == 0 )
610*cdf0e10cSrcweir 	{
611*cdf0e10cSrcweir 	    // @throws SQLException
612*cdf0e10cSrcweir 		//		... if row is 0 ...
613*cdf0e10cSrcweir 		throw sdbc::SQLException();
614*cdf0e10cSrcweir 	}
615*cdf0e10cSrcweir 	else // row > 0
616*cdf0e10cSrcweir 	{
617*cdf0e10cSrcweir 		sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir 		if ( row <= nCount )
620*cdf0e10cSrcweir 		{
621*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
622*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
623*cdf0e10cSrcweir 			m_pImpl->m_nPos = row;
624*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
625*cdf0e10cSrcweir 			return sal_True;
626*cdf0e10cSrcweir 		}
627*cdf0e10cSrcweir 		else // row > nCount
628*cdf0e10cSrcweir 		{
629*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
630*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_True;
631*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
632*cdf0e10cSrcweir 			return sal_False;
633*cdf0e10cSrcweir 		}
634*cdf0e10cSrcweir 	}
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir 	// unreachable...
637*cdf0e10cSrcweir }
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir //=========================================================================
640*cdf0e10cSrcweir // virtual
641*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
642*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
643*cdf0e10cSrcweir {
644*cdf0e10cSrcweir /*
645*cdf0e10cSrcweir 	Attempting to move beyond the first/last row in the result set
646*cdf0e10cSrcweir 	positions the cursor before/after the the first/last row.
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 	Calling relative( 0 ) is valid, but does not change the cursor position.
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir     Calling relative( 1 ) is different from calling next() because it makes
651*cdf0e10cSrcweir 	sense to call next() when there is no current row, for example,	when
652*cdf0e10cSrcweir 	the cursor is positioned before the first row or after the last	row of
653*cdf0e10cSrcweir 	the result set.
654*cdf0e10cSrcweir */
655*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
656*cdf0e10cSrcweir 	{
657*cdf0e10cSrcweir 		// "No current row".
658*cdf0e10cSrcweir 		throw sdbc::SQLException();
659*cdf0e10cSrcweir 	}
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir 	if ( rows < 0 )
662*cdf0e10cSrcweir 	{
663*cdf0e10cSrcweir 		if ( ( m_pImpl->m_nPos + rows ) > 0 )
664*cdf0e10cSrcweir 		{
665*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
666*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
667*cdf0e10cSrcweir 			m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
668*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
669*cdf0e10cSrcweir 			return sal_True;
670*cdf0e10cSrcweir 		}
671*cdf0e10cSrcweir 		else
672*cdf0e10cSrcweir 		{
673*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
674*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
675*cdf0e10cSrcweir 			m_pImpl->m_nPos = 0;
676*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
677*cdf0e10cSrcweir 			return sal_False;
678*cdf0e10cSrcweir 		}
679*cdf0e10cSrcweir 	}
680*cdf0e10cSrcweir 	else if ( rows == 0 )
681*cdf0e10cSrcweir 	{
682*cdf0e10cSrcweir 		// nop.
683*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
684*cdf0e10cSrcweir 		return sal_True;
685*cdf0e10cSrcweir 	}
686*cdf0e10cSrcweir 	else // rows > 0
687*cdf0e10cSrcweir 	{
688*cdf0e10cSrcweir 		sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
689*cdf0e10cSrcweir 		if ( ( m_pImpl->m_nPos + rows ) <= nCount )
690*cdf0e10cSrcweir 		{
691*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
692*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_False;
693*cdf0e10cSrcweir 			m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
694*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
695*cdf0e10cSrcweir 			return sal_True;
696*cdf0e10cSrcweir 		}
697*cdf0e10cSrcweir 		else
698*cdf0e10cSrcweir 		{
699*cdf0e10cSrcweir 			osl::MutexGuard aGuard( m_pImpl->m_aMutex );
700*cdf0e10cSrcweir 			m_pImpl->m_bAfterLast = sal_True;
701*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
702*cdf0e10cSrcweir 			return sal_False;
703*cdf0e10cSrcweir 		}
704*cdf0e10cSrcweir 	}
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir 	// unreachable...
707*cdf0e10cSrcweir }
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir //=========================================================================
710*cdf0e10cSrcweir // virtual
711*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::previous()
712*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
713*cdf0e10cSrcweir {
714*cdf0e10cSrcweir /*
715*cdf0e10cSrcweir 	previous() is not the same as relative( -1 ) because it makes sense
716*cdf0e10cSrcweir 	to call previous() when there is no current row.
717*cdf0e10cSrcweir */
718*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast )
721*cdf0e10cSrcweir 	{
722*cdf0e10cSrcweir 		m_pImpl->m_bAfterLast = sal_False;
723*cdf0e10cSrcweir 		sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
724*cdf0e10cSrcweir 		m_pImpl->m_nPos = nCount;
725*cdf0e10cSrcweir 	}
726*cdf0e10cSrcweir 	else if ( m_pImpl->m_nPos )
727*cdf0e10cSrcweir 		m_pImpl->m_nPos--;
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos )
730*cdf0e10cSrcweir 	{
731*cdf0e10cSrcweir 		m_pImpl->m_xDataSupplier->validate();
732*cdf0e10cSrcweir 		return sal_True;
733*cdf0e10cSrcweir 	}
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
736*cdf0e10cSrcweir 	return sal_False;
737*cdf0e10cSrcweir }
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir //=========================================================================
740*cdf0e10cSrcweir // virtual
741*cdf0e10cSrcweir void SAL_CALL ResultSet::refreshRow()
742*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
743*cdf0e10cSrcweir {
744*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
745*cdf0e10cSrcweir 	if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
746*cdf0e10cSrcweir 		return;
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
749*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
750*cdf0e10cSrcweir }
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir //=========================================================================
753*cdf0e10cSrcweir // virtual
754*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::rowUpdated()
755*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
756*cdf0e10cSrcweir {
757*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
758*cdf0e10cSrcweir 	return sal_False;
759*cdf0e10cSrcweir }
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir //=========================================================================
762*cdf0e10cSrcweir // virtual
763*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::rowInserted()
764*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
765*cdf0e10cSrcweir {
766*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
767*cdf0e10cSrcweir 	return sal_False;
768*cdf0e10cSrcweir }
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir //=========================================================================
771*cdf0e10cSrcweir // virtual
772*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::rowDeleted()
773*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
774*cdf0e10cSrcweir {
775*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
776*cdf0e10cSrcweir 	return sal_False;
777*cdf0e10cSrcweir }
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir //=========================================================================
780*cdf0e10cSrcweir // virtual
781*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL ResultSet::getStatement()
782*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
783*cdf0e10cSrcweir {
784*cdf0e10cSrcweir /*
785*cdf0e10cSrcweir 	returns the Statement that produced this ResultSet object. If the
786*cdf0e10cSrcweir 	result set was generated some other way, ... this method returns null.
787*cdf0e10cSrcweir */
788*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
789*cdf0e10cSrcweir 	return uno::Reference< uno::XInterface >();
790*cdf0e10cSrcweir }
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir //=========================================================================
793*cdf0e10cSrcweir //
794*cdf0e10cSrcweir // XRow methods.
795*cdf0e10cSrcweir //
796*cdf0e10cSrcweir //=========================================================================
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir // virtual
799*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::wasNull()
800*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
801*cdf0e10cSrcweir {
802*cdf0e10cSrcweir 	// This method can not be implemented correctly!!! Imagine different
803*cdf0e10cSrcweir 	// threads doing a getXYZ - wasNull calling sequence on the same
804*cdf0e10cSrcweir 	// implementation object...
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
807*cdf0e10cSrcweir 	{
808*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
809*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
810*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
811*cdf0e10cSrcweir 		if ( xValues.is() )
812*cdf0e10cSrcweir 		{
813*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
814*cdf0e10cSrcweir 			return xValues->wasNull();
815*cdf0e10cSrcweir 		}
816*cdf0e10cSrcweir 	}
817*cdf0e10cSrcweir 
818*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
819*cdf0e10cSrcweir 	return m_pImpl->m_bWasNull;
820*cdf0e10cSrcweir }
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir //=========================================================================
823*cdf0e10cSrcweir // virtual
824*cdf0e10cSrcweir rtl::OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
825*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
826*cdf0e10cSrcweir {
827*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
828*cdf0e10cSrcweir 	{
829*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
830*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
831*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
832*cdf0e10cSrcweir 		if ( xValues.is() )
833*cdf0e10cSrcweir 		{
834*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
835*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
836*cdf0e10cSrcweir 			return xValues->getString( columnIndex );
837*cdf0e10cSrcweir 		}
838*cdf0e10cSrcweir 	}
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
841*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
842*cdf0e10cSrcweir 	return rtl::OUString();
843*cdf0e10cSrcweir }
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir //=========================================================================
846*cdf0e10cSrcweir // virtual
847*cdf0e10cSrcweir sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
848*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
849*cdf0e10cSrcweir {
850*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
851*cdf0e10cSrcweir 	{
852*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
853*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
854*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
855*cdf0e10cSrcweir 		if ( xValues.is() )
856*cdf0e10cSrcweir 		{
857*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
858*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
859*cdf0e10cSrcweir 			return xValues->getBoolean( columnIndex );
860*cdf0e10cSrcweir 		}
861*cdf0e10cSrcweir 	}
862*cdf0e10cSrcweir 
863*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
864*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
865*cdf0e10cSrcweir 	return sal_False;
866*cdf0e10cSrcweir }
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir //=========================================================================
869*cdf0e10cSrcweir // virtual
870*cdf0e10cSrcweir sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
871*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
872*cdf0e10cSrcweir {
873*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
874*cdf0e10cSrcweir 	{
875*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
876*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
877*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
878*cdf0e10cSrcweir 		if ( xValues.is() )
879*cdf0e10cSrcweir 		{
880*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
881*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
882*cdf0e10cSrcweir 			return xValues->getByte( columnIndex );
883*cdf0e10cSrcweir 		}
884*cdf0e10cSrcweir 	}
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
887*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
888*cdf0e10cSrcweir 	return 0;
889*cdf0e10cSrcweir }
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir //=========================================================================
892*cdf0e10cSrcweir // virtual
893*cdf0e10cSrcweir sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
894*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
895*cdf0e10cSrcweir {
896*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
897*cdf0e10cSrcweir 	{
898*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
899*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
900*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
901*cdf0e10cSrcweir 		if ( xValues.is() )
902*cdf0e10cSrcweir 		{
903*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
904*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
905*cdf0e10cSrcweir 			return xValues->getShort( columnIndex );
906*cdf0e10cSrcweir 		}
907*cdf0e10cSrcweir 	}
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
910*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
911*cdf0e10cSrcweir 	return 0;
912*cdf0e10cSrcweir }
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir //=========================================================================
915*cdf0e10cSrcweir // virtual
916*cdf0e10cSrcweir sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
917*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
918*cdf0e10cSrcweir {
919*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
920*cdf0e10cSrcweir 	{
921*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
922*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
923*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
924*cdf0e10cSrcweir 		if ( xValues.is() )
925*cdf0e10cSrcweir 		{
926*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
927*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
928*cdf0e10cSrcweir 			return xValues->getInt( columnIndex );
929*cdf0e10cSrcweir 		}
930*cdf0e10cSrcweir 	}
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
933*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
934*cdf0e10cSrcweir 	return 0;
935*cdf0e10cSrcweir }
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir //=========================================================================
938*cdf0e10cSrcweir // virtual
939*cdf0e10cSrcweir sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
940*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
941*cdf0e10cSrcweir {
942*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
943*cdf0e10cSrcweir 	{
944*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
945*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
946*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
947*cdf0e10cSrcweir 		if ( xValues.is() )
948*cdf0e10cSrcweir 		{
949*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
950*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
951*cdf0e10cSrcweir 			return xValues->getLong( columnIndex );
952*cdf0e10cSrcweir 		}
953*cdf0e10cSrcweir 	}
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
956*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
957*cdf0e10cSrcweir 	return 0;
958*cdf0e10cSrcweir }
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir //=========================================================================
961*cdf0e10cSrcweir // virtual
962*cdf0e10cSrcweir float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
963*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
964*cdf0e10cSrcweir {
965*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
966*cdf0e10cSrcweir 	{
967*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
968*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
969*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
970*cdf0e10cSrcweir 		if ( xValues.is() )
971*cdf0e10cSrcweir 		{
972*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
973*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
974*cdf0e10cSrcweir 			return xValues->getFloat( columnIndex );
975*cdf0e10cSrcweir 		}
976*cdf0e10cSrcweir 	}
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
979*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
980*cdf0e10cSrcweir 	return 0;
981*cdf0e10cSrcweir }
982*cdf0e10cSrcweir 
983*cdf0e10cSrcweir //=========================================================================
984*cdf0e10cSrcweir // virtual
985*cdf0e10cSrcweir double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
986*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
987*cdf0e10cSrcweir {
988*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
989*cdf0e10cSrcweir 	{
990*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
991*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
992*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
993*cdf0e10cSrcweir 		if ( xValues.is() )
994*cdf0e10cSrcweir 		{
995*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
996*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
997*cdf0e10cSrcweir 			return xValues->getDouble( columnIndex );
998*cdf0e10cSrcweir 		}
999*cdf0e10cSrcweir 	}
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1002*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1003*cdf0e10cSrcweir 	return 0;
1004*cdf0e10cSrcweir }
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir //=========================================================================
1007*cdf0e10cSrcweir // virtual
1008*cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL
1009*cdf0e10cSrcweir ResultSet::getBytes( sal_Int32 columnIndex )
1010*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1011*cdf0e10cSrcweir {
1012*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1013*cdf0e10cSrcweir 	{
1014*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1015*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1016*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1017*cdf0e10cSrcweir 		if ( xValues.is() )
1018*cdf0e10cSrcweir 		{
1019*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1020*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1021*cdf0e10cSrcweir 			return xValues->getBytes( columnIndex );
1022*cdf0e10cSrcweir 		}
1023*cdf0e10cSrcweir 	}
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1026*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1027*cdf0e10cSrcweir 	return uno::Sequence< sal_Int8 >();
1028*cdf0e10cSrcweir }
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir //=========================================================================
1031*cdf0e10cSrcweir // virtual
1032*cdf0e10cSrcweir util::Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
1033*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1034*cdf0e10cSrcweir {
1035*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1036*cdf0e10cSrcweir 	{
1037*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1038*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1039*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1040*cdf0e10cSrcweir 		if ( xValues.is() )
1041*cdf0e10cSrcweir 		{
1042*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1043*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1044*cdf0e10cSrcweir 			return xValues->getDate( columnIndex );
1045*cdf0e10cSrcweir 		}
1046*cdf0e10cSrcweir 	}
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1049*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1050*cdf0e10cSrcweir 	return util::Date();
1051*cdf0e10cSrcweir }
1052*cdf0e10cSrcweir 
1053*cdf0e10cSrcweir //=========================================================================
1054*cdf0e10cSrcweir // virtual
1055*cdf0e10cSrcweir util::Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
1056*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1057*cdf0e10cSrcweir {
1058*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1059*cdf0e10cSrcweir 	{
1060*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1061*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1062*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1063*cdf0e10cSrcweir 		if ( xValues.is() )
1064*cdf0e10cSrcweir 		{
1065*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1066*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1067*cdf0e10cSrcweir 			return xValues->getTime( columnIndex );
1068*cdf0e10cSrcweir 		}
1069*cdf0e10cSrcweir 	}
1070*cdf0e10cSrcweir 
1071*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1072*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1073*cdf0e10cSrcweir 	return util::Time();
1074*cdf0e10cSrcweir }
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir //=========================================================================
1077*cdf0e10cSrcweir // virtual
1078*cdf0e10cSrcweir util::DateTime SAL_CALL
1079*cdf0e10cSrcweir ResultSet::getTimestamp( sal_Int32 columnIndex )
1080*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1081*cdf0e10cSrcweir {
1082*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1083*cdf0e10cSrcweir 	{
1084*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1085*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1086*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1087*cdf0e10cSrcweir 		if ( xValues.is() )
1088*cdf0e10cSrcweir 		{
1089*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1090*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1091*cdf0e10cSrcweir 			return xValues->getTimestamp( columnIndex );
1092*cdf0e10cSrcweir 		}
1093*cdf0e10cSrcweir 	}
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1096*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1097*cdf0e10cSrcweir 	return util::DateTime();
1098*cdf0e10cSrcweir }
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir //=========================================================================
1101*cdf0e10cSrcweir // virtual
1102*cdf0e10cSrcweir uno::Reference< io::XInputStream > SAL_CALL
1103*cdf0e10cSrcweir ResultSet::getBinaryStream( sal_Int32 columnIndex )
1104*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1105*cdf0e10cSrcweir {
1106*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1107*cdf0e10cSrcweir 	{
1108*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1109*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1110*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1111*cdf0e10cSrcweir 		if ( xValues.is() )
1112*cdf0e10cSrcweir 		{
1113*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1114*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1115*cdf0e10cSrcweir 			return xValues->getBinaryStream( columnIndex );
1116*cdf0e10cSrcweir 		}
1117*cdf0e10cSrcweir 	}
1118*cdf0e10cSrcweir 
1119*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1120*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1121*cdf0e10cSrcweir 	return uno::Reference< io::XInputStream >();
1122*cdf0e10cSrcweir }
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir //=========================================================================
1125*cdf0e10cSrcweir // virtual
1126*cdf0e10cSrcweir uno::Reference< io::XInputStream > SAL_CALL
1127*cdf0e10cSrcweir ResultSet::getCharacterStream( sal_Int32 columnIndex )
1128*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1129*cdf0e10cSrcweir {
1130*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1131*cdf0e10cSrcweir 	{
1132*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1133*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1134*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1135*cdf0e10cSrcweir 		if ( xValues.is() )
1136*cdf0e10cSrcweir 		{
1137*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1138*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1139*cdf0e10cSrcweir 			return xValues->getCharacterStream( columnIndex );
1140*cdf0e10cSrcweir 		}
1141*cdf0e10cSrcweir 	}
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1144*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1145*cdf0e10cSrcweir 	return uno::Reference< io::XInputStream >();
1146*cdf0e10cSrcweir }
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir //=========================================================================
1149*cdf0e10cSrcweir // virtual
1150*cdf0e10cSrcweir uno::Any SAL_CALL ResultSet::getObject(
1151*cdf0e10cSrcweir         sal_Int32 columnIndex,
1152*cdf0e10cSrcweir         const uno::Reference< container::XNameAccess >& typeMap )
1153*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1154*cdf0e10cSrcweir {
1155*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1156*cdf0e10cSrcweir 	{
1157*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1158*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1159*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1160*cdf0e10cSrcweir 		if ( xValues.is() )
1161*cdf0e10cSrcweir 		{
1162*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1163*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1164*cdf0e10cSrcweir 			return xValues->getObject( columnIndex, typeMap );
1165*cdf0e10cSrcweir 		}
1166*cdf0e10cSrcweir 	}
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1169*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1170*cdf0e10cSrcweir 	return uno::Any();
1171*cdf0e10cSrcweir }
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir //=========================================================================
1174*cdf0e10cSrcweir // virtual
1175*cdf0e10cSrcweir uno::Reference< sdbc::XRef > SAL_CALL
1176*cdf0e10cSrcweir ResultSet::getRef( sal_Int32 columnIndex )
1177*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1178*cdf0e10cSrcweir {
1179*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1180*cdf0e10cSrcweir 	{
1181*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1182*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1183*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1184*cdf0e10cSrcweir 		if ( xValues.is() )
1185*cdf0e10cSrcweir 		{
1186*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1187*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1188*cdf0e10cSrcweir 			return xValues->getRef( columnIndex );
1189*cdf0e10cSrcweir 		}
1190*cdf0e10cSrcweir 	}
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1193*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1194*cdf0e10cSrcweir 	return uno::Reference< sdbc::XRef >();
1195*cdf0e10cSrcweir }
1196*cdf0e10cSrcweir 
1197*cdf0e10cSrcweir //=========================================================================
1198*cdf0e10cSrcweir // virtual
1199*cdf0e10cSrcweir uno::Reference< sdbc::XBlob > SAL_CALL
1200*cdf0e10cSrcweir ResultSet::getBlob( sal_Int32 columnIndex )
1201*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1202*cdf0e10cSrcweir {
1203*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1204*cdf0e10cSrcweir 	{
1205*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1206*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1207*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1208*cdf0e10cSrcweir 		if ( xValues.is() )
1209*cdf0e10cSrcweir 		{
1210*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1211*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1212*cdf0e10cSrcweir 			return xValues->getBlob( columnIndex );
1213*cdf0e10cSrcweir 		}
1214*cdf0e10cSrcweir 	}
1215*cdf0e10cSrcweir 
1216*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1217*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1218*cdf0e10cSrcweir 	return uno::Reference< sdbc::XBlob >();
1219*cdf0e10cSrcweir }
1220*cdf0e10cSrcweir 
1221*cdf0e10cSrcweir //=========================================================================
1222*cdf0e10cSrcweir // virtual
1223*cdf0e10cSrcweir uno::Reference< sdbc::XClob > SAL_CALL
1224*cdf0e10cSrcweir ResultSet::getClob( sal_Int32 columnIndex )
1225*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1226*cdf0e10cSrcweir {
1227*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1228*cdf0e10cSrcweir 	{
1229*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1230*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1231*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1232*cdf0e10cSrcweir 		if ( xValues.is() )
1233*cdf0e10cSrcweir 		{
1234*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1235*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1236*cdf0e10cSrcweir 			return xValues->getClob( columnIndex );
1237*cdf0e10cSrcweir 		}
1238*cdf0e10cSrcweir 	}
1239*cdf0e10cSrcweir 
1240*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1241*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1242*cdf0e10cSrcweir 	return uno::Reference< sdbc::XClob >();
1243*cdf0e10cSrcweir }
1244*cdf0e10cSrcweir 
1245*cdf0e10cSrcweir //=========================================================================
1246*cdf0e10cSrcweir // virtual
1247*cdf0e10cSrcweir uno::Reference< sdbc::XArray > SAL_CALL
1248*cdf0e10cSrcweir ResultSet::getArray( sal_Int32 columnIndex )
1249*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1250*cdf0e10cSrcweir {
1251*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1252*cdf0e10cSrcweir 	{
1253*cdf0e10cSrcweir 		uno::Reference< sdbc::XRow > xValues
1254*cdf0e10cSrcweir 			= m_pImpl->m_xDataSupplier->queryPropertyValues(
1255*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1256*cdf0e10cSrcweir 		if ( xValues.is() )
1257*cdf0e10cSrcweir 		{
1258*cdf0e10cSrcweir 			m_pImpl->m_bWasNull = sal_False;
1259*cdf0e10cSrcweir 			m_pImpl->m_xDataSupplier->validate();
1260*cdf0e10cSrcweir 			return xValues->getArray( columnIndex );
1261*cdf0e10cSrcweir 		}
1262*cdf0e10cSrcweir 	}
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir 	m_pImpl->m_bWasNull = sal_True;
1265*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1266*cdf0e10cSrcweir 	return uno::Reference< sdbc::XArray >();
1267*cdf0e10cSrcweir }
1268*cdf0e10cSrcweir 
1269*cdf0e10cSrcweir //=========================================================================
1270*cdf0e10cSrcweir //
1271*cdf0e10cSrcweir // XCloseable methods.
1272*cdf0e10cSrcweir //
1273*cdf0e10cSrcweir //=========================================================================
1274*cdf0e10cSrcweir 
1275*cdf0e10cSrcweir // virtual
1276*cdf0e10cSrcweir void SAL_CALL ResultSet::close()
1277*cdf0e10cSrcweir 	throw( sdbc::SQLException, uno::RuntimeException )
1278*cdf0e10cSrcweir {
1279*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->close();
1280*cdf0e10cSrcweir 	m_pImpl->m_xDataSupplier->validate();
1281*cdf0e10cSrcweir }
1282*cdf0e10cSrcweir 
1283*cdf0e10cSrcweir //=========================================================================
1284*cdf0e10cSrcweir //
1285*cdf0e10cSrcweir // XContentAccess methods.
1286*cdf0e10cSrcweir //
1287*cdf0e10cSrcweir //=========================================================================
1288*cdf0e10cSrcweir 
1289*cdf0e10cSrcweir // virtual
1290*cdf0e10cSrcweir rtl::OUString SAL_CALL ResultSet::queryContentIdentifierString()
1291*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1292*cdf0e10cSrcweir {
1293*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1294*cdf0e10cSrcweir 		return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
1295*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1296*cdf0e10cSrcweir 
1297*cdf0e10cSrcweir 	return rtl::OUString();
1298*cdf0e10cSrcweir }
1299*cdf0e10cSrcweir 
1300*cdf0e10cSrcweir //=========================================================================
1301*cdf0e10cSrcweir // virtual
1302*cdf0e10cSrcweir uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
1303*cdf0e10cSrcweir ResultSet::queryContentIdentifier()
1304*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1305*cdf0e10cSrcweir {
1306*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1307*cdf0e10cSrcweir 		return m_pImpl->m_xDataSupplier->queryContentIdentifier(
1308*cdf0e10cSrcweir 														m_pImpl->m_nPos - 1 );
1309*cdf0e10cSrcweir 
1310*cdf0e10cSrcweir 	return uno::Reference< com::sun::star::ucb::XContentIdentifier >();
1311*cdf0e10cSrcweir }
1312*cdf0e10cSrcweir 
1313*cdf0e10cSrcweir //=========================================================================
1314*cdf0e10cSrcweir // virtual
1315*cdf0e10cSrcweir uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
1316*cdf0e10cSrcweir ResultSet::queryContent()
1317*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1318*cdf0e10cSrcweir {
1319*cdf0e10cSrcweir 	if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
1320*cdf0e10cSrcweir 		return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
1321*cdf0e10cSrcweir 
1322*cdf0e10cSrcweir 	return uno::Reference< com::sun::star::ucb::XContent >();
1323*cdf0e10cSrcweir }
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir //=========================================================================
1326*cdf0e10cSrcweir //
1327*cdf0e10cSrcweir // XPropertySet methods.
1328*cdf0e10cSrcweir //
1329*cdf0e10cSrcweir //=========================================================================
1330*cdf0e10cSrcweir 
1331*cdf0e10cSrcweir // virtual
1332*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL
1333*cdf0e10cSrcweir ResultSet::getPropertySetInfo()
1334*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1335*cdf0e10cSrcweir {
1336*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir 	if ( !m_pImpl->m_xPropSetInfo.is() )
1339*cdf0e10cSrcweir 		m_pImpl->m_xPropSetInfo
1340*cdf0e10cSrcweir 			= new PropertySetInfo( m_pImpl->m_xSMgr,
1341*cdf0e10cSrcweir 								   aPropertyTable,
1342*cdf0e10cSrcweir 								   RESULTSET_PROPERTY_COUNT );
1343*cdf0e10cSrcweir 	return m_pImpl->m_xPropSetInfo;
1344*cdf0e10cSrcweir }
1345*cdf0e10cSrcweir 
1346*cdf0e10cSrcweir //=========================================================================
1347*cdf0e10cSrcweir // virtual
1348*cdf0e10cSrcweir void SAL_CALL ResultSet::setPropertyValue( const rtl::OUString& aPropertyName,
1349*cdf0e10cSrcweir 										   const uno::Any& )
1350*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1351*cdf0e10cSrcweir 		   beans::PropertyVetoException,
1352*cdf0e10cSrcweir 		   lang::IllegalArgumentException,
1353*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1354*cdf0e10cSrcweir 		   uno::RuntimeException )
1355*cdf0e10cSrcweir {
1356*cdf0e10cSrcweir 	if ( !aPropertyName.getLength() )
1357*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1358*cdf0e10cSrcweir 
1359*cdf0e10cSrcweir 	if ( aPropertyName.equals(
1360*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "RowCount" ) ) )
1361*cdf0e10cSrcweir 	{
1362*cdf0e10cSrcweir 		// property is read-only.
1363*cdf0e10cSrcweir 		throw lang::IllegalArgumentException();
1364*cdf0e10cSrcweir 	}
1365*cdf0e10cSrcweir 	else if ( aPropertyName.equals(
1366*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
1367*cdf0e10cSrcweir 	{
1368*cdf0e10cSrcweir 		// property is read-only.
1369*cdf0e10cSrcweir 		throw lang::IllegalArgumentException();
1370*cdf0e10cSrcweir 	}
1371*cdf0e10cSrcweir 	else
1372*cdf0e10cSrcweir 	{
1373*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1374*cdf0e10cSrcweir 	}
1375*cdf0e10cSrcweir }
1376*cdf0e10cSrcweir 
1377*cdf0e10cSrcweir //=========================================================================
1378*cdf0e10cSrcweir // virtual
1379*cdf0e10cSrcweir uno::Any SAL_CALL ResultSet::getPropertyValue(
1380*cdf0e10cSrcweir         const rtl::OUString& PropertyName )
1381*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1382*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1383*cdf0e10cSrcweir 		   uno::RuntimeException )
1384*cdf0e10cSrcweir {
1385*cdf0e10cSrcweir 	if ( !PropertyName.getLength() )
1386*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1387*cdf0e10cSrcweir 
1388*cdf0e10cSrcweir 	uno::Any aValue;
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir 	if ( PropertyName.equals(
1391*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "RowCount" ) ) )
1392*cdf0e10cSrcweir 	{
1393*cdf0e10cSrcweir 		aValue <<= m_pImpl->m_xDataSupplier->currentCount();
1394*cdf0e10cSrcweir 	}
1395*cdf0e10cSrcweir 	else if ( PropertyName.equals(
1396*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
1397*cdf0e10cSrcweir 	{
1398*cdf0e10cSrcweir 		aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
1399*cdf0e10cSrcweir 	}
1400*cdf0e10cSrcweir 	else
1401*cdf0e10cSrcweir 	{
1402*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1403*cdf0e10cSrcweir 	}
1404*cdf0e10cSrcweir 
1405*cdf0e10cSrcweir 	return aValue;
1406*cdf0e10cSrcweir }
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir //=========================================================================
1409*cdf0e10cSrcweir // virtual
1410*cdf0e10cSrcweir void SAL_CALL ResultSet::addPropertyChangeListener(
1411*cdf0e10cSrcweir         const rtl::OUString& aPropertyName,
1412*cdf0e10cSrcweir         const uno::Reference< beans::XPropertyChangeListener >& xListener )
1413*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1414*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1415*cdf0e10cSrcweir 		   uno::RuntimeException )
1416*cdf0e10cSrcweir {
1417*cdf0e10cSrcweir 	// Note: An empty property name means a listener for "all" properties.
1418*cdf0e10cSrcweir 
1419*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1420*cdf0e10cSrcweir 
1421*cdf0e10cSrcweir 	if ( aPropertyName.getLength() &&
1422*cdf0e10cSrcweir 	     !aPropertyName.equals(
1423*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "RowCount" ) ) &&
1424*cdf0e10cSrcweir 		 !aPropertyName.equals(
1425*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
1426*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1427*cdf0e10cSrcweir 
1428*cdf0e10cSrcweir 	if ( !m_pImpl->m_pPropertyChangeListeners )
1429*cdf0e10cSrcweir 		m_pImpl->m_pPropertyChangeListeners
1430*cdf0e10cSrcweir 			= new PropertyChangeListeners( m_pImpl->m_aMutex );
1431*cdf0e10cSrcweir 
1432*cdf0e10cSrcweir 	m_pImpl->m_pPropertyChangeListeners->addInterface(
1433*cdf0e10cSrcweir 												aPropertyName, xListener );
1434*cdf0e10cSrcweir }
1435*cdf0e10cSrcweir 
1436*cdf0e10cSrcweir //=========================================================================
1437*cdf0e10cSrcweir // virtual
1438*cdf0e10cSrcweir void SAL_CALL ResultSet::removePropertyChangeListener(
1439*cdf0e10cSrcweir         const rtl::OUString& aPropertyName,
1440*cdf0e10cSrcweir 		const uno::Reference< beans::XPropertyChangeListener >& xListener )
1441*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1442*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1443*cdf0e10cSrcweir 		   uno::RuntimeException )
1444*cdf0e10cSrcweir {
1445*cdf0e10cSrcweir 	osl::MutexGuard aGuard( m_pImpl->m_aMutex );
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir 	if ( aPropertyName.getLength() &&
1448*cdf0e10cSrcweir 	     !aPropertyName.equals(
1449*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "RowCount" ) ) &&
1450*cdf0e10cSrcweir 		 !aPropertyName.equals(
1451*cdf0e10cSrcweir 				rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
1452*cdf0e10cSrcweir 		throw beans::UnknownPropertyException();
1453*cdf0e10cSrcweir 
1454*cdf0e10cSrcweir 	if ( m_pImpl->m_pPropertyChangeListeners )
1455*cdf0e10cSrcweir 		m_pImpl->m_pPropertyChangeListeners->removeInterface(
1456*cdf0e10cSrcweir 													aPropertyName, xListener );
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir }
1459*cdf0e10cSrcweir 
1460*cdf0e10cSrcweir //=========================================================================
1461*cdf0e10cSrcweir // virtual
1462*cdf0e10cSrcweir void SAL_CALL ResultSet::addVetoableChangeListener(
1463*cdf0e10cSrcweir         const rtl::OUString&,
1464*cdf0e10cSrcweir         const uno::Reference< beans::XVetoableChangeListener >& )
1465*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1466*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1467*cdf0e10cSrcweir 		   uno::RuntimeException )
1468*cdf0e10cSrcweir {
1469*cdf0e10cSrcweir 	//	No constrained props, at the moment.
1470*cdf0e10cSrcweir }
1471*cdf0e10cSrcweir 
1472*cdf0e10cSrcweir //=========================================================================
1473*cdf0e10cSrcweir // virtual
1474*cdf0e10cSrcweir void SAL_CALL ResultSet::removeVetoableChangeListener(
1475*cdf0e10cSrcweir         const rtl::OUString&,
1476*cdf0e10cSrcweir         const uno::Reference< beans::XVetoableChangeListener >& )
1477*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException,
1478*cdf0e10cSrcweir 		   lang::WrappedTargetException,
1479*cdf0e10cSrcweir 		   uno::RuntimeException )
1480*cdf0e10cSrcweir {
1481*cdf0e10cSrcweir 	//	No constrained props, at the moment.
1482*cdf0e10cSrcweir }
1483*cdf0e10cSrcweir 
1484*cdf0e10cSrcweir //=========================================================================
1485*cdf0e10cSrcweir //
1486*cdf0e10cSrcweir // Non-interface methods.
1487*cdf0e10cSrcweir //
1488*cdf0e10cSrcweir //=========================================================================
1489*cdf0e10cSrcweir 
1490*cdf0e10cSrcweir void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt )
1491*cdf0e10cSrcweir {
1492*cdf0e10cSrcweir 	if ( !m_pImpl->m_pPropertyChangeListeners )
1493*cdf0e10cSrcweir 		return;
1494*cdf0e10cSrcweir 
1495*cdf0e10cSrcweir 	// Notify listeners interested especially in the changed property.
1496*cdf0e10cSrcweir 	cppu::OInterfaceContainerHelper* pPropsContainer
1497*cdf0e10cSrcweir 		= m_pImpl->m_pPropertyChangeListeners->getContainer(
1498*cdf0e10cSrcweir 														rEvt.PropertyName );
1499*cdf0e10cSrcweir 	if ( pPropsContainer )
1500*cdf0e10cSrcweir 	{
1501*cdf0e10cSrcweir 		cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
1502*cdf0e10cSrcweir 		while ( aIter.hasMoreElements() )
1503*cdf0e10cSrcweir 		{
1504*cdf0e10cSrcweir 			uno::Reference< beans::XPropertyChangeListener > xListener(
1505*cdf0e10cSrcweir                 aIter.next(), uno::UNO_QUERY );
1506*cdf0e10cSrcweir 			if ( xListener.is() )
1507*cdf0e10cSrcweir 				xListener->propertyChange( rEvt );
1508*cdf0e10cSrcweir 		}
1509*cdf0e10cSrcweir 	}
1510*cdf0e10cSrcweir 
1511*cdf0e10cSrcweir 	// Notify listeners interested in all properties.
1512*cdf0e10cSrcweir 	pPropsContainer
1513*cdf0e10cSrcweir 		= m_pImpl->m_pPropertyChangeListeners->getContainer( rtl::OUString() );
1514*cdf0e10cSrcweir 	if ( pPropsContainer )
1515*cdf0e10cSrcweir 	{
1516*cdf0e10cSrcweir 		cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
1517*cdf0e10cSrcweir 		while ( aIter.hasMoreElements() )
1518*cdf0e10cSrcweir 		{
1519*cdf0e10cSrcweir 			uno::Reference< beans::XPropertyChangeListener > xListener(
1520*cdf0e10cSrcweir                 aIter.next(), uno::UNO_QUERY );
1521*cdf0e10cSrcweir 			if ( xListener.is() )
1522*cdf0e10cSrcweir 				xListener->propertyChange( rEvt );
1523*cdf0e10cSrcweir 		}
1524*cdf0e10cSrcweir 	}
1525*cdf0e10cSrcweir }
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir //=========================================================================
1528*cdf0e10cSrcweir void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
1529*cdf0e10cSrcweir {
1530*cdf0e10cSrcweir 	OSL_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir 	if ( !m_pImpl->m_pPropertyChangeListeners )
1533*cdf0e10cSrcweir 		return;
1534*cdf0e10cSrcweir 
1535*cdf0e10cSrcweir 	propertyChanged(
1536*cdf0e10cSrcweir 		beans::PropertyChangeEvent(
1537*cdf0e10cSrcweir             static_cast< cppu::OWeakObject * >( this ),
1538*cdf0e10cSrcweir             rtl::OUString::createFromAscii( "RowCount" ),
1539*cdf0e10cSrcweir             sal_False,
1540*cdf0e10cSrcweir             1001,
1541*cdf0e10cSrcweir             uno::makeAny( nOld ),	  // old value
1542*cdf0e10cSrcweir             uno::makeAny( nNew ) ) ); // new value
1543*cdf0e10cSrcweir }
1544*cdf0e10cSrcweir 
1545*cdf0e10cSrcweir //=========================================================================
1546*cdf0e10cSrcweir void ResultSet::rowCountFinal()
1547*cdf0e10cSrcweir {
1548*cdf0e10cSrcweir 	if ( !m_pImpl->m_pPropertyChangeListeners )
1549*cdf0e10cSrcweir 		return;
1550*cdf0e10cSrcweir 
1551*cdf0e10cSrcweir 	propertyChanged(
1552*cdf0e10cSrcweir 		beans::PropertyChangeEvent(
1553*cdf0e10cSrcweir             static_cast< cppu::OWeakObject * >( this ),
1554*cdf0e10cSrcweir             rtl::OUString::createFromAscii( "IsRowCountFinal" ),
1555*cdf0e10cSrcweir             sal_False,
1556*cdf0e10cSrcweir             1000,
1557*cdf0e10cSrcweir 			uno:: makeAny( sal_False ),	  // old value
1558*cdf0e10cSrcweir             uno::makeAny( sal_True ) ) ); // new value
1559*cdf0e10cSrcweir }
1560*cdf0e10cSrcweir 
1561*cdf0e10cSrcweir //=========================================================================
1562*cdf0e10cSrcweir const uno::Sequence< beans::Property >&	ResultSet::getProperties()
1563*cdf0e10cSrcweir {
1564*cdf0e10cSrcweir 	return m_pImpl->m_aProperties;
1565*cdf0e10cSrcweir }
1566*cdf0e10cSrcweir 
1567*cdf0e10cSrcweir //=========================================================================
1568*cdf0e10cSrcweir const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
1569*cdf0e10cSrcweir ResultSet::getEnvironment()
1570*cdf0e10cSrcweir {
1571*cdf0e10cSrcweir 	return m_pImpl->m_xEnv;
1572*cdf0e10cSrcweir }
1573*cdf0e10cSrcweir 
1574*cdf0e10cSrcweir } // namespace ucbhelper
1575*cdf0e10cSrcweir 
1576*cdf0e10cSrcweir namespace ucbhelper_impl {
1577*cdf0e10cSrcweir 
1578*cdf0e10cSrcweir //=========================================================================
1579*cdf0e10cSrcweir //=========================================================================
1580*cdf0e10cSrcweir //
1581*cdf0e10cSrcweir // PropertySetInfo Implementation.
1582*cdf0e10cSrcweir //
1583*cdf0e10cSrcweir //=========================================================================
1584*cdf0e10cSrcweir //=========================================================================
1585*cdf0e10cSrcweir 
1586*cdf0e10cSrcweir PropertySetInfo::PropertySetInfo(
1587*cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
1588*cdf0e10cSrcweir     const PropertyInfo* pProps,
1589*cdf0e10cSrcweir     sal_Int32 nProps )
1590*cdf0e10cSrcweir : m_xSMgr( rxSMgr )
1591*cdf0e10cSrcweir {
1592*cdf0e10cSrcweir 	m_pProps = new uno::Sequence< beans::Property >( nProps );
1593*cdf0e10cSrcweir 
1594*cdf0e10cSrcweir 	if ( nProps )
1595*cdf0e10cSrcweir 	{
1596*cdf0e10cSrcweir 		const PropertyInfo* pEntry = pProps;
1597*cdf0e10cSrcweir 		beans::Property* pProperties = m_pProps->getArray();
1598*cdf0e10cSrcweir 
1599*cdf0e10cSrcweir 		for ( sal_Int32 n = 0; n < nProps; ++n )
1600*cdf0e10cSrcweir 		{
1601*cdf0e10cSrcweir 			beans::Property& rProp = pProperties[ n ];
1602*cdf0e10cSrcweir 
1603*cdf0e10cSrcweir 			rProp.Name		 = rtl::OUString::createFromAscii( pEntry->pName );
1604*cdf0e10cSrcweir     		rProp.Handle	 = pEntry->nHandle;
1605*cdf0e10cSrcweir     		rProp.Type		 = pEntry->pGetCppuType();
1606*cdf0e10cSrcweir     		rProp.Attributes = pEntry->nAttributes;
1607*cdf0e10cSrcweir 
1608*cdf0e10cSrcweir 			pEntry++;
1609*cdf0e10cSrcweir 		}
1610*cdf0e10cSrcweir 	}
1611*cdf0e10cSrcweir }
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir //=========================================================================
1614*cdf0e10cSrcweir // virtual
1615*cdf0e10cSrcweir PropertySetInfo::~PropertySetInfo()
1616*cdf0e10cSrcweir {
1617*cdf0e10cSrcweir 	delete m_pProps;
1618*cdf0e10cSrcweir }
1619*cdf0e10cSrcweir 
1620*cdf0e10cSrcweir //=========================================================================
1621*cdf0e10cSrcweir //
1622*cdf0e10cSrcweir // XInterface methods.
1623*cdf0e10cSrcweir //
1624*cdf0e10cSrcweir //=========================================================================
1625*cdf0e10cSrcweir 
1626*cdf0e10cSrcweir XINTERFACE_IMPL_2( PropertySetInfo,
1627*cdf0e10cSrcweir 				   lang::XTypeProvider,
1628*cdf0e10cSrcweir 				   beans::XPropertySetInfo );
1629*cdf0e10cSrcweir 
1630*cdf0e10cSrcweir //=========================================================================
1631*cdf0e10cSrcweir //
1632*cdf0e10cSrcweir // XTypeProvider methods.
1633*cdf0e10cSrcweir //
1634*cdf0e10cSrcweir //=========================================================================
1635*cdf0e10cSrcweir 
1636*cdf0e10cSrcweir XTYPEPROVIDER_IMPL_2( PropertySetInfo,
1637*cdf0e10cSrcweir 				   	  lang::XTypeProvider,
1638*cdf0e10cSrcweir 				   	  beans::XPropertySetInfo );
1639*cdf0e10cSrcweir 
1640*cdf0e10cSrcweir //=========================================================================
1641*cdf0e10cSrcweir //
1642*cdf0e10cSrcweir // XPropertySetInfo methods.
1643*cdf0e10cSrcweir //
1644*cdf0e10cSrcweir //=========================================================================
1645*cdf0e10cSrcweir 
1646*cdf0e10cSrcweir // virtual
1647*cdf0e10cSrcweir uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
1648*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1649*cdf0e10cSrcweir {
1650*cdf0e10cSrcweir 	return uno::Sequence< beans::Property >( *m_pProps );
1651*cdf0e10cSrcweir }
1652*cdf0e10cSrcweir 
1653*cdf0e10cSrcweir //=========================================================================
1654*cdf0e10cSrcweir // virtual
1655*cdf0e10cSrcweir beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
1656*cdf0e10cSrcweir         const rtl::OUString& aName )
1657*cdf0e10cSrcweir 	throw( beans::UnknownPropertyException, uno::RuntimeException )
1658*cdf0e10cSrcweir {
1659*cdf0e10cSrcweir 	beans::Property aProp;
1660*cdf0e10cSrcweir 	if ( queryProperty( aName, aProp ) )
1661*cdf0e10cSrcweir 		return aProp;
1662*cdf0e10cSrcweir 
1663*cdf0e10cSrcweir 	throw beans::UnknownPropertyException();
1664*cdf0e10cSrcweir }
1665*cdf0e10cSrcweir 
1666*cdf0e10cSrcweir //=========================================================================
1667*cdf0e10cSrcweir // virtual
1668*cdf0e10cSrcweir sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
1669*cdf0e10cSrcweir         const rtl::OUString& Name )
1670*cdf0e10cSrcweir 	throw( uno::RuntimeException )
1671*cdf0e10cSrcweir {
1672*cdf0e10cSrcweir 	beans::Property aProp;
1673*cdf0e10cSrcweir 	return queryProperty( Name, aProp );
1674*cdf0e10cSrcweir }
1675*cdf0e10cSrcweir 
1676*cdf0e10cSrcweir //=========================================================================
1677*cdf0e10cSrcweir sal_Bool PropertySetInfo::queryProperty(
1678*cdf0e10cSrcweir     const rtl::OUString& aName, beans::Property& rProp )
1679*cdf0e10cSrcweir {
1680*cdf0e10cSrcweir 	sal_Int32 nCount = m_pProps->getLength();
1681*cdf0e10cSrcweir 	const beans::Property* pProps = m_pProps->getConstArray();
1682*cdf0e10cSrcweir 	for ( sal_Int32 n = 0; n < nCount; ++n )
1683*cdf0e10cSrcweir 	{
1684*cdf0e10cSrcweir 		const beans::Property& rCurr = pProps[ n ];
1685*cdf0e10cSrcweir 		if ( rCurr.Name == aName )
1686*cdf0e10cSrcweir 		{
1687*cdf0e10cSrcweir 			rProp = rCurr;
1688*cdf0e10cSrcweir 			return sal_True;
1689*cdf0e10cSrcweir 		}
1690*cdf0e10cSrcweir 	}
1691*cdf0e10cSrcweir 
1692*cdf0e10cSrcweir 	return sal_False;
1693*cdf0e10cSrcweir }
1694*cdf0e10cSrcweir 
1695*cdf0e10cSrcweir } // namespace ucbhelper_impl
1696