MDAC 2.5 SDK - OLE DB Programmer's Reference
OLE DB Interfaces


 

IDBSchemaRowset

This is an optional interface on sessions. It is used to provide advanced schema information.

Consumers can get information about a data store without knowing its structure by using the IDBSchemaRowset methods. For example, the data store 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 store might be a Microsoft Access 2.0 database that has a container of tables and a container of queries; or the data store might be a Microsoft Access for 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

Providers that implement IDBSchemaRowset must, at a minimum, support the passing of the restrictions according to the VARIANT types below. Providers are allowed to support restrictions passed as other types but must convert as dictated by the OLE DB specification.

The VARIANT types to be used for a restriction, when given the type of the schema rowset column, are listed in the following table. 

Restriction column OLE DB type VARIANT type of passed restriction
DBTYPE_BOOL VT_BOOL
DBTYPE_DATE VT_DATE
DBTYPE_GUID VT_BSTR (string in registry format: "{xxxxxxxx-xxxx...}")
DBTYPE_I2 VT_I2
DBTYPE_I8 VT_I8
DBTYPE_UI2 VT_UI2
DBTYPE_UI4 VT_UI4
DBTYPE_UI8 VT_UI8
DBTYPE_WSTR VT_BSTR

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.