|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
OLE DB Provider Templates
The classes and interfaces for the OLE DB Provider Templates can be grouped into the following categories. The reference material also includes information about the macros for OLE DB Provider Templates.
The classes use the following naming convention: a class named with the pattern IWidgetImpl would provide an implementation of the interface IWidget.
- Creates a new session from the data source object and returns the requested interface on the newly created session. Mandatory interface on data source objects.
- Implements session properties by calling a static function defined by the property set map. The property set map should be specified in your session class. Mandatory interface on sessions.
Provides a standard OLE DB rowset implementation without requiring multiple inheritance of many implementation interfaces. The only method for which you must provide implementation is Execute.
- Provides a default implementation for the row handle, which is used in the IRowsetImpl class. A row handle is logically a unique tag for a result row. IRowsetImpl creates a new CSimpleRow for every row requested in IRowsetImpl::GetNextRows.
- OLE DB requires providers to implement an HACCESSOR, which is a tag to an array of DBBINDING structures. Provides HACCESSORs that are addresses of the BindType structures. Mandatory on rowsets and commands.
- Delegates to a static function defined by the provider column map. Mandatory interface on rowsets and commands.
- Gives information on the availability of type conversions on a command or on a rowset. Mandatory on commands, rowsets, and index rowsets. Implements the IConvertType interface by delegating to the conversion object supplied by OLE DB.
- Implements the IDBSchemaRowset interface and the templatized creator function CreateSchemaRowset.
- Opens and returns a rowset that includes all rows from a single base table or index. Mandatory interface for a session object.
- Implements the OLE DB IRowsetChange interface, which enables updating of the values of columns in existing rows, deleting rows, and inserting new rows.
- This class inherits from IObjectWithSite and overrides IObjectWithSite::SetSite. IRowsetCreatorImpl performs the same functions as IObjectWithSite but also enables the OLE DB properties DBPROPCANSCROLLBACKWARDS and DBPROPCANFETCHBACKWARDS.
- Implements the IRowsetIdentity interface, which allows you to compare whether two rows of data are identical or not.
- Provides an implementation of the IRowset interface, which is the base rowset interface.
- Implements the rowset properties by using the property set map defined in your command class. Mandatory interface on rowsets.
- Implements the OLE DB IRowsetLocate interface, which fetches arbitrary rows from a rowset. To support OLE DB bookmarks in a rowset, make the rowset inherit from this class.
- Implements broadcast functions to advise listeners on the connection point IID_IRowsetNotify of changes to the contents of the rowset. Consumers that handle notifications implement IRowsetNotify and register it on that connection point.
- Implements the OLE DB IRowsetUpdate interface, which enables consumers to delay the transmission of changes made with IRowsetChange to the data source and undo changes before transmission.
- Provides an implementation of the ICommand interface. This interface is not visible, but is handled by ICommandTextImpl. A mandatory interface on the command object.
- This implementation of the ICommandProperties interface is provided by a static function defined by the BEGIN_PROPSET_MAP macro. Mandatory on commands.
- Sets, stores, and returns the command text. Mandatory on commands.
- Creates a new command from the session object and returns the requested interface on the newly created command. Optional interface on session objects.
Other command classes are IColumnsInfoImpl and IAccessorImpl, described in the Rowset Classes section above.
Data Source Classes
- Creates and deletes the connection with the consumer. Mandatory interface on data source objects and optional interface on enumerators.
- IDBProperties is a mandatory interface for data source objects and an optional interface for enumerators. However, if an enumerator exposes IDBInitialize, it must expose IDBProperties (properties on the data source).
- Obtains an interface pointer to the data source object. Mandatory interface on the session.
- Implements properties for a variety of OLE DB property interfaces (for example, IDBProperties, ISessionProperties, and IRowsetInfo).
Implements the OLE DB IErrorRecords interface, adding records to and retrieving records from a data member.