MDAC 2.5 SDK - OLE DB Programmer's Reference
Appendix B: Schema Rowsets


 

Appendix B: Schema Rowsets

The schema information specified in OLE DB is based on the assumption that providers support the concepts of a catalog and a schema. The ANSI SQL-92 specification defines them as follows:

Schema information in OLE DB is retrieved using predefined schema rowsets; this appendix lists the contents of each schema rowset.

Schema rowsets are retrieved with IDBSchemaRowset::GetRowset. IDBSchemaRowset::GetRowset allows consumers to specify simple restrictions, such as returning all the columns in a particular table. Each schema rowset is guaranteed to return all of the columns in the order shown in the section detailing that rowset. In addition, providers can return provider-specific columns after the last column defined by OLE DB.

In implementing IDBSchemaRowset, it is suggested that providers pay particular attention to rowset construction and data retrieval performance because these commands will be used frequently by consumers.

This information schema also defines a minimum content of the system schema. It is assumed that consumers will prepare and store the specialized commands used for things such as command planning and execution-time plan validation, and storage engines may have specialized optimizations associated with those plans. Consumers can also look at the schema tables in the schema and thus discover other schema tables and attributes beyond the minimum set.

Note   If a provider returns non-NULL CATALOG or SCHEMA column values in schema rowsets, it must support IDBInfo to describe how a fully qualified name is assembled. A provider that does not support IDBInfo must return NULL values for CATALOG and SCHEMA columns in all schema rowsets.

For schema rowset columns of type DBTYPE_WSTR, the provider returns, as the column size in IColumnsInfo or IColumnsRowset, the maximum number of characters that can appear in this column of the schema rowset. The provider guarantees that no value in the column will exceed this length but does not guarantee that an element of the column could actually contain that many characters. If the provider always returns NULL for the column, it may return zero as the maximum length of the column in IColumnsInfo and IColumnsRowset.