Compartilhar via


Changing Data

Providers that allow consumers to change rowset data do so by exposing IRowsetChange on the rowset object. Consumers use the methods in IRowsetChange to update the values of columns in existing rows, delete existing rows, or insert new rows. These methods operate on the rows in the rowset. Whether these changes are immediately transmitted to the underlying data store 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 from the rowset to the underlying data store, where they become visible to other transactions running at the Read Uncommitted transaction isolation level. Such changes are called transmitted changes.

If the rowset does expose IRowsetUpdate, it is said to be in deferred update mode. In deferred update mode, the methods in IRowsetChange do not transmit changes to the data store. 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 underlying data store, 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. 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, what happens to those pending changes depends on the DBPROP_COMMITPRESERVE and DBPROP_ABORTPRESERVE properties. For more information, see Committing and Aborting Simple Transactions.

The following illustration shows how the methods in IRowsetChange, IRowsetUpdate, and ITransaction update data.

IRowsetChange, IRowsetUpdate, and ITransaction methods updating data

Methods for updating a rowset

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

This topic is a part of: