Data.SqlExpr.TCustomSQLDataSet.SetSchemaInfo

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetSchemaInfo(SchemaType: TSchemaType; SchemaObjectName, SchemaPattern: string; PackageName: string = '' );

C++

void __fastcall SetSchemaInfo(TSchemaType SchemaType, System::UnicodeString SchemaObjectName, System::UnicodeString SchemaPattern, System::UnicodeString PackageName = System::UnicodeString());

Properties

Type Visibility Source Unit Parent
procedure
function
public
Data.SqlExpr.pas
Data.SqlExpr.hpp
Data.SqlExpr TCustomSQLDataSet

Description

Indicates whether the dataset represents metadata from the server, and if so, what kind.

Call SetSchemaInfo to indicate whether the SQL dataset represents the results of an SQL command (specified by CommandText) or whether it represents a table of schema information (metadata).

The SchemaType parameter identifies the type of information you want. It can have any of the following values:



Value Description

stNoSchema

No schema information. The SQL dataset is populated with the results of its query or stored procedure rather than metadata from the server.

stTables

Information about all the data tables on the database server that match the criteria specified by the SQL connection's TableScope property.

stSysTables

Information about all of the system tables on the database server. Not all servers use system tables to store metadata. Requesting a list of system tables from a server that does not use them results in an empty dataset.

stProcedures

Information about all of the stored procedures on the database server.

stColumns

Information about all of the columns (fields) in a specified table.

stProcedureParams

Information about all of the parameters of a specified stored procedure.

stIndexes

Information about all of the indexes defined for a specified table.



SchemaObjectName is the name of the table or stored procedure about whose columns, indexes, or parameters you want information. When SchemaType is stColumns or stIndexes, SchemaObjectName is the name of a table. When SchemaType is stProcedureParams, SchemaObjectName is the name of a stored procedure. When SchemaType is stNoSchema, stTables, stSysTables, or stProcedures, or stPackages, SchemaObjectName is ignored.

SchemaPattern is an SQL pattern mask that filters the resulting dataset. The name of each item (table, stored procedure, field, parameter, or index) must match this pattern mask or it does not appear as a record when the SQL dataset is opened. SchemaPattern uses the wildcards '%' (to match a string of arbitrary characters of any length) and '_' (to match a single arbitrary character). To use a literal percent or underscore in a pattern, the character is doubled (%% or __). If you do not want to use a pattern, set Pattern to nil (Delphi) or NULL (C++).

PackageName is the name of an Oracle package in which to find the stored procedure when SchemaType is stProcedures or stProcedureParams. If the server is not an Oracle server, or if the stored procedure is not defined in a package, PackageName should be an empty string.

After a call to SetSchemaInfo, opening the dataset results in a dataset populated with the specified information. If SchemaType is stNoSchema, the dataset reverts to the command specified by CommandText.

Note: When you change the CommandText property, the dataset automatically reverts to a SchemaType of stNoSchema.

See Also