Changing Data

Consumers change data by calling the methods SetData, DeleteRows, and InsertRow in IRowsetChange. These methods change the data for a row in the rowset's copy of the row. Whether the method immediately transmits these changes to the data source depends on whether the rowset exposes IRowsetUpdate.

If the rowset does not expose IRowsetUpdate, it is said to be in immediate update mode. In immediate update mode, the methods in IRowsetChange transmit changes to the data source, where they become visible to other transactions running at the Read Uncommitted transaction isolation level. Such changes are transmitted changes.

If the rowset exposes IRowsetUpdate, it is in delayed update mode. In delayed update mode, the methods in IRowsetChange do not transmit changes to the data source. Instead, they buffer the changes in the rowset; such changes are pending changes. While changes are pending, they are wholly local to the rowset and therefore not visible to other transactions, even those running at the Read Uncommitted isolation level.

To transmit pending changes to the data source, the consumer calls IRowsetUpdate::Update. As in immediate update mode, such changes then become visible to other transactions running at the Read Uncommitted transaction isolation level and are transmitted changes.

If the rowset was created in the context of a transaction, the consumer can commit or abort transmitted changes by calling ITransaction::Commit or ITransaction::Abort to commit or abort them. Committed changes become visible to other transactions running at the Read Committed transaction isolation level. If the consumer commits or aborts transmitted changes and there are still pending changes, then what happens to those pending changes depends on the DBPROP_COMMITPRESERVE and DBPROP_ABORTPRESERVE properties. For more information, see "Rowset Preservation" in "Commit and Abort Behavior" in Chapter 12.

The following figure shows how the methods in IRowsetChange, IRowsetUpdate, and ITransaction move data.

IRowsetChange, IRowsetUpdate, and ITransaction methods moving data

To get a read-only rowset, the consumer does not request IRowsetChange or IRowsetUpdate as a property of the rowset.