OpenSchema Method - ADO

Obtains database schema information from the provider.

Applies To

Connection

Required Files

msado15.dll
VC: adoint.h, adoid.h

Syntax

connection.OpenSchema (QueryType, Criteria)

QueryType The type of schema query to run. Can be any of the constants listed under Settings.
Criteria Optional. An array of query constraints for each QueryType option, as listed under Settings.

Settings

The QueryType argument can be any of the following enumerated constants:

QueryType values Description Criteria values
adSchemaAsserts 0 CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
adSchemaCatalogs 1 CATALOG_NAME
adSchemaCharacterSets 2 CHARACTER_SET_CATALOG
CHARACTER_SET_SCHEMA
CHARACTER_SET_NAME
adSchemaCheckConstraints 5 CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
adSchemaCollations 3 COLLATION_CATALOG
COLLATION_SCHEMA
COLLATION_NAME
adSchemaColumnDomainUsage 11 DOMAIN_CATALOG
DOMAIN_SCHEMA
DOMAIN_NAME
COLUMN_NAME
adSchemaColumnPrivileges 13 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
GRANTOR
GRANTEE
adSchemaColumns 4 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
adSchemaConstraintColumnUsage 6 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
adSchemaConstraintTableUsage 7 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
adSchemaForeignKeys 27 PK_TABLE_CATALOG
PK_TABLE_SCHEMA
PK_TABLE_NAME
FK_TABLE_CATALOG
FK_TABLE_SCHEMA
FK_TABLE_NAME
adSchemaIndexes 12 TABLE_CATALOG
TABLE_SCHEMA
INDEX_NAME
TYPE
TABLE_NAME
adSchemaKeyColumnUsage 8 CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
adSchemaPrimaryKeys 28 PK_TABLE_CATALOG
PK_TABLE_SCHEMA
PK_TABLE_NAME
adSchemaProcedureColumns 29 PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
COLUMN_NAME
adSchemaProcedureParameters 26 PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
PARAMTER_NAME
adSchemaProcedures 16 PROCEDURE_CATALOG
PROCEDURE_SCHEMA
PROCEDURE_NAME
PARAMTER_TYPE
adSchemaProviderTypes 22 DATA_TYPE
BEST_MATCH
adSchemaReferentialConstraints 9 CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
adSchemaSchemata 17 CATALOG_NAME
SCHEMA_NAME
SCHEMA_OWNER
adSchemaSQLLanguages 18 <none>
adSchemaStatistics 19 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
adSchemaTableConstraints 10 CONSTRAINT_CATALOG
CONSTRAINT_SCHEMA
CONSTRAINT_NAME
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
CONSTRAINT_TYPE
adSchemaTablePrivileges 14 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
GRANTOR
GRANTEE
adSchemaTables 20 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
TABLE_TYPE
adSchemaTranslations 21 TRANSLATION_CATALOG
TRANSLATION_SCHEMA
TRANSLATION_NAME
adSchemaUsagePrivileges 15 OBJECT_CATALOG
OBJECT_SCHEMA
OBJECT_NAME
OBJECT_TYPE
GRANTOR
GRANTEE
adSchemaViewColumnUsage 24 VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAME
adSchemaViewTableUsage 25 VIEW_CATALOG
VIEW_SCHEMA
VIEW_NAME
adSchemaViews 23 TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME

Return Values

Returns a Recordset object that contains schema informaton.

Remarks

The OpenSchema method returns information about the data source, such as information about the tables on the server and the columns in the tables.

The possible queries are listed in the OLE DB reference under IDBSchemaRowset. ???Include that info here??? The Criteria argument is an array of values that can be used to limit the results of a schema query. Each schema query has a different set of parameters that it supports. The actual schemas are defined by the OLE DB specification under the “IDBSchemaRowset” interface. The ones supported in ADO 1.5 are listed above.

Providers are not required to support all the schema queries. Specifically, only adSchemaTables, adSchemaColumns and adSchemaProviderTypes are required by the OLE DB specification. However, the provider is not required to support the Criteria constraints listed above for those schema queries.

See Also

ADO Providers


© 1997 Microsoft Corporation. All rights reserved. Terms of Use.