RAD Studio
|
To populate a unidirectional dataset with metadata from the database server, you must first indicate what data you want to see, using the SetSchemaInfo method. SetSchemaInfo takes three parameters:
The following call requests a table listing all system tables (server tables that contain metadata):
SQLDataSet1.SetSchemaInfo(stSysTable, "", "");
SQLDataSet1->SetSchemaInfo(stSysTable, "", "");
When you open the dataset after this call to SetSchemaInfo, the resulting dataset has a record for each table, with columns giving the table name, type, schema name, and so on. If the server does not use system tables to store metadata (for example MySQL), when you open the dataset it contains no records.
The previous example used only the first parameter. Suppose, Instead, you want to obtain a list of input parameters for a stored procedure named 'MyProc'. Suppose, further, that the person who wrote that stored procedure named all parameters using a prefix to indicate whether they were input or output parameters ('inName', 'outValue' and so on). You could call SetSchemaInfo as follows:
SQLDataSet1.SetSchemaInfo(stProcedureParams, "MyProc", "in%");
SQLDataSet1->SetSchemaInfo(stProcedureParams, "MyProc", "in%");
The resulting dataset is a table of input parameters with columns to describe the properties of each parameter.
There are two ways to return to executing queries or stored procedures with the dataset after a call to SetSchemaInfo:
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|