Microsoft KB Archive/185822

{|
 * width="100%"|

INFO: Creating Robust OLE DB Providers with OSP

 * }

-

The information in this article applies to:


 * Microsoft OLE DB, version 1.5
 * Microsoft Data Access Components version 2.1 SP2

-

SUMMARY
The OLE DB Simple Provider (OSP) Toolkit allows you to create robust OLE DB Providers. The toolkit is included with the OLE DB 1.5 SDK available from the web site listed in the REFERENCES section. With the OSP, you implement just 14 functions to create a fully functional OLE DB Provider. OSP is also the only mechanism by which you can use either Visual Basic or Visual J++ to implement a provider (as well as Visual C++). An OSP-generated provider is fully compliant with the current OLE DB Leveling specification as well as with the OLE DB Conformance tests.

MORE INFORMATION
While a powerful mechanism for creating an OLE DB Data Provider, the OSP does have limitations in the capabilities of the provider it can build. The OSP does not support Commands, Transactions, Batch Updates or Provider- owned memory. In addition, it does not provide any meta data about the rowset. It can return a column name, but not type, max length, and so forth. The OSP also returns all data as variants. There is no way that you, as a developer, can code around these limitations. Unlike a provider you develop without the OSP, the OSP cannot be extended to support any objects or interfaces other than what is offered by the Msdaosp.dll file. If you can live with these limitations, the OSP Toolkit does offer a simple and powerful means for quickly implementing an OLE DB Data Provider.

OSP works via the Msdaosp.dll file, which implements the bulk of OLE DB interfaces needed to pass Level 0 and Level 1 Conformance testing. When invoked, it then calls the DLL you write with the toolkit that requires you to implement 14 functions. These functions are divided up into several categories. The categories are listed below.

Schema Functions

 * getRowCount
 * getColumnCount
 * getRWStatus

Access Functions

 * getVariant
 * setVariant

Update Functions

 * deleteRows
 * insertRows

Asynchronous Functions

 * isAsync
 * getEstimatedRows
 * stopTransfer

Listener Functions (notifications)

 * addOLEDBSimpleProviderListener
 * removeOLEDBSimpleProviderListener

Miscellaneous Functions

 * getLocale
 * Find

OLE DB Provider Leveling and Conformance Tests
OLE DB Leveling is a specification to ensure that all providers support a base level of functionality (Level 0) and extended functionality (Level 1) for a consumer such as ADO. An early draft of the OLE DB Leveling document is included in the OLE DB 1.5 SDK, and is located at:

  \OLEDBSDK\PREVIEW\OELDBLEVELING.DOC. The OLE DB 1.5 SDK also includes a series of tests, and two tools for managing them; The Local Test Manager (LTM) and the OLE DB Test Editor. The Local Test Manager is an easy to use tool that provides a single point of control for automated testing of OLE DB providers. The Microsoft OLE DB Test Editor enters the automated test framework code in a .cpp file for use with Local Test Manager. Once you have created your test modules, using the OLE DB Test Editor, you can use LTM to select and run a test module and its cases, variations, and providers on a single local computer.

For the current release, the OLE DB SDK includes sample test modules in the \Oledbsdk\Unspprtd\Tests folder. Each test module is named with an abbreviated form of the interface it tests. These tests, provided in source code form, can be compiled and run through the Local Test Module. These test modules are offered only as examples of test code and are not supported in any way. You may not make any claims of conformance based on these tests, nor may you redistribute them in whole or in part. Microsoft is actively working with Independent Software Vendors (ISVs) on conformance issues to improve the quality of their providers, and the OLE DB Conformance Tests are one mechanism being used to accomplish this.