Requesting Database and Server Status Reports
Go Up to Working with InterBase Services
TIBStatisticalService contains many properties and methods to allow you to build a statistical component into your application. Only the
SYSDBA user or owner of the database will be able to run this service.
Requesting Database Statistics
Options property of
TIBStatisticalService to request database statistics. These options are incremental; that is, setting
DbLog to <True> also returns
HeaderPages statistics, setting
IndexPages to <True> returns also returns
HeaderPages statistics, and so forth. Set any of the following options of type
TStatOption to <True> to retrieve the appropriate information:
Stop reporting statistics after reporting the information on the header page
Stop reporting statistics after reporting information on the log pages
Request statistics for the user indexes in the database
Request statistics for data tables in the database
Request statistics for system tables and indexes in addition to user tables and indexes
To use the statistical service:
- Drop an
IBStatisticalServicescomponent on a Delphi form.
- Attach to the service manager as described in Attaching to a Service Manager.
- Set the
DatabaseNameproperty to the path of the database for which you would like statistics.
- Set the options for which statistics you would like to receive, either by setting them to <True> in the Object Inspector, or in code using the
- Start the statistical service using the
The following example displays the statistics for a database. With a button click,
DBLog statistics are returned until the end of the file is reached.
procedure TForm1.Button1Click(Sender: TObject); begin with IBStatisticalService1 do begin ServerName := 'Poulet'; DatabaseName := 'C:\InterBase\tutorial\tutorial.ib'; LoginPrompt := False; Params.Add('user_name=sysdba'); Params.Add('password=masterkey'); Active := True; ServiceStart; try Options := [DataPages, DBLog]; While not Eof do Memo1.Lines.Add(GetNextLine); finally Active := False; end; end; end;