Retrieving Information About a Session

From RAD Studio
Jump to: navigation, search

Go Up to Managing database sessions Index

Note: The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.

You can retrieve information about a session and its database components by using a session's informational methods. For example, one method retrieves the names of all aliases known to the session, and another method retrieves the names of tables associated with a specific database component used by the session. The following table summarizes the informational methods to a session component:

Database-related informational methods for session components

Method Purpose

GetAliasDriverName

Retrieves the BDE driver for a specified alias of a database.

GetAliasNames

Retrieves the list of BDE aliases for a database.

GetAliasParams

Retrieves the list of parameters for a specified BDE alias of a database.

GetConfigParams

Retrieves configuration information from the BDE configuration file.

GetDatabaseNames

Retrieves the list of BDE aliases and the names of any TDatabase components currently in use.

GetDriverNames

Retrieves the names of all currently installed BDE drivers.

GetDriverParams

Retrieves the list of parameters for a specified BDE driver.

GetStoredProcNames

Retrieves the names of all stored procedures for a specified database.

GetTableNames

Retrieves the names of all tables matching a specified pattern for a specified database.

GetFieldNames

Retrieves the names of all fields in a specified table in a specified database.


Except for GetAliasDriverName, these methods return a set of values into a string list declared and maintained by your application. (GetAliasDriverName returns a single string, the name of the current BDE driver for a particular database component used by the session.)

For example, the following code retrieves the names of all database components and aliases known to the default session:

var
  List: TStringList;
begin
  List := TStringList.Create;
  try
    Session.GetDatabaseNames(List);
    ...
  finally
    List.Free;
  end;
end;
TStringList *List = new TStringList();
try
{
  Session->GetDatabaseNames(List);
  .
  .
  .
}
catch (...)
{
delete List;
throw;
}
delete List;

See Also