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