Line data Source code
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 : #ifndef DBACCESS_CORE_API_ROWSET_HXX
21 : #define DBACCESS_CORE_API_ROWSET_HXX
22 :
23 : #include "apitools.hxx"
24 : #include "RowSetBase.hxx"
25 :
26 : #include <com/sun/star/sdbc/XPreparedStatement.hpp>
27 : #include <com/sun/star/sdbc/XConnection.hpp>
28 : #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
29 : #include <com/sun/star/sdb/XResultSetAccess.hpp>
30 : #include <com/sun/star/sdbc/XRowSetListener.hpp>
31 : #include <com/sun/star/sdbc/XRowUpdate.hpp>
32 : #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
33 : #include <com/sun/star/sdbc/XParameters.hpp>
34 : #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
35 : #include <com/sun/star/sdbc/ResultSetType.hpp>
36 : #include <com/sun/star/util/XCancellable.hpp>
37 : #include <com/sun/star/sdbcx/XDeleteRows.hpp>
38 : #include <com/sun/star/sdb/XCompletedExecution.hpp>
39 : #include <com/sun/star/sdb/RowSetVetoException.hpp>
40 : #include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
41 : #include <com/sun/star/sdb/XParametersSupplier.hpp>
42 : #include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp>
43 :
44 : #include <cppuhelper/compbase12.hxx>
45 : #include <connectivity/paramwrapper.hxx>
46 : #include <connectivity/FValue.hxx>
47 : #include <connectivity/warningscontainer.hxx>
48 :
49 : namespace dbaccess
50 : {
51 : typedef ::cppu::WeakAggComponentImplHelper12 < ::com::sun::star::sdb::XResultSetAccess
52 : , ::com::sun::star::sdb::XRowSetApproveBroadcaster
53 : , ::com::sun::star::sdb::XRowsChangeBroadcaster
54 : , ::com::sun::star::sdbcx::XDeleteRows
55 : , ::com::sun::star::sdbc::XParameters
56 : , ::com::sun::star::lang::XEventListener
57 : , ::com::sun::star::sdbc::XResultSetUpdate
58 : , ::com::sun::star::sdbc::XRowUpdate
59 : , ::com::sun::star::util::XCancellable
60 : , ::com::sun::star::sdb::XCompletedExecution
61 : , ::com::sun::star::sdb::XParametersSupplier
62 : , ::com::sun::star::sdbc::XWarningsSupplier
63 : > ORowSet_BASE1;
64 :
65 : class OTableContainer;
66 : class ORowSet : public comphelper::OBaseMutex
67 : , public ORowSet_BASE1
68 : , public ORowSetBase
69 : , public ::comphelper::OPropertyArrayUsageHelper<ORowSet>
70 : {
71 : friend class ORowSetClone;
72 :
73 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xOldConnection;
74 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xActiveConnection;
75 : ::com::sun::star::uno::Any m_aActiveConnection;
76 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTypeMap;
77 : ::com::sun::star::uno::Any m_aTypeMap;
78 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > m_xStatement;
79 : ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer;
80 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; // the columns from a table or query
81 :
82 : connectivity::OWeakRefArray m_aClones;
83 : /** our parameters as XPropertySet instances and ORowSetValue instances
84 : */
85 : ::dbtools::param::ParametersContainerRef m_pParameters;
86 : /** our parameters values, used when we do not yet have a parameters container
87 : (since we have not been executed, yet)
88 : */
89 : ORowSetValueVector m_aPrematureParamValues;
90 : ORowSetValueVector m_aParameterValueForCache;
91 : ::std::vector<bool> m_aParametersSet;
92 : ::std::vector<bool> m_aReadOnlyDataColumns;
93 :
94 : ::cppu::OInterfaceContainerHelper m_aRowsetListeners;
95 : ::cppu::OInterfaceContainerHelper m_aApproveListeners;
96 : ::cppu::OInterfaceContainerHelper m_aRowsChangeListener;
97 :
98 : ::dbtools::WarningsContainer m_aWarnings;
99 :
100 : OTableContainer* m_pTables;
101 :
102 : rtl::OUString m_aCommand;
103 : rtl::OUString m_aDataSourceName;
104 : rtl::OUString m_aURL;
105 : rtl::OUString m_aUser;
106 : rtl::OUString m_aPassword;
107 : rtl::OUString m_aFilter;
108 : rtl::OUString m_aHavingClause;
109 : rtl::OUString m_aGroupBy;
110 : rtl::OUString m_aOrder;
111 : rtl::OUString m_aActiveCommand;
112 : rtl::OUString m_aCursorName;
113 : rtl::OUString m_aUpdateCatalogName; // is set by a query
114 : rtl::OUString m_aUpdateSchemaName; // is set by a query
115 : rtl::OUString m_aUpdateTableName; // is set by a query
116 :
117 : sal_Int32 m_nFetchDirection;
118 : sal_Int32 m_nFetchSize;
119 : sal_Int32 m_nMaxFieldSize;
120 : sal_Int32 m_nMaxRows;
121 : sal_Int32 m_nQueryTimeOut;
122 : sal_Int32 m_nCommandType;
123 : sal_Int32 m_nTransactionIsolation;
124 : sal_Int32 m_nPrivileges;
125 : sal_Int32 m_nLastKnownRowCount;
126 : oslInterlockedCount m_nInAppend;
127 : sal_Bool m_bLastKnownRowCountFinal;
128 : sal_Bool m_bUseEscapeProcessing ;
129 : sal_Bool m_bApplyFilter ;
130 : sal_Bool m_bCommandFacetsDirty; // any of the facets which define the active command is dirty
131 : sal_Bool m_bModified ;
132 : sal_Bool m_bRebuildConnOnExecute ;
133 : sal_Bool m_bIsBookmarkable ;
134 : sal_Bool m_bNew ;
135 : sal_Bool m_bCanUpdateInsertedRows;
136 : sal_Bool m_bOwnConnection;
137 : sal_Bool m_bPropChangeNotifyEnabled;
138 :
139 : private:
140 : /** builds m_aActiveCommand from our settings
141 :
142 : @return
143 : whether we should use escape processing before executing the actual command. This is determined
144 : from our own EscapeProcessing property, and possibly overruled by the respective property
145 : of a query we're based on.
146 : */
147 : sal_Bool impl_buildActiveCommand_throw();
148 :
149 : /** initializes our query composer, and everything which has to do with it
150 :
151 : If we don't use escape processing, then we don't have a composer, and everything
152 : related to it. Nonetheless, _out_rCommandToExecute and the return value are properly
153 : initialized.
154 :
155 : @param _out_rCommandToExecute
156 : The command which is to be executed, according to the current settings -
157 : it is built from our active command plus our current filter/order criterions.
158 :
159 : @return
160 : whether we should use escape processing before executing the actual command. This is determined
161 : from our own EscapeProcessing property, and possibly overruled by the respective property
162 : of a query we're based on.
163 : Effectively, this value determines whether or not we actually have an composer (m_xComposer)
164 : and dependent information (such as the parameters container).
165 :
166 : @precond
167 : m_xActiveConnection points to a valid SDB-level connection
168 :
169 : @throws com::sun::star::sdb::SQLException
170 : if an database-related error occurred
171 :
172 : @throws com::sun::star::uno::RuntimeException
173 : if any of the components involved throws a com::sun::star::uno::RuntimeException
174 : */
175 : sal_Bool impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecute );
176 :
177 : /** returns the table container of our active connection
178 :
179 : If our connection is able to provide a tables container, this one is returned.
180 : Else, if m_pTables is not <NULL/>, this one will returned.
181 : Else, m_pTables will be constructed and returned.
182 :
183 : @precond m_xActiveConnection is not <NULL/>
184 : @throws ::com::sun::star::sdbc::SQLException
185 : if retrieving or constructing the tables container goes wrong
186 :
187 : @see impl_resetTables_nothrow
188 : */
189 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
190 : impl_getTables_throw();
191 :
192 : /** cleans up m_pTables, and resets it to <NULL/>
193 : */
194 : void impl_resetTables_nothrow();
195 :
196 : /** prepares and executes our command
197 : */
198 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
199 : impl_prepareAndExecute_throw();
200 :
201 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > calcConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
202 : // free clones and ParseTree. Plus, if _bComplete is <TRUE/>, *all* other associated resources
203 : void freeResources( bool _bComplete );
204 :
205 : /// informs the clones (and ourself) that we are going to delete a record with a given bookmark
206 : void notifyRowSetAndClonesRowDelete( const ::com::sun::star::uno::Any& _rBookmark );
207 :
208 : /// inform the clones (and ourself) that we have deleted a record with a given bookmark
209 : void notifyRowSetAndClonesRowDeleted( const ::com::sun::star::uno::Any& _rBookmark, sal_Int32 _nPos );
210 :
211 : void checkUpdateIterator();
212 : const connectivity::ORowSetValue& getInsertValue(sal_Int32 columnIndex);
213 : void setParameter(sal_Int32 parameterIndex, const connectivity::ORowSetValue& x);
214 : // resizes the parameter vector if necessary
215 : ::connectivity::ORowSetValue& getParameterStorage( sal_Int32 parameterIndex );
216 :
217 : void updateValue(sal_Int32 columnIndex,const connectivity::ORowSetValue& x);
218 : void checkUpdateConditions(sal_Int32 columnIndex);
219 : void impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard);
220 : // set all data columns to writeable
221 : void impl_setDataColumnsWriteable_throw();
222 : // restore the old state of the data column read-only state
223 : void impl_restoreDataColumnsWriteable_throw();
224 :
225 : protected:
226 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
227 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const;
228 : virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
229 :
230 : virtual void fireRowcount();
231 : void notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowChangeEvent &rEvt);
232 : void notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowsChangeEvent& rEvt);
233 : virtual sal_Bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard);
234 : virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard);
235 : virtual void notifyAllListeners(::osl::ResettableMutexGuard& _rGuard);
236 :
237 : virtual void doCancelModification( );
238 : virtual sal_Bool isModification( );
239 : virtual sal_Bool isModified( );
240 : virtual sal_Bool isNew( );
241 : virtual sal_Bool isPropertyChangeNotificationEnabled() const;
242 :
243 : virtual ~ORowSet();
244 :
245 : public:
246 : ORowSet(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
247 :
248 : // com::sun::star::lang::XTypeProvider
249 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
250 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
251 :
252 : // com::sun::star::uno::XInterface
253 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
254 : virtual void SAL_CALL acquire() throw();
255 : virtual void SAL_CALL release() throw();
256 :
257 : // com::sun::star::lang::XUnoTunnel
258 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
259 :
260 : // com::sun::star::uno::XAggregation
261 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
262 :
263 : // ::com::sun::star::lang::XServiceInfo
264 : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
265 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
266 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
267 :
268 : // ::com::sun::star::lang::XServiceInfo - static methods
269 : static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
270 : static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
271 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
272 : SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
273 :
274 : // OComponentHelper
275 : virtual void SAL_CALL disposing(void);
276 :
277 : // ::com::sun::star::lang::XEventListener
278 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
279 :
280 : // ::com::sun::star::sdbc::XCloseable
281 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
282 :
283 : // comphelper::OPropertyArrayUsageHelper
284 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
285 :
286 : // cppu::OPropertySetHelper
287 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
288 :
289 : // ::com::sun::star::sdbc::XResultSet
290 : virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
291 : virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
292 :
293 : // XCompletedExecution
294 : virtual void SAL_CALL executeWithCompletion( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& handler ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
295 :
296 : // XParametersSupplier
297 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getParameters( ) throw (::com::sun::star::uno::RuntimeException);
298 :
299 : // ::com::sun::star::sdbc::XRow
300 : virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
301 : virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
302 : virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
303 : virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
304 : virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
305 : virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
306 : virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
307 : virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
308 : virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
309 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
310 : virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
311 : virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
312 : virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
313 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
314 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
315 : virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
316 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
317 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
318 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
319 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
320 :
321 : // ::com::sun::star::sdbc::XRowUpdate
322 : virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
323 : virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
324 : virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
325 : virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
326 : virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
327 : virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
328 : virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
329 : virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
330 : virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
331 : virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
332 : virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
333 : virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
334 : virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
335 : virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
336 : virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
337 : virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
338 : virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
339 :
340 : // ::com::sun::star::sdbc::XResultSetUpdate
341 : virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
342 : virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
343 : virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
344 : virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
345 : virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
346 : virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
347 :
348 : // ::com::sun::star::sdbc::XRowSet
349 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
350 : virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
351 : virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
352 :
353 : // ::com::sun::star::sdb::XRowSetApproveBroadcaster
354 : virtual void SAL_CALL addRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
355 : virtual void SAL_CALL removeRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
356 :
357 : // ::com::sun::star::sdb::XRowsChangeBroadcaster
358 : virtual void SAL_CALL addRowsChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
359 : virtual void SAL_CALL removeRowsChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
360 :
361 : // ::com::sun::star::sdb::XResultSetAccess
362 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL createResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
363 :
364 : // ::com::sun::star::util::XCancellable
365 : virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
366 :
367 : // ::com::sun::star::sdbcx::XDeleteRows
368 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
369 :
370 : // XParameters
371 : virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
372 : virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
373 : virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
374 : virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
375 : virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
376 : virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
377 : virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
378 : virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
379 : virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
380 : virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
381 : virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
382 : virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
383 : virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
384 : virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
385 : virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
386 : virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
387 : virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
388 : virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
389 : virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
390 : virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
391 : virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
392 : virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
393 : virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
394 :
395 : // XWarningsSupplier
396 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
397 : virtual void SAL_CALL clearWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
398 :
399 : protected:
400 : /** implement the <method>execute</method>, without calling the approve listeners and without building a new
401 : connection
402 : @param _rClearForNotification mutex to clear before doing the final notifications
403 : */
404 : void execute_NoApprove_NoNewConn(::osl::ResettableMutexGuard& _rClearForNotification);
405 :
406 : /** call the RowSetApproveListeners<p/>
407 : throws an RowSetVetoException if one of the listeners vetoed
408 : */
409 : void approveExecution() throw (::com::sun::star::sdb::RowSetVetoException, ::com::sun::star::uno::RuntimeException);
410 :
411 : /// set m_xActiveConnection, fire a PropertyChangeEvent if necessary, do the event listener handling etc
412 : void setActiveConnection( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxNewConn, sal_Bool _bFireEvent = sal_True );
413 :
414 : void implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
415 :
416 : /** sets the given result set type/concurrency at the given statement, while respecting
417 : possibly related data source settings
418 : */
419 : void setStatementResultSetType(
420 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxStatement,
421 : sal_Int32 _nDesiredResultSetType,
422 : sal_Int32 _nDesiredResultSetConcurrency
423 : );
424 :
425 : /** initializes a given RowSet column with the ColumnSettings (width, format, hidden, etc.) from a
426 : template column.
427 :
428 : If the template column supports any of the known column settings, they're plain copied. If not,
429 : the template column is examined for a TableName and Name property, and the table column described
430 : by those is used to find and copy the column settings.
431 : */
432 : void impl_initializeColumnSettings_nothrow(
433 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxTemplateColumn,
434 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRowSetColumn
435 : );
436 :
437 : /** initializes our parameters container (m_pParameters) according to the parameter columns as
438 : obtained from our composer
439 : */
440 : void impl_initParametersContainer_nothrow();
441 : /** disposes our parameters container
442 : */
443 : void impl_disposeParametersContainer_nothrow();
444 :
445 : protected:
446 : using ORowSetBase::getFastPropertyValue;
447 : using ORowSetBase::firePropertyChange;
448 : using ORowSetBase::doCancelModification;
449 : using ORowSetBase::isModification;
450 : using ORowSetBase::isModified;
451 : using ORowSetBase::isNew;
452 : };
453 :
454 :
455 : //************************************************************
456 : // ORowSetClone
457 : //************************************************************
458 : class ORowSetClone : public comphelper::OBaseMutex
459 : ,public OSubComponent
460 : ,public ORowSetBase
461 : ,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone >
462 : {
463 : protected:
464 : ORowSet* m_pParent;
465 : sal_Int32 m_nFetchDirection;
466 : sal_Int32 m_nFetchSize;
467 : sal_Bool m_bIsBookmarkable;
468 :
469 : protected:
470 : // the clone can not insert anything
471 : virtual void doCancelModification( );
472 : virtual sal_Bool isModification( );
473 : virtual sal_Bool isModified( );
474 : virtual sal_Bool isNew( );
475 :
476 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
477 : public:
478 : ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex );
479 : virtual ~ORowSetClone();
480 :
481 : // com::sun::star::lang::XTypeProvider
482 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
483 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException)
484 : {
485 0 : return getUnoTunnelImplementationId();
486 : }
487 :
488 : // com::sun::star::uno::XInterface
489 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
490 : virtual void SAL_CALL acquire() throw();
491 : virtual void SAL_CALL release() throw();
492 :
493 : // ::com::sun::star::lang::XServiceInfo
494 : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
495 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
496 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
497 :
498 : // com::sun::star::lang::XUnoTunnel
499 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
500 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
501 :
502 : // OComponentHelper
503 : virtual void SAL_CALL disposing(void);
504 :
505 : // ::com::sun::star::sdbc::XCloseable
506 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
507 :
508 : // com::sun::star::beans::XPropertySet
509 0 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
510 : {
511 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
512 : }
513 :
514 : // ::com::sun::star::sdbc::XRowSet
515 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
516 : virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
517 : virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException);
518 :
519 : // comphelper::OPropertyArrayUsageHelper
520 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
521 :
522 : // cppu::OPropertySetHelper
523 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
524 :
525 : protected:
526 : using ORowSetBase::doCancelModification;
527 : using ORowSetBase::isModification;
528 : using ORowSetBase::isModified;
529 : using ORowSetBase::isNew;
530 : using ORowSetBase::rowDeleted;
531 : };
532 :
533 : }
534 : #endif // DBACCESS_CORE_API_ROWSET_HXX
535 :
536 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|