Edit

Share via


IRowsetUpdateImpl Class

The OLE DB Templates implementation of the IRowsetUpdate interface.

Syntax

template <
   class T,
   class Storage,
   class UpdateArray = CAtlArray<Storage>,
   class RowClass = CSimpleRow,
   class MapClass = CAtlMap <RowClass::KeyType, RowClass*>
>

class IRowsetUpdateImpl : public IRowsetChangeImpl<
   T,
   Storage,
   IRowsetUpdate,
   RowClass,
   MapClass>

Parameters

T
A class derived from IRowsetUpdateImpl.

Storage
The user record.

UpdateArray
An array containing cached data for updating the rowset.

RowClass
The storage unit for the HROW.

MapClass
The storage unit for all row handles held by the provider.

Requirements

Header: atldb.h

Members

Interface Methods (Used with IRowsetChange)

Name Description
SetData Sets data values in one or more columns.

Interface Methods (Used with IRowsetUpdate)

Name Description
GetOriginalData Gets the data most recently transmitted to or obtained from the data source, ignoring pending changes.
GetPendingRows Returns a list of rows with pending changes.
GetRowStatus Returns the status of specified rows.
Undo Undoes any changes to the row since the last fetch or update.
Update Transmits any changes made to the row since the last fetch or update.

Implementation Methods (Callback)

Name Description
IsUpdateAllowed Used to check for security, integrity, and so on before allowing updates.

Data Members

Name Description
m_mapCachedData Contains the original data for the deferred operation.

Remarks

You should first read and understand the documentation for IRowsetChange, because everything described there also applies here. You should also read chapter 6 of the OLE DB Programmer's Reference on setting data.

IRowsetUpdateImpl implements the OLE DB IRowsetUpdate interface, which enables consumers to delay the transmission of changes made with IRowsetChange to the data source and undo changes before transmission.

Important

It is strongly recommended that you read the following documentation BEFORE attempting to implement your provider:

IRowsetUpdateImpl::SetData

Sets data values in one or more columns.

Syntax

STDMETHOD (SetData )(HROW hRow,
   HACCESSOR hAccessor,
   void* pSrcData);

Parameters

See IRowsetChange::SetData in the OLE DB Programmer's Reference.

Remarks

This method overrides the IRowsetChangeImpl::SetData method but includes caching of original data to permit either immediate or deferred processing of the operation.

IRowsetUpdateImpl::GetOriginalData

Gets the data most recently transmitted to or obtained from the data source, ignoring pending changes.

Syntax

STDMETHOD (GetOriginalData )(HROW hRow,
   HACCESSOR hAccessor,
   void* pData);

Parameters

See IRowsetUpdate::GetOriginalData in the OLE DB Programmer's Reference.

IRowsetUpdateImpl::GetPendingRows

Returns a list of rows with pending changes.

Syntax

STDMETHOD (GetPendingRows )(HCHAPTER /* hReserved */,
   DBPENDINGSTATUS dwRowStatus,
   DBCOUNTITEM* pcPendingRows,
   HROW** prgPendingRows,
   DBPENDINGSTATUS** prgPendingStatus);

Parameters

hReserved
[in] Corresponds to the hChapter parameter in IRowsetUpdate::GetPendingRows.

For other parameters, see IRowsetUpdate::GetPendingRows in the OLE DB Programmer's Reference.

Remarks

For more information, see IRowsetUpdate::GetPendingRows in the OLE DB Programmer's Reference.

IRowsetUpdateImpl::GetRowStatus

Returns the status of specified rows.

Syntax

STDMETHOD (GetRowStatus )(HCHAPTER /* hReserved */,
   DBCOUNTITEM cRows,
   const HROW rghRows[],
   DBPENDINGSTATUS rgPendingStatus[]);

Parameters

hReserved
[in] Corresponds to the hChapter parameter in IRowsetUpdate::GetRowStatus.

For other parameters, see IRowsetUpdate::GetRowStatus in the OLE DB Programmer's Reference.

IRowsetUpdateImpl::Undo

Undoes any changes to the row since the last fetch or update.

Syntax

STDMETHOD (Undo )(HCHAPTER /* hReserved */,
   DBCOUNTITEM cRows,
   const HROW rghRows[ ],
   DBCOUNTITEM* pcRowsUndone,
   HROW** prgRowsUndone,
   DBROWSTATUS** prgRowStatus);

Parameters

hReserved
[in] Corresponds to the hChapter parameter in IRowsetUpdate::Undo.

pcRowsUndone
[out] Corresponds to the pcRows parameter in IRowsetUpdate::Undo.

prgRowsUndone
[in] Corresponds to the prgRows parameter in IRowsetUpdate::Undo.

For other parameters, see IRowsetUpdate::Undo in the OLE DB Programmer's Reference.

IRowsetUpdateImpl::Update

Transmits any changes made to the row since the last fetch or update.

Syntax

STDMETHOD (Update )(HCHAPTER /* hReserved */,
   DBCOUNTITEM cRows,
   const HROW rghRows[],
   DBCOUNTITEM* pcRows,
   HROW** prgRows,
   DBROWSTATUS** prgRowStatus);

Parameters

hReserved
[in] Corresponds to the hChapter parameter in IRowsetUpdate::Update.

For other parameters, see IRowsetUpdate::Update in the OLE DB Programmer's Reference.

Remarks

Changes are transmitted by calling IRowsetChangeImpl::FlushData. The consumer must call CRowset::Update for the changes to take effect. Set prgRowstatus to an appropriate value as described in Row States in the OLE DB Programmer's Reference.

IRowsetUpdateImpl::IsUpdateAllowed

Override this method to check for security, integrity, and so on before updates.

Syntax

HRESULT IsUpdateAllowed(DBPENDINGSTATUS /* [in] */ /* status */,
   HROW /* [in] */ /* hRowUpdate */,
   DBROWSTATUS* /* [out] */ /* pRowStatus */);

Parameters

status
[in] The status of pending operations on the rows.

hRowUpdate
[in] Handle for the rows the user wants to update.

pRowStatus
[out] The status returned to the user.

Remarks

If you determine that an update should be allowed, returns S_OK; otherwise returns E_FAIL. If you allow an update, you also need to set the DBROWSTATUS in IRowsetUpdateImpl::Update to an appropriate row state.

IRowsetUpdateImpl::m_mapCachedData

A map containing the original data for the deferred operation.

Syntax

CAtlMap<
   HROW hRow,
   Storage* pData
>
m_mapCachedData;

Parameters

hRow
Handle to the rows for the data.

pData
A pointer to the data to be cached. The data is of type Storage (the user record class). See the Storage template argument in IRowsetUpdateImpl Class.

See also

OLE DB Provider Templates
OLE DB Provider Template Architecture
Creating an Updatable Provider