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