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