Sign in Join
FPDoc Onlineexperiment

RetrievingSchemaInformation topic

In unit SQLDB

Retrieving Schema Information.

Declaration

pascal
RetrievingSchemaInformation

Description

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

  • GetTableNames retrieves a list of available tables. The system tables can be requested.
  • GetProcedureNames retrieves a list of available stored procedures.
  • 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 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 GetTableNames.
stSysTables
Retrieves the list of system Tables in database. This is used internally by GetTableNames when the system tables are requested
stProcedures
Retrieves a list of stored procedures in database. This is used internally by GetProcedureNames.
stColumns
Retrieves the list of columns (fields) in a table. This is used internally by 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).

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.