MDAC 2.5 SDK - OLE DB Providers
Cursor Service for OLE DB


 

Optimistic Conflict Resolution within the Synchronization Functionality

                   

For each row that has changed in a rowset, the Cursor Service maintains a copy of the original row fetched from the provider. When the updates are sent to the server, the synchronization service compares original values with the current values on the server to verify whether or not the row has changed since the data was fetched. The synchronization service compares the values using a combination of key columns, row timestamps, changed fields, and sometimes the entire row.

For rows successfully updated, the synchronization service sets the underlying value and sets the status to DBROWSTATUS_S_OK, or to DBROWSTATUS_E_DELETED for deleted rows. For rows not successfully updated, the synchronization service passes DBROWSTATUS_S_NOCHANGE to prevent a change of the row status but still sets the underlying value (assuming DBROWOP_GETVISIBLE was specified).

If a conflict is detected, the status for that row changes to indicate an update conflict. You have the option to get the current values for the conflicting row and compare them with the original row values and the changed values in the rowset. After you resolve the conflict, the update can be submitted again, this time using the current values to detect new update conflicts. The update service has the option to get current data for all conflicting rows in a batch. It also allows you to control how the local data is updated when conflicts are detected, to match the transaction model implemented by the application.

The Cursor Service updates its internal values. For any rows whose status is DBROWSTATUS_S_OK, the rowset discards any pending changes and updates its original values. For any rows whose status is DBROWSTATUS_E_DELETED, it deletes the row from its caches.