[Previous][Up][Next] | Reference for unit 'SQLDB' (#fcl)

## Retrieving Schema Information

Schema Information (lists of available database objects) can be retrieved using some specialized calls in TSQLConnection:

- TSQLConnection.GetTableNames retrieves a list of available tables. The system tables can be requested.
- TSQLConnection.GetProcedureNames retrieves a list of available stored procedures.
- TSQLConnection.GetFieldNames retrieves a list of fields for a given table.

These calls are pretty straightforward and need little explanation. A more versatile system is the schema info query: the TCustomSQLQuery.SetSchemaInfo method can be used to create a result set (dataset) with schema information. The parameter SchemaType determines the resulting information when the dataset is opened. The following information can be requested:

stTables
  Retrieves the list of user Tables in database. This is used internally by TSQLConnection.GetTableNames.
stSysTables
  Retrieves the list of system Tables in database. This is used internally by TSQLConnection.GetTableNames when the system tables are requested
stProcedures
  Retrieves a list of stored procedures in database. This is used internally by TSQLConnection.GetProcedureNames.
stColumns
  Retrieves the list of columns (fields) in a table. This is used internally by TSQLConnection.GetFieldNames.
stProcedureParams
  This retrieves the parameters for a stored procedure.
stIndexes
  Retrieves the indexes for one or more tables. (currently not implemented)
stPackages
  Retrieves packages for databases that support them. (currently not implemented).

Documentation generated on: May 14 2021