class ORowSetCache; class ORowSetDataColumns; class ORowSetDataColumn; class ORowSetBase : public ORowSetBase_BASE, public ::comphelper::OPropertyStateContainer, public ::comphelper::OPropertyArrayUsageHelper<ORowSetBase> // this class hold the static property info
{ protected: typedef std::vector<ORowSetDataColumn*> TDataColumns;
::osl::Mutex* m_pMutex; // this is the mutex from the rowset itself
::osl::Mutex // we need an extra mutex for columns to prevent deadlock when setting new values // for a row
m_aColumnsMutex;
css::uno::Any m_aBookmark;
ORowSetCacheIterator m_aCurrentRow; // contains the actual fetched row
TORowSetOldRowHelperRef m_aOldRow;
TDataColumns m_aDataColumns; // holds the columns as m_pColumns but know the implementation class
connectivity::ORowSetValue m_aEmptyValue; // only for error case
::cppu::OWeakObject* m_pMySelf; // set by derived classes
std::shared_ptr<ORowSetCache> m_pCache; // the cache is used by the rowset and his clone (shared)
std::unique_ptr<ORowSetDataColumns> m_pColumns; // represent the select columns
::cppu::OBroadcastHelper& m_rBHelper; // must be set from the derived classes // is used when the formatkey for database types is set
css::uno::Reference< css::util::XNumberFormatTypes> m_xNumberFormatTypes;
std::unique_ptr<OEmptyCollection> m_pEmptyCollection;
sal_Int32 m_nLastColumnIndex; // the last column ask for, used for wasNull()
sal_Int32 m_nDeletedPosition; // is set only when a row was deleted
sal_Int32 m_nResultSetType; // fetch property
sal_Int32 m_nResultSetConcurrency; bool m_bClone; // I'm clone or not bool m_bIgnoreResult ; bool m_bBeforeFirst : 1; bool m_bAfterLast : 1; bool m_bIsInsertRow : 1;
// fire a notification for all that are listening on column::VALUE property void firePropertyChange(const ORowSetRow& _rOldRow); // fire a change for one column // _nPos starts at zero void firePropertyChange(sal_Int32 _nPos,const ::connectivity::ORowSetValue& _rNewValue);
// fire if rowcount changed virtualvoid fireRowcount(); // notify row changed virtualbool notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard); // notify cursor moved virtualvoid notifyAllListenersCursorMoved(::osl::ResettableMutexGuard& _rGuard);
// cancel the insertion, if necessary (means if we're on the insert row) virtualvoid doCancelModification( ) = 0; // return <TRUE/> if and only if we're using the insert row (means: we're updating _or_ inserting) virtualbool isModification( ) = 0; // return <TRUE/> if and only if the current row is modified // TODO: isn't this the same as isModification? virtualbool isModified( ) = 0; // return <TRUE/> if and only if the current row is the insert row virtualbool isNew( ) = 0; // return <TRUE/> if the property change notification should be fired // upon property change. virtualbool isPropertyChangeNotificationEnabled() const; // notify the change of a boolean property void fireProperty( sal_Int32 _nProperty, bool _bNew, bool _bOld );
enumclass CursorMoveDirection
{ /// denotes a cursor move forward
Forward, /// denotes a cursor move backwards
Backward, /// denotes no cursor move at all, but move cache to current row (if it is not there already)
Current, /// denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
CurrentRefresh
}; /** positions the cache in preparation of a cursor move
// returns a value of a column of the current row const connectivity::ORowSetValue& getValue(sal_Int32 columnIndex); // the cache has to be checked before calling this method const connectivity::ORowSetValue& impl_getValue(sal_Int32 columnIndex); // sets the current and the bookmark void setCurrentRow( bool _bMoved, bool _bDoNotify, const ORowSetRow& _rOldValues, ::osl::ResettableMutexGuard& _rGuard); /// @throws css::sdbc::SQLException /// @throws css::uno::RuntimeException void checkPositioningAllowed(); // checks if the cache is null void checkCache(); // sets the bookmark to Any() // m_aCurrentRow to end of matrix // m_aOldRow to NULL void movementFailed();
ORowSetRow getOldRow(bool _bWasNew); /** move the cache the position defined by the member functor @param_aCheckFunctor Return<TRUE/>whenwealreadystandontherowwewantto. @param_aMovementFunctor Themethodusedtomove. @return <TRUE/>ifmovementwassuccessful.
*/ bool SAL_CALL move( std::function<bool(ORowSetBase *)> const & _aCheckFunctor,
std::function<bool(ORowSetCache *)> const & _aMovementFunctor);
/** same meaning as isFirst. Only need by mem_fun @return <TRUE/>ifso.
*/ bool isOnFirst(); /** same meaning as isLast. Only need by mem_fun @return <TRUE/>ifso.
*/ bool isOnLast();
// is called when the rowset is going to delete this bookmark _rBookmark void onDeleteRow( const css::uno::Any& _rBookmark ); // is called when the rowset has deleted this bookmark _rBookmark void onDeletedRow( const css::uno::Any& _rBookmark, sal_Int32 _nPos );
/** eases the handling of the doCancelModification and notifyCancelInsert methods
<p>Theclasscanonlybeusedonthestack,withinamethodofORowSetBase(orderivees)</p>
*/ class ORowSetNotifier
{ private:
std::vector<sal_Int32> aChangedColumns;
ORowSetValueVector::Vector aRow;
ORowSetBase* m_pRowSet; // not acquired! This is not necessary because this class here is to be used on the stack within // a method of ORowSetBase (or derivees) bool m_bWasNew; bool m_bWasModified;
public: /** constructs the object, and cancels the insertion
/** use this one to construct a vector for change value notification
*/
ORowSetNotifier( ORowSetBase* m_pRowSet, ORowSetValueVector::Vector&& i_aRow );
// destructs the object. <member>fire</member> has to be called before.
~ORowSetNotifier( );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.