This is an optional interface on sessions. It is used to provide advanced schema information.
Consumers can get information about a data source without knowing its structure by using the IDBSchemaRowset methods. For example, the data source might be a Microsoft SQL Server database that organizes each database into a set of schemas that contain the tables and queries for each schema; the data source might be a Microsoft Access 2.0 database that has a container of tables and a container of queries; or the data source might be a Microsoft Access for a Windows® 95 database that enables users to define folders to group tables into an arbitrary hierarchy.
For the following schema rowsets, it is suggested that providers pay particular attention to rowset construction and data retrieval performance, because these methods will be used frequently by consumers.
This schema defines a minimum content of the system schema. It is assumed that consumers will precompile and store the specialized queries 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.
For information about the schema rowsets, see Appendix B, "Schema Rowsets." Providers must return all of the columns in the rowsets they return. If they cannot return the information in a column, they must return an appropriate value. Generally, this is NULL. Providers can return provider-specific columns after the last column defined by OLE DB.
Schema rowsets are identified by GUIDs. The following table lists these GUIDs and the columns for which restrictions can be specified on the schema rowset. The number of restriction columns for each schema rowset are defined as constants prefixed with CRESTRICTIONS_ in the header files. Restriction values are treated as literals rather than as search patterns. For example, the restriction value "A_C" matches "A_C" but not "ABC".
GUID |
Number of restrictions |
Restriction columns |
DBSCHEMA_ASSERTIONS | 3 | CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME |
DBSCHEMA_CATALOGS | 1 | CATALOG_NAME |
DBSCHEMA_CHARACTER_SETS | 3 | CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA CHARACTER_SET_NAME |
DBSCHEMA_CHECK_CONSTRAINTS | 3 | CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME |
DBSCHEMA_COLLATIONS | 3 | COLLATION_CATALOG COLLATION_SCHEMA COLLATION_NAME |
DBSCHEMA_COLUMN_DOMAIN_ USAGE |
4 | DOMAIN_CATALOG DOMAIN_SCHEMA DOMAIN_NAME COLUMN_NAME |
DBSCHEMA_COLUMN_PRIVILEGES | 6 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME GRANTOR GRANTEE |
DBSCHEMA_COLUMNS | 4 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME |
DBSCHEMA_CONSTRAINT_ COLUMN_USAGE |
7 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME |
DBSCHEMA_CONSTRAINT_ TABLE_USAGE |
6 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME |
DBSCHEMA_FOREIGN_KEYS | 6 | PK_TABLE_CATALOG PK_TABLE_SCHEMA PK_TABLE_NAME FK_TABLE_CATALOG FK_TABLE_SCHEMA FK_TABLE_NAME |
DBSCHEMA_INDEXES | 5 | TABLE_CATALOG TABLE_SCHEMA INDEX_NAME TYPE TABLE_NAME |
DBSCHEMA_KEY_COLUMN_ USAGE |
7 | CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME |
DBSCHEMA_PRIMARY_KEYS | 3 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME |
DBSCHEMA_PROCEDURE_COLUMNS | 4 | PROCEDURE_CATALOG PROCEDURE_SCHEMA PROCEDURE_NAME COLUMN_NAME |
DBSCHEMA_PROCEDURE_ PARAMETERS |
4 | PROCEDURE_CATALOG PROCEDURE_SCHEMA PROCEDURE_NAME PARAMETER_NAME |
DBSCHEMA_PROCEDURES | 4 | PROCEDURE_CATALOG PROCEDURE_SCHEMA PROCEDURE_NAME PROCEDURE_TYPE |
DBSCHEMA_PROVIDER_TYPES | 2 | DATA_TYPE BEST_MATCH |
DBSCHEMA_REFERENTIAL_ CONSTRAINTS |
3 | CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME |
DBSCHEMA_SCHEMATA | 3 | CATALOG_NAME SCHEMA_NAME SCHEMA_OWNER |
DBSCHEMA_SQL_LANGUAGES | 0 | none |
DBSCHEMA_STATISTICS | 3 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME |
DBSCHEMA_TABLE_CONSTRAINTS | 7 | CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE |
DBSCHEMA_TABLE_PRIVILEGES | 5 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME GRANTOR GRANTEE |
DBSCHEMA_TABLES | 4 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE |
DBSCHEMA_TABLES_INFO | 4 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE |
DBSCHEMA_TRANSLATIONS | 3 | TRANSLATION_CATALOG TRANSLATION_SCHEMA TRANSLATION_NAME |
DBSCHEMA_USAGE_PRIVILEGES | 6 | OBJECT_CATALOG OBJECT_SCHEMA OBJECT_NAME OBJECT_TYPE GRANTOR GRANTEE |
DBSCHEMA_VIEW_COLUMN_ USAGE |
3 | VIEW_CATALOG VIEW_SCHEMA VIEW_NAME |
DBSCHEMA_VIEW_TABLE_USAGE | 3 | VIEW_CATALOG VIEW_SCHEMA VIEW_NAME |
DBSCHEMA_VIEWS | 3 | TABLE_CATALOG TABLE_SCHEMA TABLE_NAME |
For IDBSchemaRowset, providers must support the following GUIDs:
Method | Description |
GetRowset | Returns a schema rowset. |
GetSchemas | Returns a list of schema rowsets accessible by IDBSchemaRowset::GetRowset. |