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_makeNewStatement_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(void) throw( ::com::sun::star::uno::RuntimeException );
272 : static OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
273 : static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
274 : SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
275 :
276 : // OComponentHelper
277 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
278 :
279 : // ::com::sun::star::lang::XEventListener
280 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
281 :
282 : // ::com::sun::star::sdbc::XCloseable
283 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
284 :
285 : // comphelper::OPropertyArrayUsageHelper
286 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
287 :
288 : // cppu::OPropertySetHelper
289 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
290 :
291 : // ::com::sun::star::sdbc::XResultSet
292 : virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
293 : virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
294 :
295 : // XCompletedExecution
296 : 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;
297 :
298 : // XParametersSupplier
299 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getParameters( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
300 :
301 : // ::com::sun::star::sdbc::XRow
302 : virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
303 : virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 : virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
305 : virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
306 : virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
307 : virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
308 : virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
309 : virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
310 : virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
311 : 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;
312 : 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;
313 : 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;
314 : 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;
315 : 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;
316 : 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;
317 : 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;
318 : 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;
319 : 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;
320 : 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;
321 : 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;
322 :
323 : // ::com::sun::star::sdbc::XRowUpdate
324 : virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
325 : 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;
326 : 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;
327 : 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;
328 : 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;
329 : 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;
330 : 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;
331 : 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;
332 : 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;
333 : 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;
334 : 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;
335 : 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;
336 : 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;
337 : 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;
338 : 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;
339 : 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;
340 : 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;
341 :
342 : // ::com::sun::star::sdbc::XResultSetUpdate
343 : virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
344 : virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
345 : virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
346 : virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
347 : virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
348 : virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
349 :
350 : // ::com::sun::star::sdbc::XRowSet
351 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
352 : 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;
353 : 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;
354 :
355 : // ::com::sun::star::sdb::XRowSetApproveBroadcaster
356 : 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;
357 : 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;
358 :
359 : // ::com::sun::star::sdb::XRowsChangeBroadcaster
360 : 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;
361 : 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;
362 :
363 : // ::com::sun::star::sdb::XResultSetAccess
364 : 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;
365 :
366 : // ::com::sun::star::util::XCancellable
367 : virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
368 :
369 : // ::com::sun::star::sdbcx::XDeleteRows
370 : 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;
371 :
372 : // XParameters
373 : 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;
374 : 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;
375 : 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;
376 : 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;
377 : 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;
378 : 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;
379 : 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;
380 : 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;
381 : 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;
382 : 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;
383 : 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;
384 : 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;
385 : 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;
386 : 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;
387 : 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;
388 : 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;
389 : 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;
390 : 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;
391 : 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;
392 : 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;
393 : 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;
394 : 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;
395 : virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
396 :
397 : // XWarningsSupplier
398 : virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
399 : virtual void SAL_CALL clearWarnings( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
400 :
401 : protected:
402 : /** implement the <method>execute</method>, without calling the approve listeners and without building a new
403 : connection
404 : @param _rClearForNotification mutex to clear before doing the final notifications
405 : */
406 : void execute_NoApprove_NoNewConn(::osl::ResettableMutexGuard& _rClearForNotification);
407 :
408 : /** call the RowSetApproveListeners<p/>
409 : throws an RowSetVetoException if one of the listeners vetoed
410 : */
411 : void approveExecution() throw (::com::sun::star::sdb::RowSetVetoException, ::com::sun::star::uno::RuntimeException);
412 :
413 : /// set m_xActiveConnection, fire a PropertyChangeEvent if necessary, do the event listener handling etc
414 : void setActiveConnection( ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxNewConn, bool _bFireEvent = true );
415 :
416 : void implCancelRowUpdates( bool _bNotifyModified );
417 :
418 : /** sets the given result set type/concurrency at the given statement, while respecting
419 : possibly related data source settings
420 : */
421 : void setStatementResultSetType(
422 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxStatement,
423 : sal_Int32 _nDesiredResultSetType,
424 : sal_Int32 _nDesiredResultSetConcurrency
425 : );
426 :
427 : /** initializes a given RowSet column with the ColumnSettings (width, format, hidden, etc.) from a
428 : template column.
429 :
430 : If the template column supports any of the known column settings, they're plain copied. If not,
431 : the template column is examined for a TableName and Name property, and the table column described
432 : by those is used to find and copy the column settings.
433 : */
434 : void impl_initializeColumnSettings_nothrow(
435 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxTemplateColumn,
436 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRowSetColumn
437 : );
438 :
439 : /** initializes our parameters container (m_pParameters) according to the parameter columns as
440 : obtained from our composer
441 : */
442 : void impl_initParametersContainer_nothrow();
443 : /** disposes our parameters container
444 : */
445 : void impl_disposeParametersContainer_nothrow();
446 :
447 : protected:
448 : using ORowSetBase::getFastPropertyValue;
449 : using ORowSetBase::firePropertyChange;
450 : using ORowSetBase::doCancelModification;
451 : using ORowSetBase::isModification;
452 : using ORowSetBase::isModified;
453 : using ORowSetBase::isNew;
454 : };
455 :
456 :
457 :
458 : // ORowSetClone
459 :
460 : class ORowSetClone : public comphelper::OBaseMutex
461 : ,public OSubComponent
462 : ,public ORowSetBase
463 : ,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone >
464 : {
465 : protected:
466 : ORowSet* m_pParent;
467 : sal_Int32 m_nFetchDirection;
468 : sal_Int32 m_nFetchSize;
469 : bool m_bIsBookmarkable;
470 :
471 : protected:
472 : // the clone can not insert anything
473 : virtual void doCancelModification( ) SAL_OVERRIDE;
474 : virtual bool isModification( ) SAL_OVERRIDE;
475 : virtual bool isModified( ) SAL_OVERRIDE;
476 : virtual bool isNew( ) SAL_OVERRIDE;
477 :
478 : 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;
479 : public:
480 : ORowSetClone( const css::uno::Reference<css::uno::XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex );
481 : virtual ~ORowSetClone();
482 :
483 : // com::sun::star::lang::XTypeProvider
484 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
485 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
486 : {
487 0 : return css::uno::Sequence<sal_Int8>();
488 : }
489 :
490 : // com::sun::star::uno::XInterface
491 : 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;
492 : virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
493 : virtual void SAL_CALL release() throw() SAL_OVERRIDE;
494 :
495 : // ::com::sun::star::lang::XServiceInfo
496 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
497 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
498 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
499 :
500 : // com::sun::star::lang::XUnoTunnel
501 : 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;
502 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
503 :
504 : // OComponentHelper
505 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
506 :
507 : // ::com::sun::star::sdbc::XCloseable
508 : virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
509 :
510 : // com::sun::star::beans::XPropertySet
511 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
512 : {
513 0 : return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
514 : }
515 :
516 : // ::com::sun::star::sdbc::XRowSet
517 : virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
518 : 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;
519 : 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;
520 :
521 : // comphelper::OPropertyArrayUsageHelper
522 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
523 :
524 : // cppu::OPropertySetHelper
525 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
526 :
527 : protected:
528 : using ORowSetBase::doCancelModification;
529 : using ORowSetBase::isModification;
530 : using ORowSetBase::isModified;
531 : using ORowSetBase::isNew;
532 : using ORowSetBase::rowDeleted;
533 : };
534 :
535 : }
536 : #endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
537 :
538 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|