Retrieves the data values from the data store that are visible to the transaction for the specified rows.
HRESULT RefreshVisibleData ( HCHAPTER hChapter, DBCOUNTITEM cRows, const HROW rghRows[], BOOL fOverwrite, DBCOUNTITEM *pcRowsRefreshed, HROW **prghRowsRefreshed, DBROWSTATUS **prgRowStatus);
Parameters
The rowset allocates memory for the handles and the client should release this memory with IMalloc::Free when no longer needed. This argument is ignored if pcRowsRefreshed is a null pointer and must not be a null pointer otherwise. If *pcRowsRefreshed is zero on output or the method fails, the provider does not allocate any memory and ensures that *prghRowsRefreshed is a null pointer on output.
The rowset allocates memory for the row status values and returns the address to this memory; the client releases this memory with IMalloc::Free when it is no longer needed. This argument is ignored if pcRowsRefreshed is a null pointer. If *pcRowsRefreshed is zero on output or the method fails, the provider does not allocate any memory and ensures that *prgRowStatus is a null pointer on output.
Return Code
pcRowsRefreshed was not a null pointer, and prghRowsRefreshed was a null pointer.
Comments
IRowsetRefresh::RefreshVisibleData retrieves the data values from the data store that are visible to the transaction for the specified rows. Changes made to the row by the current transaction are always visible to IRowsetRefresh::RefreshVisibleData, including changes made by other rowsets in the same transaction. Whether changes made by other transactions are visible to IRowsetRefresh::RefreshVisibleData depends on the isolation level of the current transaction. Therefore, RefreshVisibleData uses values as follows:
For providers that keep a local copy of visible data, IRowsetRefresh::RefreshVisibleData updates the provider's local copy of the visible data for any indicated rows with pending changes.
When fOverwrite is TRUE, the provider discards any pending changes to a given row and accepts the visible values as the new current values that will be returned by calling IRowset::GetData or IRowsetUpdate::GetOriginalData. This affects rows with or without pending changes. Any changes already transmitted to the data store are not lost; they will be committed or aborted when the transaction is committed or aborted. But all pending changes are lost because they exist only in the rowset's copy of the row and the fOverwrite TRUE option overwrites the contents of this copy. The pending change status in this case is removed from the row.
When fOverwrite is FALSE, the provider makes no change to the pending status of the row. It does not affect the current values of the row (available through IRowset::GetData) or the original values of the row (available through IRowsetUpdate::GetOriginalData). If the provider keeps a local copy of the visible data values, it refreshes the values for the indicated rows. If the provider does not keep a local copy of the visible data values, the indicated row has no pending changes, or if all columns in the row are deferred, the provider reports success without refreshing any rows.
Providers that perform optimistic updates in a disconnected scenario usually use the cached visible values on a pending row as the source of concurrency conflict detection values. For example, the values used to identify the row to a SQL-based provider through a WHERE clause would come from this buffer. Therefore, refreshing the visible values buffer for a row with pending changes via IRowsetRefresh::RefreshVisibleData potentially affects the behavior of a subsequent call to IRowsetUpdate::Update for that row because it may introduce new acceptable identity values into the conflict-detection mechanism of the provider.
If a specified row has been deleted from the data store and this deletion is visible, IRowsetRefresh::RefreshVisibleData returns DBROWSTATUS_E_DELETED in the error status array for the row. This row is subsequently treated as a deleted row for the purposes of IRowset::GetData (if fOverwrite is TRUE) or for IRowsetRefresh::GetLastVisibleData (if fOverwrite is FALSE).
If the handle of a deleted row has been specified in rghRows, the handle is returned in the prghRowsRefreshed array and the status is set to DBROWSTATUS_E_DELETED.
When cRows is zero, the provider may opt to not return any reference to hard-deleted rows. This is the preferred behavior. However, some providers may return hard-deleted rows, represented in the prghRowsRefreshed array by DB_NULL_HROW and with a status of DBROWSTATUS_E_DELETED.
If IRowsetRefresh::RefreshVisibleData encounters an error while attempting to refresh a row, such as a bad row handle, it notes the error in *prgRowStatus, continues processing, and returns DB_S_ERRORSOCCURRED or DB_E_ERRORSOCCURRED. Although the rows are refreshed in undefined order, the ordering of *prgRowStatus must match the order of the row handle array so that the consumer can perform a side-by-side scan of each array to determine which rows were not refreshed.
If cRows is zero and pcRowsRefreshed and prghRowsRefreshed are not null pointers, IRowsetRefresh::RefreshVisibleData adds to the reference count of the rows it returns in *prghRowsRefreshed to ensure that the consumer has these row handles.
IRowsetRefresh::GetLastVisibleData