12e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 52e2212a7SAndrew Rist * distributed with this work for additional information 62e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 72e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 82e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 92e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 112e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 132e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 142e2212a7SAndrew Rist * software distributed under the License is distributed on an 152e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 172e2212a7SAndrew Rist * specific language governing permissions and limitations 182e2212a7SAndrew Rist * under the License. 19cdf0e10cSrcweir * 202e2212a7SAndrew Rist *************************************************************/ 212e2212a7SAndrew Rist 22cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_ROWSETBASE_HXX 23cdf0e10cSrcweir #define DBACCESS_CORE_API_ROWSETBASE_HXX 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE10_HXX_ 26cdf0e10cSrcweir #include <cppuhelper/implbase10.hxx> 27cdf0e10cSrcweir #endif 28cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ 29cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ 32cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_ 35cdf0e10cSrcweir #include <com/sun/star/sdbc/XColumnLocate.hpp> 36cdf0e10cSrcweir #endif 37cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_ 38cdf0e10cSrcweir #include <com/sun/star/sdbc/XCloseable.hpp> 39cdf0e10cSrcweir #endif 40cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ 41cdf0e10cSrcweir #include <com/sun/star/sdbcx/XRowLocate.hpp> 42cdf0e10cSrcweir #endif 43cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ 44cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> 45cdf0e10cSrcweir #endif 46cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_ 47cdf0e10cSrcweir #include <com/sun/star/sdbc/XWarningsSupplier.hpp> 48cdf0e10cSrcweir #endif 49cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ 50cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 51cdf0e10cSrcweir #endif 52cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ 53cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir #ifndef _CPPUHELPER_INTERFACECONTAINER_H_ 56cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 57cdf0e10cSrcweir #endif 58cdf0e10cSrcweir #ifndef CONNECTIVITY_SQLERROR_HXX 59cdf0e10cSrcweir #include <connectivity/sqlerror.hxx> 60cdf0e10cSrcweir #endif 61cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ 62cdf0e10cSrcweir #include <connectivity/CommonTools.hxx> 63cdf0e10cSrcweir #endif 64cdf0e10cSrcweir #ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX 65cdf0e10cSrcweir #include <comphelper/propertystatecontainer.hxx> 66cdf0e10cSrcweir #endif 67cdf0e10cSrcweir #ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_ 68cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 69cdf0e10cSrcweir #endif 70cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ 71cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp> 72cdf0e10cSrcweir #endif 73cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_ 74cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatTypes.hpp> 75cdf0e10cSrcweir #endif 76cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 77cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 78cdf0e10cSrcweir #endif 79cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_ROWSETROW_HXX 80cdf0e10cSrcweir #include "RowSetRow.hxx" 81cdf0e10cSrcweir #endif 82cdf0e10cSrcweir #ifndef _COMPHELPER_BROADCASTHELPER_HXX_ 83cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 84cdf0e10cSrcweir #endif 85cdf0e10cSrcweir #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX 86cdf0e10cSrcweir #include "RowSetCacheIterator.hxx" 87cdf0e10cSrcweir #endif 88cdf0e10cSrcweir #include "core_resource.hxx" 89cdf0e10cSrcweir #include <comphelper/componentcontext.hxx> 90cdf0e10cSrcweir 91cdf0e10cSrcweir #include <functional> 92cdf0e10cSrcweir 93cdf0e10cSrcweir 94cdf0e10cSrcweir namespace com { namespace sun { namespace star { 95cdf0e10cSrcweir namespace sdb { struct RowChangeEvent; } 96cdf0e10cSrcweir namespace lang { struct Locale; } 97cdf0e10cSrcweir } } } 98cdf0e10cSrcweir 99cdf0e10cSrcweir namespace dbaccess 100cdf0e10cSrcweir { 101cdf0e10cSrcweir class OEmptyCollection; 102cdf0e10cSrcweir 103cdf0e10cSrcweir typedef ::cppu::ImplHelper10< ::com::sun::star::sdbcx::XRowLocate, 104cdf0e10cSrcweir ::com::sun::star::sdbc::XRow, 105cdf0e10cSrcweir ::com::sun::star::sdbc::XResultSetMetaDataSupplier, 106cdf0e10cSrcweir ::com::sun::star::sdbc::XWarningsSupplier, 107cdf0e10cSrcweir ::com::sun::star::sdbc::XColumnLocate, 108cdf0e10cSrcweir ::com::sun::star::sdbcx::XColumnsSupplier, 109cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo, 110cdf0e10cSrcweir ::com::sun::star::sdbc::XRowSet, 111cdf0e10cSrcweir ::com::sun::star::sdbc::XCloseable, 112cdf0e10cSrcweir ::com::sun::star::lang::XUnoTunnel> ORowSetBase_BASE; 113cdf0e10cSrcweir 114cdf0e10cSrcweir class ORowSetCache; 115cdf0e10cSrcweir class ORowSetDataColumns; 116cdf0e10cSrcweir class ORowSetCacheIterator; 117cdf0e10cSrcweir class ORowSetDataColumn; 118cdf0e10cSrcweir class ORowSetBase : public ORowSetBase_BASE, 119cdf0e10cSrcweir public ::comphelper::OPropertyStateContainer, 120cdf0e10cSrcweir public ::comphelper::OPropertyArrayUsageHelper<ORowSetBase> // this class hold the static property info 121cdf0e10cSrcweir { 122cdf0e10cSrcweir OModuleClient m_aModuleClient; 123cdf0e10cSrcweir protected: 124cdf0e10cSrcweir typedef ::std::vector<ORowSetDataColumn*> TDataColumns; 125cdf0e10cSrcweir ::osl::Mutex* m_pMutex; // this the mutex form the rowset itself 126cdf0e10cSrcweir ::osl::Mutex m_aRowCountMutex, // mutex for rowcount changes 127*9ec4364bSmseidel // we need an extra mutex for columns to prevent deadlock when setting new values 128cdf0e10cSrcweir // for a row 129cdf0e10cSrcweir m_aColumnsMutex; 130cdf0e10cSrcweir 131cdf0e10cSrcweir ::com::sun::star::uno::Any m_aBookmark; 132cdf0e10cSrcweir ORowSetCacheIterator m_aCurrentRow; // contains the actual fetched row 133cdf0e10cSrcweir TORowSetOldRowHelperRef m_aOldRow; 134cdf0e10cSrcweir TDataColumns m_aDataColumns; // holds the columns as m_pColumns but know the implementation class 135cdf0e10cSrcweir connectivity::ORowSetValue m_aEmptyValue; // only for error case 136cdf0e10cSrcweir 137cdf0e10cSrcweir ::cppu::OWeakObject* m_pMySelf; // set by derived classes 138cdf0e10cSrcweir ORowSetCache* m_pCache; // the cache is used by the rowset and his clone (shared) 139cdf0e10cSrcweir ORowSetDataColumns* m_pColumns; // represent the select columns 140cdf0e10cSrcweir ::cppu::OBroadcastHelper& m_rBHelper; // must be set from the derived classes 141cdf0e10cSrcweir // is used when the formatkey for database types is set 142cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes> m_xNumberFormatTypes; 143cdf0e10cSrcweir OEmptyCollection* m_pEmptyCollection; 144cdf0e10cSrcweir 145cdf0e10cSrcweir ::comphelper::ComponentContext m_aContext; 146cdf0e10cSrcweir ::connectivity::SQLError m_aErrors; 147cdf0e10cSrcweir 148cdf0e10cSrcweir sal_Int32 m_nLastColumnIndex; // the last column ask for, used for wasNull() 149cdf0e10cSrcweir sal_Int32 m_nDeletedPosition; // is set only when a row was deleted 150cdf0e10cSrcweir sal_Int32 m_nResultSetType; // fetch property 151cdf0e10cSrcweir sal_Int32 m_nResultSetConcurrency; 152cdf0e10cSrcweir sal_Bool m_bClone; // I'm clone or not 153cdf0e10cSrcweir sal_Bool m_bIgnoreResult ; 154cdf0e10cSrcweir sal_Bool m_bBeforeFirst : 1; 155cdf0e10cSrcweir sal_Bool m_bAfterLast : 1; 156cdf0e10cSrcweir sal_Bool m_bIsInsertRow : 1; 157cdf0e10cSrcweir 158cdf0e10cSrcweir protected: 159cdf0e10cSrcweir ORowSetBase( 160cdf0e10cSrcweir const ::comphelper::ComponentContext& _rContext, 161cdf0e10cSrcweir ::cppu::OBroadcastHelper& _rBHelper, 162cdf0e10cSrcweir ::osl::Mutex* _pMutex 163cdf0e10cSrcweir ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir // fire a notification for all that are listening on column::VALUE property 166cdf0e10cSrcweir void firePropertyChange(const ORowSetRow& _rOldRow); 167cdf0e10cSrcweir // fire a change for one column 168cdf0e10cSrcweir // _nPos starts at zero 169cdf0e10cSrcweir void firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rNewValue); 170cdf0e10cSrcweir 171cdf0e10cSrcweir // fire if rowcount changed 172cdf0e10cSrcweir virtual void fireRowcount(); 173cdf0e10cSrcweir // notify row changed 174cdf0e10cSrcweir virtual sal_Bool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard); 175cdf0e10cSrcweir // notify cursor moved 176cdf0e10cSrcweir virtual void notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard); 177cdf0e10cSrcweir // notify all that rowset changed 178cdf0e10cSrcweir virtual void notifyAllListeners(::osl::ResettableMutexGuard& _rGuard); 179cdf0e10cSrcweir 180cdf0e10cSrcweir // cancel the insertion, if necessary (means if we're on the insert row) 181cdf0e10cSrcweir virtual void doCancelModification( ) = 0; 182cdf0e10cSrcweir // return <TRUE/> if and only if we're using the insert row (means: we're updating _or_ inserting) 183cdf0e10cSrcweir virtual sal_Bool isModification( ) = 0; 184cdf0e10cSrcweir // return <TRUE/> if and only if the current row is modified 185cdf0e10cSrcweir // TODO: isn't this the same as isModification? 186cdf0e10cSrcweir virtual sal_Bool isModified( ) = 0; 187cdf0e10cSrcweir // return <TRUE/> if and only if the current row is the insert row 188cdf0e10cSrcweir virtual sal_Bool isNew( ) = 0; 189cdf0e10cSrcweir // notify the change of a boolean property 190cdf0e10cSrcweir void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld ); 191cdf0e10cSrcweir 192cdf0e10cSrcweir // OPropertyStateContainer 193cdf0e10cSrcweir virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const; 194cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; 195cdf0e10cSrcweir 196cdf0e10cSrcweir enum CursorMoveDirection 197cdf0e10cSrcweir { 198cdf0e10cSrcweir /// denotes a cursor move forward 199cdf0e10cSrcweir MOVE_FORWARD, 200cdf0e10cSrcweir /// denotes a cursor move backwards 201cdf0e10cSrcweir MOVE_BACKWARD, 202cdf0e10cSrcweir /// denotes no cursor move at all, used when the current row is to be refreshed only 203cdf0e10cSrcweir MOVE_NONE_REFRESH_ONLY 204cdf0e10cSrcweir }; 205cdf0e10cSrcweir /** positions the cache in preparation of a cursor move 206cdf0e10cSrcweir 207cdf0e10cSrcweir Normally, the cache is simply moved to our bookmark (m_aBookmark). If however the current 208cdf0e10cSrcweir row is deleted, then the cache is properly positioned for a following cursor movement in the 209cdf0e10cSrcweir given direction. 210cdf0e10cSrcweir 211cdf0e10cSrcweir @param _ePrepareForDirection 212cdf0e10cSrcweir the direction into which the cursor should be moved after the call. If we're currently not on 213cdf0e10cSrcweir a deleted row, this parameter is ignored, since in this case the cache is simply moved to 214cdf0e10cSrcweir m_aBookmark.</br> 215cdf0e10cSrcweir If, however, we're currently on a deleted row, this is used to properly position the cache 216cdf0e10cSrcweir using <member>m_nDeletedPosition</member>.<br/> 217cdf0e10cSrcweir In this case, MOVE_NONE_REFRESH_ONLY is not supported. This is because the deleted row 218cdf0e10cSrcweir (to which the RowSet currently points to) is not present in the cache. So, you cannot move the 219cdf0e10cSrcweir cache to this row. 220cdf0e10cSrcweir */ 221cdf0e10cSrcweir void positionCache( CursorMoveDirection _ePrepareForDirection ); 222cdf0e10cSrcweir 223cdf0e10cSrcweir // returns a value of a column of the current row 224cdf0e10cSrcweir const connectivity::ORowSetValue& getValue(sal_Int32 columnIndex); 225cdf0e10cSrcweir // the cache has to be checked before calling this method 226cdf0e10cSrcweir const connectivity::ORowSetValue& impl_getValue(sal_Int32 columnIndex); 227cdf0e10cSrcweir // sets the current and the bookmark 228cdf0e10cSrcweir void setCurrentRow( sal_Bool _bMoved, sal_Bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard); 229cdf0e10cSrcweir void checkPositioningAllowed() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 230cdf0e10cSrcweir // checks if the cache is null 231cdf0e10cSrcweir void checkCache(); 232cdf0e10cSrcweir // sets the bookmark to Any() 233cdf0e10cSrcweir // m_aCurrentRow to end of matrix 234cdf0e10cSrcweir // m_aOldRow to NULL 235cdf0e10cSrcweir void movementFailed(); 236cdf0e10cSrcweir 237cdf0e10cSrcweir ORowSetRow getOldRow(sal_Bool _bWasNew); 23807a3d7f1SPedro Giffuni /** move the cache the position defined by the member functor 239cdf0e10cSrcweir @param _aCheckFunctor 240cdf0e10cSrcweir Return <TRUE/> when we already stand on the row we want to. 241cdf0e10cSrcweir @param _aMovementFunctor 2427a5c319bSDamjan Jovanovic The method used to move. 243cdf0e10cSrcweir @return 244cdf0e10cSrcweir <TRUE/> if movement was successful. 245cdf0e10cSrcweir */ 246cdf0e10cSrcweir sal_Bool SAL_CALL move( ::std::mem_fun_t<sal_Bool,ORowSetBase>& _aCheckFunctor, 247cdf0e10cSrcweir ::std::mem_fun_t<sal_Bool,ORowSetCache>& _aMovementFunctor); 248cdf0e10cSrcweir 249cdf0e10cSrcweir /** same meaning as isFirst. Only need by mem_fun 250cdf0e10cSrcweir @return 251cdf0e10cSrcweir <TRUE/> if so. 252cdf0e10cSrcweir */ 253cdf0e10cSrcweir sal_Bool isOnFirst(); 254cdf0e10cSrcweir /** same meaning as isLast. Only need by mem_fun 255cdf0e10cSrcweir @return 256cdf0e10cSrcweir <TRUE/> if so. 257cdf0e10cSrcweir */ 258cdf0e10cSrcweir sal_Bool isOnLast(); 259cdf0e10cSrcweir 260cdf0e10cSrcweir /** returns the current row count 261cdf0e10cSrcweir 262cdf0e10cSrcweir This function takes into account that we might actually be positioned on a 263cdf0e10cSrcweir deleted row, so that m_pCache->m_nRowCount does not really reflect the actual 264cdf0e10cSrcweir count. 265cdf0e10cSrcweir 266cdf0e10cSrcweir @precond 267*9ec4364bSmseidel Our mutex is locked. 268cdf0e10cSrcweir */ 269cdf0e10cSrcweir sal_Int32 impl_getRowCount() const; 270cdf0e10cSrcweir 271cdf0e10cSrcweir // the checkCache has to be called before calling this methods 272cdf0e10cSrcweir sal_Bool impl_wasNull(); 273cdf0e10cSrcweir sal_Int32 impl_getRow(); 274cdf0e10cSrcweir sal_Bool impl_rowDeleted(); 275cdf0e10cSrcweir 276cdf0e10cSrcweir public: 277cdf0e10cSrcweir virtual ~ORowSetBase(); 278cdf0e10cSrcweir 279cdf0e10cSrcweir // OComponentHelper 280cdf0e10cSrcweir virtual void SAL_CALL disposing(void); 281cdf0e10cSrcweir 282cdf0e10cSrcweir // com::sun::star::beans::XPropertySet getPropertySetInfo()283cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir // comphelper::OPropertyArrayUsageHelper 289cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; 290cdf0e10cSrcweir 291cdf0e10cSrcweir // cppu::OPropertySetHelper 292cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 293cdf0e10cSrcweir 294cdf0e10cSrcweir // com::sun::star::lang::XTypeProvider 295cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException); 296cdf0e10cSrcweir 297cdf0e10cSrcweir // com::sun::star::uno::XInterface 298cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException); 299cdf0e10cSrcweir 300cdf0e10cSrcweir // ::com::sun::star::sdbc::XWarningsSupplier 301cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 302cdf0e10cSrcweir virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 303cdf0e10cSrcweir 304cdf0e10cSrcweir // ::com::sun::star::sdbc::XResultSetMetaDataSupplier 305cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 306cdf0e10cSrcweir 307cdf0e10cSrcweir // ::com::sun::star::sdbc::XColumnLocate 308cdf0e10cSrcweir virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // ::com::sun::star::sdbcx::XColumnsSupplier 311cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException); 312cdf0e10cSrcweir 313cdf0e10cSrcweir // ::com::sun::star::sdbc::XRow 314cdf0e10cSrcweir virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 315cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 316cdf0e10cSrcweir virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 317cdf0e10cSrcweir virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 318cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 319cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 320cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 321cdf0e10cSrcweir virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 322cdf0e10cSrcweir virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 323cdf0e10cSrcweir 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); 324cdf0e10cSrcweir virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 325cdf0e10cSrcweir virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 326cdf0e10cSrcweir virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 327cdf0e10cSrcweir 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); 328cdf0e10cSrcweir 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); 329cdf0e10cSrcweir 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); 330cdf0e10cSrcweir 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); 331cdf0e10cSrcweir 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); 332cdf0e10cSrcweir 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); 333cdf0e10cSrcweir 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); 334cdf0e10cSrcweir 335cdf0e10cSrcweir // ::com::sun::star::sdbcx::XRowLocate 336cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 337cdf0e10cSrcweir virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 338cdf0e10cSrcweir virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 339cdf0e10cSrcweir virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 340cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 341cdf0e10cSrcweir virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 342cdf0e10cSrcweir 343cdf0e10cSrcweir // ::com::sun::star::sdbc::XResultSet 344cdf0e10cSrcweir virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 345cdf0e10cSrcweir virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 346cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 347cdf0e10cSrcweir virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 348cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 349cdf0e10cSrcweir virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 350cdf0e10cSrcweir virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 351cdf0e10cSrcweir virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 352cdf0e10cSrcweir virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 353cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 354cdf0e10cSrcweir virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 355cdf0e10cSrcweir virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 356cdf0e10cSrcweir virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 357cdf0e10cSrcweir virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 358cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 359cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 360cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 361cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 362cdf0e10cSrcweir 363cdf0e10cSrcweir // ::com::sun::star::sdbc::XRowSet 364cdf0e10cSrcweir virtual void SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 365cdf0e10cSrcweir virtual void SAL_CALL addRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException) = 0; 366cdf0e10cSrcweir virtual void SAL_CALL removeRowSetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener >& listener ) throw(::com::sun::star::uno::RuntimeException) = 0; 367cdf0e10cSrcweir 368cdf0e10cSrcweir // is called when the rowset is going to delete this bookmark _rBookmark 369cdf0e10cSrcweir void onDeleteRow( const ::com::sun::star::uno::Any& _rBookmark ); 370cdf0e10cSrcweir // is called when the rowset has deleted this bookmark _rBookmark 371cdf0e10cSrcweir void onDeletedRow( const ::com::sun::star::uno::Any& _rBookmark, sal_Int32 _nPos ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir // ========================================================== 374cdf0e10cSrcweir // granular access control GrantNotifierAccessdbaccess::ORowSetBase::GrantNotifierAccess375cdf0e10cSrcweir struct GrantNotifierAccess { friend class ORowSetNotifier; private: GrantNotifierAccess () { } }; 376cdf0e10cSrcweir 377cdf0e10cSrcweir // cancel the insertion, if necessary (means if we're on the insert row) doCancelModification(const GrantNotifierAccess &)378cdf0e10cSrcweir inline void doCancelModification( const GrantNotifierAccess& ) { doCancelModification(); } isModification(const GrantNotifierAccess &)379cdf0e10cSrcweir inline sal_Bool isModification( const GrantNotifierAccess& ) { return isModification(); } isModified(const GrantNotifierAccess &)380cdf0e10cSrcweir inline sal_Bool isModified( const GrantNotifierAccess& ) { return isModified(); } isNew(const GrantNotifierAccess &)381cdf0e10cSrcweir inline sal_Bool isNew( const GrantNotifierAccess& ) { return isNew(); } isInsertRow()382cdf0e10cSrcweir inline sal_Bool isInsertRow() { return m_bIsInsertRow; } // isNew() || isModified(); } fireProperty(sal_Int32 _nProperty,sal_Bool _bNew,sal_Bool _bOld,const GrantNotifierAccess &)383cdf0e10cSrcweir inline void fireProperty( sal_Int32 _nProperty, sal_Bool _bNew, sal_Bool _bOld, const GrantNotifierAccess& ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir fireProperty( _nProperty, _bNew, _bOld ); 386cdf0e10cSrcweir } firePropertyChange(sal_Int32 _nPos,const::connectivity::ORowSetValue & _rNewValue,const GrantNotifierAccess &)387cdf0e10cSrcweir inline void firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rNewValue, const GrantNotifierAccess& ) 388cdf0e10cSrcweir { 389cdf0e10cSrcweir firePropertyChange(_nPos,_rNewValue); 390cdf0e10cSrcweir } 391cdf0e10cSrcweir using ::comphelper::OPropertyStateContainer::getFastPropertyValue; 392cdf0e10cSrcweir getMutex() const393cdf0e10cSrcweir ::osl::Mutex* getMutex() const { return m_pMutex; } 394cdf0e10cSrcweir }; 395cdf0e10cSrcweir 396cdf0e10cSrcweir // ======================================================================== 397cdf0e10cSrcweir /** eases the handling of the doCancelModification and notifyCancelInsert methods 398cdf0e10cSrcweir 399cdf0e10cSrcweir <p>The class can only be used on the stack, within a method of ORowSetBase (or derivees)</p> 400cdf0e10cSrcweir */ 401cdf0e10cSrcweir struct ORowSetNotifierImpl; 402cdf0e10cSrcweir class ORowSetNotifier 403cdf0e10cSrcweir { 404cdf0e10cSrcweir private: 405cdf0e10cSrcweir ::std::auto_ptr<ORowSetNotifierImpl> m_pImpl; 406cdf0e10cSrcweir ORowSetBase* m_pRowSet; 40707a3d7f1SPedro Giffuni // not acquired! This is not necessary because this class here is to be used on the stack within 408cdf0e10cSrcweir // a method of ORowSetBase (or derivees) 409cdf0e10cSrcweir sal_Bool m_bWasNew; 410cdf0e10cSrcweir sal_Bool m_bWasModified; 411cdf0e10cSrcweir 412cdf0e10cSrcweir #ifdef DBG_UTIL 413cdf0e10cSrcweir sal_Bool m_bNotifyCalled; 414cdf0e10cSrcweir #endif 415cdf0e10cSrcweir 416cdf0e10cSrcweir public: 417cdf0e10cSrcweir /** constructs the object, and cancels the insertion 418cdf0e10cSrcweir 419cdf0e10cSrcweir @see ORowSetBase::doCancelModification 420cdf0e10cSrcweir */ 421cdf0e10cSrcweir ORowSetNotifier( ORowSetBase* m_pRowSet ); 422cdf0e10cSrcweir 423cdf0e10cSrcweir /** use this one to consturct an vector for change value notification 424cdf0e10cSrcweir */ 425cdf0e10cSrcweir ORowSetNotifier( ORowSetBase* m_pRowSet,const ORowSetValueVector::Vector& i_aRow ); 426cdf0e10cSrcweir 427cdf0e10cSrcweir // destructs the object. <member>fire</member> has to be called before. 428cdf0e10cSrcweir ~ORowSetNotifier( ); 429cdf0e10cSrcweir 430cdf0e10cSrcweir /** notifies the insertion 431cdf0e10cSrcweir 432cdf0e10cSrcweir <p>This has <em>not</em> been put into the destructor by intention!<br/> 433cdf0e10cSrcweir 434cdf0e10cSrcweir The destructor is called during stack unwinding in case of an exception, so if we would do 435cdf0e10cSrcweir listener notification there, this would have the potential of another exception during stack 436cdf0e10cSrcweir unwinding, which would terminate the application.</p> 437cdf0e10cSrcweir 438cdf0e10cSrcweir @see ORowSetBase::notifyCancelInsert 439cdf0e10cSrcweir */ 440cdf0e10cSrcweir void fire(); 441cdf0e10cSrcweir 442cdf0e10cSrcweir /** notifies value change events and notifies IsModified 443cdf0e10cSrcweir @param i_aChangedColumns the index of the changed value columns 444cdf0e10cSrcweir @param i_aRow the old values 445cdf0e10cSrcweir @see ORowSetBase::notifyCancelInsert 446cdf0e10cSrcweir */ 447cdf0e10cSrcweir void firePropertyChange(); 448cdf0e10cSrcweir 449*9ec4364bSmseidel /** use this one to store the index of the changed column values 450cdf0e10cSrcweir */ 451cdf0e10cSrcweir ::std::vector<sal_Int32>& getChangedColumns() const; 452cdf0e10cSrcweir ::std::vector<com::sun::star::uno::Any>& getChangedBookmarks() const; 453cdf0e10cSrcweir 454cdf0e10cSrcweir }; 455cdf0e10cSrcweir 456cdf0e10cSrcweir } // end of namespace 457cdf0e10cSrcweir 458cdf0e10cSrcweir #endif // DBACCESS_CORE_API_ROWSETBASE_HXX 459*9ec4364bSmseidel 460*9ec4364bSmseidel /* vim: set noet sw=4 ts=4: */ 461