OpenSchema Method

The OpenSchema method on a Connection object obtains database schema information from the provider.

recordset = connection.OpenSchema ( QueryType, Criteria, SchemaID )
 

Parameters

QueryType
This parameter specifies a SchemaEnum value that indicates the type of schema query to run. The SchemaEnum values supported by the OLE DB Provider for AS/400 and VSAM can be one of the following constants:
Enumeration Value Description
adSchemaColumns 4 This value indicates that the QueryType is requesting column information for tables on the server (not supported when connecting to mainframes )..
adSchemaIndexes 12 This value indicates that the QueryType is requesting index information about the tables on the server (not supported when connecting to mainframes ).
adSchemaTables 20 This value indicates that the QueryType is requesting information about the tables on the server.
adSchemaProviderTypes 22 This value indicates that the QueryType is requesting provider type information.

Criteria
This optional parameter specifies an array of query constraints for each QueryType option, as listed below. The values supported by the OLE DB Provider for AS/400 and VSAM can be one of the following constants depending on the QueryType:
QueryType / Enumeration Value Description
adSchemaColumns
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME
adSchemaIndexes
TABLE_CATALOG
TABLE_SCHEMA
INDEX_NAME
TYPE
TABLE_NAME
adSchemaTables
TABLE_CATALOG
TABLE_SCHEMA
TABLE_NAME
TABLE_TYPE
adSchemaProviderTypes
DATA_TYPE
BEST_MATCH

SchemaID
This optional parameter specifies the GUID for a provider-schema schema query not defined by the OLE DB specification. This parameter is required if the QueryType parameter is set to adSchemaProviderSpecific; otherwise, it is not used. This parameter is not supported by the OLE DB Provider for AS/400 and VSAM.

Return Values

Returns a Recordset object that contains schema information requested.

Remarks

The OpenSchema method on a Connection object is used to return information about the data source, such as information about the tables on the server and the columns in the tables.

The Criteria argument is an array of values that can be used to limit the results of a schema query. Each schema query supports a different set of parameters. The actual schemas are defined by the OLE DB specification under the IDBSchemaRowset interface. The schema queries supported in ADO 1.5 by the OLE DB Provider for AS/400 and VSAM are listed above.

Providers are not required to support all of the OLE DB standard schema QueryType values. 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. Support for other schema QueryType values is optional.

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 ADO and OLE DB is retrieved using predefined schema rowsets. The following section lists the contents of each schema rowset supported by the OLE DB Provider for AS/400 and VSAM.