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 INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_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 : OUString m_aCommand;
103 : OUString m_aDataSourceName;
104 : OUString m_aURL;
105 : OUString m_aUser;
106 : OUString m_aPassword;
107 : OUString m_aFilter;
108 : OUString m_aHavingClause;
109 : OUString m_aGroupBy;
110 : OUString m_aOrder;
111 : OUString m_aActiveCommand;
112 : OUString m_aUpdateCatalogName; // is set by a query
113 : OUString m_aUpdateSchemaName; // is set by a query
114 : OUString m_aUpdateTableName; // is set by a query
115 :
116 : sal_Int32 m_nFetchDirection;
117 : sal_Int32 m_nFetchSize;
118 : sal_Int32 m_nMaxFieldSize;
119 : sal_Int32 m_nMaxRows;
120 : sal_Int32 m_nQueryTimeOut;
121 : sal_Int32 m_nCommandType;
122 : sal_Int32 m_nTransactionIsolation;
123 : sal_Int32 m_nPrivileges;
124 : sal_Int32 m_nLastKnownRowCount;
125 : oslInterlockedCount m_nInAppend;
126 : bool m_bLastKnownRowCountFinal;
127 : bool m_bUseEscapeProcessing ;
128 : bool m_bApplyFilter ;
129 : bool m_bCommandFacetsDirty; // any of the facets which define the active command is dirty
130 : bool m_bParametersDirty; // parameters changed since execute
131 : bool m_bModified ;
132 : bool m_bRebuildConnOnExecute ;
133 : bool m_bIsBookmarkable ;
134 : bool m_bNew ;
135 : bool m_bCanUpdateInsertedRows;
136 : bool m_bOwnConnection;
137 : 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 : 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 : bool impl_initComposer_throw( 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 : void impl_ensureStatement_throw();
201 :
202 : ::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 );
203 : // free clones and ParseTree. Plus, if _bComplete is <TRUE/>, *all* other associated resources
204 : void freeResources( bool _bComplete );
205 :
206 : /// informs the clones (and ourself) that we are going to delete a record with a given bookmark
207 : void notifyRowSetAndClonesRowDelete( const ::com::sun::star::uno::Any& _rBookmark );
208 :
209 : /// inform the clones (and ourself) that we have deleted a record with a given bookmark
210 : void notifyRowSetAndClonesRowDeleted( const ::com::sun::star::uno::Any& _rBookmark, sal_Int32 _nPos );
211 :
212 : void checkUpdateIterator();
213 : const connectivity::ORowSetValue& getInsertValue(sal_Int32 columnIndex);
214 : void setParameter(sal_Int32 parameterIndex, const connectivity::ORowSetValue& x);
215 : // resizes the parameter vector if necessary
216 : ::connectivity::ORowSetValue& getParameterStorage( sal_Int32 parameterIndex );
217 :
218 : void updateValue(sal_Int32 columnIndex,const connectivity::ORowSetValue& x);
219 : void checkUpdateConditions(sal_Int32 columnIndex);
220 : void impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard);
221 : // set all data columns to writeable
222 : void impl_setDataColumnsWriteable_throw();
223 : // restore the old state of the data column read-only state
224 : void impl_restoreDataColumnsWriteable_throw();
225 :
226 : protected:
227 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
228 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const SAL_OVERRIDE;
229 : virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const SAL_OVERRIDE;
230 :
231 : virtual void fireRowcount() SAL_OVERRIDE;
232 : void notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowChangeEvent &rEvt);
233 : void notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowsChangeEvent& rEvt);
234 : virtual bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
235 : virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
236 : virtual void notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
237 :
238 : virtual void doCancelModification( ) SAL_OVERRIDE;
239 : virtual bool isModification( ) SAL_OVERRIDE;
240 : virtual bool isModified( ) SAL_OVERRIDE;
241 : virtual bool isNew( ) SAL_OVERRIDE;
242 : virtual bool isPropertyChangeNotificationEnabled() const SAL_OVERRIDE;
243 :
244 : virtual ~ORowSet();
245 :
246 : public:
247 : ORowSet(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
248 :
249 : // com::sun::star::lang::XTypeProvider
250 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
251 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
252 :
253 : // com::sun::star::uno::XInterface
254 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
256 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
257 :
258 : // com::sun::star::lang::XUnoTunnel
259 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
261 :
262 : // com::sun::star::uno::XAggregation
263 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
264 :
265 : // ::com::sun::star::lang::XServiceInfo
266 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
267 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
268 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
269 :
270 : // ::com::sun::star::lang::XServiceInfo - static methods
271 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static() throw( ::com::sun::star::uno::RuntimeException );
272 : static OUString getImplementationName_static() throw( ::com::sun::star::uno::RuntimeException );
273 :
274 : // OComponentHelper
275 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
279 :
280 : // ::com::sun::star::sdbc::XCloseable
281 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
282 :
283 : // comphelper::OPropertyArrayUsageHelper
284 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
285 :
286 : // cppu::OPropertySetHelper
287 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
288 :
289 : // ::com::sun::star::sdbc::XResultSet
290 : virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
291 :
292 : // XCompletedExecution
293 : 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, std::exception) SAL_OVERRIDE;
294 :
295 : // XParametersSupplier
296 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getParameters( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
297 :
298 : // ::com::sun::star::sdbc::XRow
299 : virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
300 : virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
301 : virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
302 : virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
303 : virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 : virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
305 : virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
306 : virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
307 : virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
308 : 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, std::exception) SAL_OVERRIDE;
309 : virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 : virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
311 : virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
312 : 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, std::exception) SAL_OVERRIDE;
313 : 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, std::exception) SAL_OVERRIDE;
314 : 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, std::exception) SAL_OVERRIDE;
315 : 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, std::exception) SAL_OVERRIDE;
316 : 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, std::exception) SAL_OVERRIDE;
317 : 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, std::exception) SAL_OVERRIDE;
318 : 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, std::exception) SAL_OVERRIDE;
319 :
320 : // ::com::sun::star::sdbc::XRowUpdate
321 : virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
322 : virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
323 : virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
324 : virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
325 : virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
326 : virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
327 : virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
328 : virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
329 : virtual void SAL_CALL updateString( sal_Int32 columnIndex, const OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
330 : 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, std::exception) SAL_OVERRIDE;
331 : 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, std::exception) SAL_OVERRIDE;
332 : 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, std::exception) SAL_OVERRIDE;
333 : 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, std::exception) SAL_OVERRIDE;
334 : 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, std::exception) SAL_OVERRIDE;
335 : 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, std::exception) SAL_OVERRIDE;
336 : 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, std::exception) SAL_OVERRIDE;
337 : 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, std::exception) SAL_OVERRIDE;
338 :
339 : // ::com::sun::star::sdbc::XResultSetUpdate
340 : virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
341 : virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
342 : virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
343 : virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
344 : virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
345 : virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
346 :
347 : // ::com::sun::star::sdbc::XRowSet
348 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
349 : virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
350 : virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
351 :
352 : // ::com::sun::star::sdb::XRowSetApproveBroadcaster
353 : virtual void SAL_CALL addRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
354 : virtual void SAL_CALL removeRowSetApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
355 :
356 : // ::com::sun::star::sdb::XRowsChangeBroadcaster
357 : virtual void SAL_CALL addRowsChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
358 : virtual void SAL_CALL removeRowsChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
359 :
360 : // ::com::sun::star::sdb::XResultSetAccess
361 : 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, std::exception) SAL_OVERRIDE;
362 :
363 : // ::com::sun::star::util::XCancellable
364 : virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
365 :
366 : // ::com::sun::star::sdbcx::XDeleteRows
367 : 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, std::exception) SAL_OVERRIDE;
368 :
369 : // XParameters
370 : virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
371 : virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
372 : virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
373 : virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
374 : virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
375 : virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
376 : virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
377 : virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
378 : virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
379 : virtual void SAL_CALL setString( sal_Int32 parameterIndex, const OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
380 : 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, std::exception) SAL_OVERRIDE;
381 : 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, std::exception) SAL_OVERRIDE;
382 : 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, std::exception) SAL_OVERRIDE;
383 : 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, std::exception) SAL_OVERRIDE;
384 : 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, std::exception) SAL_OVERRIDE;
385 : 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, std::exception) SAL_OVERRIDE;
386 : 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, std::exception) SAL_OVERRIDE;
387 : 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, std::exception) SAL_OVERRIDE;
388 : 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, std::exception) SAL_OVERRIDE;
389 : 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, std::exception) SAL_OVERRIDE;
390 : 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, std::exception) SAL_OVERRIDE;
391 : 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, std::exception) SAL_OVERRIDE;
392 : virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
393 :
394 : // XWarningsSupplier
395 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
396 : virtual void SAL_CALL clearWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
397 :
398 : protected:
399 : /** implement the <method>execute</method>, without calling the approve listeners and without building a new
400 : connection
401 : @param _rClearForNotification mutex to clear before doing the final notifications
402 : */
403 : void execute_NoApprove_NoNewConn(::osl::ResettableMutexGuard& _rClearForNotification);
404 :
405 : /** call the RowSetApproveListeners<p/>
406 : throws an RowSetVetoException if one of the listeners vetoed
407 : */
408 : void approveExecution() throw (::com::sun::star::sdb::RowSetVetoException, ::com::sun::star::uno::RuntimeException);
409 :
410 : /// set m_xActiveConnection, fire a PropertyChangeEvent if necessary, do the event listener handling etc
411 : void setActiveConnection( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxNewConn, bool _bFireEvent = true );
412 :
413 : void implCancelRowUpdates( bool _bNotifyModified );
414 :
415 : /** sets the given result set type/concurrency at the given statement, while respecting
416 : possibly related data source settings
417 : */
418 : void setStatementResultSetType(
419 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxStatement,
420 : sal_Int32 _nDesiredResultSetType,
421 : sal_Int32 _nDesiredResultSetConcurrency
422 : );
423 :
424 : /** initializes a given RowSet column with the ColumnSettings (width, format, hidden, etc.) from a
425 : template column.
426 :
427 : If the template column supports any of the known column settings, they're plain copied. If not,
428 : the template column is examined for a TableName and Name property, and the table column described
429 : by those is used to find and copy the column settings.
430 : */
431 : void impl_initializeColumnSettings_nothrow(
432 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxTemplateColumn,
433 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRowSetColumn
434 : );
435 :
436 : /** initializes our parameters container (m_pParameters) according to the parameter columns as
437 : obtained from our composer
438 : */
439 : void impl_initParametersContainer_nothrow();
440 : /** disposes our parameters container
441 : */
442 : void impl_disposeParametersContainer_nothrow();
443 :
444 : protected:
445 : using ORowSetBase::getFastPropertyValue;
446 : using ORowSetBase::firePropertyChange;
447 : using ORowSetBase::doCancelModification;
448 : using ORowSetBase::isModification;
449 : using ORowSetBase::isModified;
450 : using ORowSetBase::isNew;
451 : };
452 :
453 :
454 :
455 : // ORowSetClone
456 :
457 : class ORowSetClone : public comphelper::OBaseMutex
458 : ,public OSubComponent
459 : ,public ORowSetBase
460 : ,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone >
461 : {
462 : protected:
463 : ORowSet* m_pParent;
464 : sal_Int32 m_nFetchDirection;
465 : sal_Int32 m_nFetchSize;
466 : bool m_bIsBookmarkable;
467 :
468 : protected:
469 : // the clone can not insert anything
470 : virtual void doCancelModification( ) SAL_OVERRIDE;
471 : virtual bool isModification( ) SAL_OVERRIDE;
472 : virtual bool isModified( ) SAL_OVERRIDE;
473 : virtual bool isNew( ) SAL_OVERRIDE;
474 :
475 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
476 : public:
477 : ORowSetClone( const css::uno::Reference<css::uno::XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex );
478 : virtual ~ORowSetClone();
479 :
480 : // com::sun::star::lang::XTypeProvider
481 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
482 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
483 : {
484 0 : return css::uno::Sequence<sal_Int8>();
485 : }
486 :
487 : // com::sun::star::uno::XInterface
488 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
489 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
490 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
491 :
492 : // ::com::sun::star::lang::XServiceInfo
493 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
494 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
495 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
496 :
497 : // com::sun::star::lang::XUnoTunnel
498 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
499 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
500 :
501 : // OComponentHelper
502 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
503 :
504 : // ::com::sun::star::sdbc::XCloseable
505 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
506 :
507 : // com::sun::star::beans::XPropertySet
508 0 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
509 : {
510 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
511 : }
512 :
513 : // ::com::sun::star::sdbc::XRowSet
514 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
515 : virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
516 : virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
517 :
518 : // comphelper::OPropertyArrayUsageHelper
519 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
520 :
521 : // cppu::OPropertySetHelper
522 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
523 :
524 : protected:
525 : using ORowSetBase::doCancelModification;
526 : using ORowSetBase::isModification;
527 : using ORowSetBase::isModified;
528 : using ORowSetBase::isNew;
529 : using ORowSetBase::rowDeleted;
530 : };
531 :
532 : }
533 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
534 :
535 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|