Freigeben über


Refreshing Row Data

A consumer can refresh the row data in its data buffer by completely releasing its row handles, refetching the rows into the rowset, and retrieving the data from the rowset's copies of the refetched rows. However, this process is somewhat cumbersome, particularly for applications in which multiple consumers are making changes to the same rows in the data store. To address the needs of such consumers, providers can support the IRowsetRefresh interface.

The methods in IRowsetRefresh enable the consumer to refetch rows from the data store into the rowset and to refresh row data in its own data buffer. To update rows in the rowset with data that is currently visible to the rowset in the data store, the consumer calls IRowsetRefresh::RefreshVisibleData. If fOverwrite is set to TRUE in the call to RefreshVisibleData, the provider discards any pending changes to a given row and accepts the visible values from the data store as the current values. If fOverwrite is set to FALSE, pending changes are not discarded. After calling IRowsetRefresh::RefreshVisibleData, the consumer calls IRowsetRefresh::GetLastVisibleData to retrieve the new row data into its data buffer.

Note

For deferred columns and for providers that do not cache visible data in the rowset, calling IRowsetRefresh::RefreshVisibleData with fOverwrite set to FALSE has no effect. However, consumers that need to work with general providers should always call IRowsetRefresh::RefreshVisibleData before calling IRowsetRefresh::GetLastVisibleData for any nondeferred columns; thus, they can be sure they get the latest data values from the data store.

IRowsetRefresh::GetLastVisibleData also allows the consumer to fetch row data directly from the data store, bypassing the rowset, when necessary to diagnose and repair collisions that occur under optimistic concurrency control. For more information, see IRowsetRefresh::GetLastVisibleData in the reference section.

Although the ability to obtain visible data is influenced by the DBPROP_OWNUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_OTHERUPDATEDELETE, and DBPROP_OTHERINSERT properties, it is independent of them. In other words, the value of these properties can be VARIANT_FALSE and the rowset can still expose IRowsetRefresh. However, because this is often difficult for providers to implement, many rowsets do not expose IRowsetRefresh unless the values of the DBPROP_OWNUPDATEDELETE and DBPROP_OTHERUPDATEDELETE properties are VARIANT_TRUE.