Notifications (OLE DB)

Notifications allow the provider layers to communicate changes in the underlying data source to other consumers or controls that register an interest. Notifications are required by the OLE DB Simple Provider DLL. The following illustration shows how notifications are issued and received in the OLE DB Simple Provider framework.

notifications process flow in OLE DB provider

Following are the three levels of notifications that occur in this framework:

  • OLE DB notifications

  • OSP notifications

  • Data source notifications

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, write a fully functional OLE DB provider using the native OLE DB interfaces.

OLE DB Notifications

These notifications are issued by the OLE DB Simple Provider DLL (Msdaosp.dll), and are consumed by any OLE DB control or application that wants to be notified about changes (through OLE DB) to a rowset from other consumers. They are implemented through the IRowsetNotify OLE DB interface.

OSP Notifications

These notifications are issued by the OSP object and other objects that might be changing data owned by the OSP object. The notifications consist of methods belonging to the OSP OLEDBSimpleProviderListener interface. The listener for this set of notifications is the OLE DB Simple Provider DLL. For example, suppose one OSP serves an array data source. If another object outside that OSP alters an element in the array data (using the OLEDBSimpleProvider::setVariant OSP method), it must also issue the OSP notifications (for example, the OLEDBSimpleProviderListener::cellChanged method).

Note

The OSP should always send the appropriate pre-notification event using the OSP OLEDBSimpleProviderListener interface (aboutToChangeCell, aboutToDeleteRows, or aboutToInsertRows). If the change succeeds, the OSP also should send the appropriate post-notification using the same interface with the following methods: insertedRows, changedCells, and deletedRows.

When a failure occurs, notifications are not sent to the listener.

Data Source Notifications

These notifications are issued by the OSP Data Object. It is possible that other controls or applications not consuming data through the OLE DB Simple Provider DLL may be refreshing or changing the same data source held by an OSP. In these cases, data source notifications come into play. For example, suppose a filter property on a control can alter array data exposed by an OSP. If the filter property is changed, the code must issue data source notifications to indicate that the entire data source has changed.

Data source notifications are listened to by code that has requested data sources through the data binding interfaces (either IDataSource or msDataSourceObject through IDispatch). The listener depends on which object issued IDataSource::getDataMember. The OLE DB Simple Provider DLL will listen to these notifications (through DataSourceListener) when it requests an OSP. If a change to the data occurred, the rowset being held by the OSP is in an invalid state (a "zombie" state) and must be released. The application can make a fresh request to get the new data via IDataSource::getDataMember or msDataSourceObject.

Additional Information

OSP and data source listeners (OLEDBSimpleProviderListener and DataSourceListener) are not capable of vetoing or canceling a notification. Therefore, developers do not need to check the results of a pre-notification to validate whether the data change has actually occurred.

The OLE DB Simple Provider DLL is capable of opening more than one rowset at a time on a simple provider, as long as the simple provider's data source and OSP objects support multiple listeners. It is the provider writer's responsibility to accommodate multiple listeners by performing the following services:

  • Maintaining a list of listeners when adding or removing data source or OSP listeners.

  • Notifying each listener in this list when firing data source or OSP notifications.