MDAC 2.5 SDK - OLE DB Providers
OSP Toolkit
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.
Following are the three levels of notifications that occur in this framework:
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. (For further information, refer to the OLE DB Programmer's Reference supplied with the MDAC SDK.)
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 SetVariant OSP method), it must also issue the OSP notifications (for example, the OLEDBSimpleProviderListener::CellChanged method).
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.
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: