MDAC 2.5 SDK - OLE DB Providers
OLE DB Remoting Provider


 

How the Synchronization Functionality Works with the Remoting Provider

See Also    Interfaces               

The two distinct components involved in buffered updating are the cursor component and the synchronization component. The cursor component is responsible for buffering the data and exposing the data as an OLE DB rowset. The synchronization functionality works within the Cursor Service component by synchronizing changes made through the rowset with the data store and by updating the rowset with values changed in the data store outside the rowset.

The goal of synchronization is to reflect changes to the original data store in the client cursor. To do this when the Remoting Provider is used, the provider returns a Cursor Service component rowset object when the consumer requests a new rowset. If changes are made to this rowset and the consumer calls IRowsetUpdate::Update, IRowsetResynch::ResynchRows, or IRowsetRefresh::RefreshVisibleData on a rowset, the Cursor Service component synchronizes the rowset with the one exposed by the Remoting Provider.

The provider then creates a wrapper rowset object, which adds calls to GetNextRows and GetPendingRows to the same Cursor Service component method calls. These two methods keep track of the order in which they return rows. The rows with pending changes are returned by GetPendingRows, whereas the rows without pending changes are returned by GetNextRows. Returning DBPENDINGSTATUS_NOCHANGE and then calling GetOriginalData for GetData hides the pending changes on these rows.

The Persistence Provider is used to pass the updated rows to the DataFactory on the server. Once the changed rows are on the server, the synchronization component creates another Cursor Service component on the server and loads it with all the rows. GetPendingRows and GetNextRows are used to fetch the rows from the Cursor Service component. Synchronization is performed when the component calls IRowsetUpdate::Update or IRowsetRefresh::RefreshVisibleData.

The RowStatus array is returned by the Update or RefreshVisibleData method. The rowset that the Remoting Provider receives will be missing successfully deleted rows but will be in the same order as the rows sent.

Using the RowStatus array, the Remoting Provider will finally make the necessary changes to the client Cursor Service rowset.