Поделиться через


Row States in Deferred Update Mode

A row has a state that depends on whether it has been changed and whether that change is pending or transmitted. Consumers call IRowsetUpdate::GetRowStatus to determine the state of a row. They call IRowsetUpdate::GetPendingRows to get all rows in a pending change state. The state is indicated by the DBPENDINGSTATUS enumerated type. The values in this type and their meanings are listed in the following table.

Status value

Row state

Description

DBPENDINGSTATUS_NEW

Pending Insert

The row has a pending insert.

DBPENDINGSTATUS_CHANGED

Pending Update

The row has a deferred change.

DBPENDINGSTATUS_DELETED

Pending Delete

The row has a pending delete. This state is sometimes called soft delete.

DBPENDINGSTATUS_UNCHANGED

Unchanged

No changes have been made to the row, or changes that were made to the row have been transmitted or undone.

DBPENDINGSTATUS_INVALIDROW

Invalid

The row has been deleted and that deletion has been transmitted to the data store. This status is also used when a row handle passed to IRowsetUpdate::GetRowStatus was invalid. This state is sometimes called hard delete.

The Unchanged and Invalid states are the nonpending change states. The Pending Insert, Pending Update, and Pending Delete states are the pending change states. The following illustration shows these states, how methods affect them, and the corresponding DBPENDINGSTATUS values.

Pending change states

states, values and methods of pending changes

If the consumer calls IRowset::ReleaseRows for a row and the reference count for that row falls to zero, release of the row and its resources depends on the row's state. In the nonpending change states, the row and its resources are usually released when the reference count falls to zero, although the actual point of release is provider-specific.

In the pending change states, the row and its resources are not released when the reference count falls to zero nor are the pending changes lost. The row remains valid until the changes are transmitted or undone (the row moves to a nonpending change state), and then the row and its resources are released. Rows in a pending change state that have a reference count of zero are still considered active when, for example, calculating row limits such as those returned by the DBPROP_MAXOPENROWS and DBPROP_MAXPENDINGROWS properties. Although the row handle might remain valid for such rows, consumers should not rely on this.

This topic is a part of: