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_aCursorName;
113 : OUString m_aUpdateCatalogName; // is set by a query
114 : OUString m_aUpdateSchemaName; // is set by a query
115 : 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 : bool m_bParametersDirty; // parameters changed since execute
132 : sal_Bool m_bModified ;
133 : sal_Bool m_bRebuildConnOnExecute ;
134 : sal_Bool m_bIsBookmarkable ;
135 : sal_Bool m_bNew ;
136 : sal_Bool m_bCanUpdateInsertedRows;
137 : sal_Bool m_bOwnConnection;
138 : sal_Bool m_bPropChangeNotifyEnabled;
139 :
140 : private:
141 : /** builds m_aActiveCommand from our settings
142 :
143 : @return
144 : whether we should use escape processing before executing the actual command. This is determined
145 : from our own EscapeProcessing property, and possibly overruled by the respective property
146 : of a query we're based on.
147 : */
148 : sal_Bool impl_buildActiveCommand_throw();
149 :
150 : /** initializes our query composer, and everything which has to do with it
151 :
152 : If we don't use escape processing, then we don't have a composer, and everything
153 : related to it. Nonetheless, _out_rCommandToExecute and the return value are properly
154 : initialized.
155 :
156 : @param _out_rCommandToExecute
157 : The command which is to be executed, according to the current settings -
158 : it is built from our active command plus our current filter/order criterions.
159 :
160 : @return
161 : whether we should use escape processing before executing the actual command. This is determined
162 : from our own EscapeProcessing property, and possibly overruled by the respective property
163 : of a query we're based on.
164 : Effectively, this value determines whether or not we actually have an composer (m_xComposer)
165 : and dependent information (such as the parameters container).
166 :
167 : @precond
168 : m_xActiveConnection points to a valid SDB-level connection
169 :
170 : @throws com::sun::star::sdb::SQLException
171 : if an database-related error occurred
172 :
173 : @throws com::sun::star::uno::RuntimeException
174 : if any of the components involved throws a com::sun::star::uno::RuntimeException
175 : */
176 : sal_Bool impl_initComposer_throw( OUString& _out_rCommandToExecute );
177 :
178 : /** returns the table container of our active connection
179 :
180 : If our connection is able to provide a tables container, this one is returned.
181 : Else, if m_pTables is not <NULL/>, this one will returned.
182 : Else, m_pTables will be constructed and returned.
183 :
184 : @precond m_xActiveConnection is not <NULL/>
185 : @throws ::com::sun::star::sdbc::SQLException
186 : if retrieving or constructing the tables container goes wrong
187 :
188 : @see impl_resetTables_nothrow
189 : */
190 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
191 : impl_getTables_throw();
192 :
193 : /** cleans up m_pTables, and resets it to <NULL/>
194 : */
195 : void impl_resetTables_nothrow();
196 :
197 : /** prepares and executes our command
198 : */
199 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
200 : impl_prepareAndExecute_throw();
201 : void impl_makeNewStatement_throw();
202 :
203 : ::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 );
204 : // free clones and ParseTree. Plus, if _bComplete is <TRUE/>, *all* other associated resources
205 : void freeResources( bool _bComplete );
206 :
207 : /// informs the clones (and ourself) that we are going to delete a record with a given bookmark
208 : void notifyRowSetAndClonesRowDelete( const ::com::sun::star::uno::Any& _rBookmark );
209 :
210 : /// inform the clones (and ourself) that we have deleted a record with a given bookmark
211 : void notifyRowSetAndClonesRowDeleted( const ::com::sun::star::uno::Any& _rBookmark, sal_Int32 _nPos );
212 :
213 : void checkUpdateIterator();
214 : const connectivity::ORowSetValue& getInsertValue(sal_Int32 columnIndex);
215 : void setParameter(sal_Int32 parameterIndex, const connectivity::ORowSetValue& x);
216 : // resizes the parameter vector if necessary
217 : ::connectivity::ORowSetValue& getParameterStorage( sal_Int32 parameterIndex );
218 :
219 : void updateValue(sal_Int32 columnIndex,const connectivity::ORowSetValue& x);
220 : void checkUpdateConditions(sal_Int32 columnIndex);
221 : void impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard);
222 : // set all data columns to writeable
223 : void impl_setDataColumnsWriteable_throw();
224 : // restore the old state of the data column read-only state
225 : void impl_restoreDataColumnsWriteable_throw();
226 :
227 : protected:
228 : 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;
229 : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const SAL_OVERRIDE;
230 : virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const SAL_OVERRIDE;
231 :
232 : virtual void fireRowcount() SAL_OVERRIDE;
233 : void notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowChangeEvent &rEvt);
234 : void notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard,const ::com::sun::star::sdb::RowsChangeEvent& rEvt);
235 : virtual sal_Bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
236 : virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
237 : virtual void notifyAllListeners(::osl::ResettableMutexGuard& _rGuard) SAL_OVERRIDE;
238 :
239 : virtual void doCancelModification( ) SAL_OVERRIDE;
240 : virtual sal_Bool isModification( ) SAL_OVERRIDE;
241 : virtual sal_Bool isModified( ) SAL_OVERRIDE;
242 : virtual sal_Bool isNew( ) SAL_OVERRIDE;
243 : virtual sal_Bool isPropertyChangeNotificationEnabled() const SAL_OVERRIDE;
244 :
245 : virtual ~ORowSet();
246 :
247 : public:
248 : ORowSet(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
249 :
250 : // com::sun::star::lang::XTypeProvider
251 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
252 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
253 :
254 : // com::sun::star::uno::XInterface
255 : 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;
256 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
257 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
258 :
259 : // com::sun::star::lang::XUnoTunnel
260 : 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;
261 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
262 :
263 : // com::sun::star::uno::XAggregation
264 : 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;
265 :
266 : // ::com::sun::star::lang::XServiceInfo
267 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
268 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
269 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
270 :
271 : // ::com::sun::star::lang::XServiceInfo - static methods
272 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
273 : static OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
274 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
275 : SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
276 :
277 : // OComponentHelper
278 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
279 :
280 : // ::com::sun::star::lang::XEventListener
281 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
282 :
283 : // ::com::sun::star::sdbc::XCloseable
284 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
285 :
286 : // comphelper::OPropertyArrayUsageHelper
287 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
288 :
289 : // cppu::OPropertySetHelper
290 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
291 :
292 : // ::com::sun::star::sdbc::XResultSet
293 : virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
294 : virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
295 :
296 : // XCompletedExecution
297 : 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;
298 :
299 : // XParametersSupplier
300 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getParameters( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
301 :
302 : // ::com::sun::star::sdbc::XRow
303 : virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 : virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
305 : virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
306 : virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
307 : virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
308 : virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
309 : virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 : virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
311 : virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
312 : 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;
313 : 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;
314 : 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;
315 : 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;
316 : 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;
317 : 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;
318 : 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;
319 : 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;
320 : 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;
321 : 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;
322 : 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;
323 :
324 : // ::com::sun::star::sdbc::XRowUpdate
325 : virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
326 : 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;
327 : 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;
328 : 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;
329 : 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;
330 : 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;
331 : 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;
332 : 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;
333 : 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;
334 : 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;
335 : 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;
336 : 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;
337 : 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;
338 : 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;
339 : 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;
340 : 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;
341 : 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;
342 :
343 : // ::com::sun::star::sdbc::XResultSetUpdate
344 : virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
345 : virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
346 : virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
347 : virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
348 : virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
349 : virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
350 :
351 : // ::com::sun::star::sdbc::XRowSet
352 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
353 : 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;
354 : 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;
355 :
356 : // ::com::sun::star::sdb::XRowSetApproveBroadcaster
357 : 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;
358 : 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;
359 :
360 : // ::com::sun::star::sdb::XRowsChangeBroadcaster
361 : 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;
362 : 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;
363 :
364 : // ::com::sun::star::sdb::XResultSetAccess
365 : 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;
366 :
367 : // ::com::sun::star::util::XCancellable
368 : virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
369 :
370 : // ::com::sun::star::sdbcx::XDeleteRows
371 : 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;
372 :
373 : // XParameters
374 : 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;
375 : 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;
376 : 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;
377 : 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;
378 : 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;
379 : 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;
380 : 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;
381 : 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;
382 : 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;
383 : 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;
384 : 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;
385 : 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;
386 : 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;
387 : 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;
388 : 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;
389 : 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;
390 : 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;
391 : 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;
392 : 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;
393 : 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;
394 : 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;
395 : 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;
396 : virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
397 :
398 : // XWarningsSupplier
399 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
400 : virtual void SAL_CALL clearWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
401 :
402 : protected:
403 : /** implement the <method>execute</method>, without calling the approve listeners and without building a new
404 : connection
405 : @param _rClearForNotification mutex to clear before doing the final notifications
406 : */
407 : void execute_NoApprove_NoNewConn(::osl::ResettableMutexGuard& _rClearForNotification);
408 :
409 : /** call the RowSetApproveListeners<p/>
410 : throws an RowSetVetoException if one of the listeners vetoed
411 : */
412 : void approveExecution() throw (::com::sun::star::sdb::RowSetVetoException, ::com::sun::star::uno::RuntimeException);
413 :
414 : /// set m_xActiveConnection, fire a PropertyChangeEvent if necessary, do the event listener handling etc
415 : void setActiveConnection( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxNewConn, sal_Bool _bFireEvent = sal_True );
416 :
417 : void implCancelRowUpdates( sal_Bool _bNotifyModified ) SAL_THROW( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
418 :
419 : /** sets the given result set type/concurrency at the given statement, while respecting
420 : possibly related data source settings
421 : */
422 : void setStatementResultSetType(
423 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxStatement,
424 : sal_Int32 _nDesiredResultSetType,
425 : sal_Int32 _nDesiredResultSetConcurrency
426 : );
427 :
428 : /** initializes a given RowSet column with the ColumnSettings (width, format, hidden, etc.) from a
429 : template column.
430 :
431 : If the template column supports any of the known column settings, they're plain copied. If not,
432 : the template column is examined for a TableName and Name property, and the table column described
433 : by those is used to find and copy the column settings.
434 : */
435 : void impl_initializeColumnSettings_nothrow(
436 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxTemplateColumn,
437 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRowSetColumn
438 : );
439 :
440 : /** initializes our parameters container (m_pParameters) according to the parameter columns as
441 : obtained from our composer
442 : */
443 : void impl_initParametersContainer_nothrow();
444 : /** disposes our parameters container
445 : */
446 : void impl_disposeParametersContainer_nothrow();
447 :
448 : protected:
449 : using ORowSetBase::getFastPropertyValue;
450 : using ORowSetBase::firePropertyChange;
451 : using ORowSetBase::doCancelModification;
452 : using ORowSetBase::isModification;
453 : using ORowSetBase::isModified;
454 : using ORowSetBase::isNew;
455 : };
456 :
457 :
458 :
459 : // ORowSetClone
460 :
461 : class ORowSetClone : public comphelper::OBaseMutex
462 : ,public OSubComponent
463 : ,public ORowSetBase
464 : ,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone >
465 : {
466 : protected:
467 : ORowSet* m_pParent;
468 : sal_Int32 m_nFetchDirection;
469 : sal_Int32 m_nFetchSize;
470 : sal_Bool m_bIsBookmarkable;
471 :
472 : protected:
473 : // the clone can not insert anything
474 : virtual void doCancelModification( ) SAL_OVERRIDE;
475 : virtual sal_Bool isModification( ) SAL_OVERRIDE;
476 : virtual sal_Bool isModified( ) SAL_OVERRIDE;
477 : virtual sal_Bool isNew( ) SAL_OVERRIDE;
478 :
479 : 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;
480 : public:
481 : ORowSetClone( const css::uno::Reference<css::uno::XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex );
482 : virtual ~ORowSetClone();
483 :
484 : // com::sun::star::lang::XTypeProvider
485 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
486 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
487 : {
488 0 : return css::uno::Sequence<sal_Int8>();
489 : }
490 :
491 : // com::sun::star::uno::XInterface
492 : 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;
493 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
494 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
495 :
496 : // ::com::sun::star::lang::XServiceInfo
497 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
498 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
499 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
500 :
501 : // com::sun::star::lang::XUnoTunnel
502 : 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;
503 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
504 :
505 : // OComponentHelper
506 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
507 :
508 : // ::com::sun::star::sdbc::XCloseable
509 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
510 :
511 : // com::sun::star::beans::XPropertySet
512 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
513 : {
514 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
515 : }
516 :
517 : // ::com::sun::star::sdbc::XRowSet
518 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
519 : 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;
520 : 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;
521 :
522 : // comphelper::OPropertyArrayUsageHelper
523 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
524 :
525 : // cppu::OPropertySetHelper
526 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
527 :
528 : protected:
529 : using ORowSetBase::doCancelModification;
530 : using ORowSetBase::isModification;
531 : using ORowSetBase::isModified;
532 : using ORowSetBase::isNew;
533 : using ORowSetBase::rowDeleted;
534 : };
535 :
536 : }
537 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
538 :
539 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|