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