- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Retrieving BDE system information

Question:

How can I get BDE system status such as size of buffer and heap used, or number of currently loaded drivers, active clients, sessions, databases or cursors?

Answer:

Use the BDE api call DbiGetSysInfo.  The following example 
outputs the results to a text log file.

implementation

uses dbierrs, dbiprocs, dbitypes;

{$R *.DFM}

procedure LogDbiSysInfo(const LogFile: string);
var
  Info: SYSInfo;
begin
  DbiGetSysInfo(Info);
  with TStringList.Create do
  try
    Clear;
    Add(Format('BUFFER SPACE: %d', [Info.iBufferSpace]));
    Add(Format('HEAP SPACE:   %d', [Info.iHeapSpace]));
    Add(Format('DRIVERS:      %d', [Info.iDrivers]));
    Add(Format('CLIENTS:      %d', [Info.iClients]));
    Add(Format('SESSIONS:     %d', [Info.iSessions]));
    Add(Format('DATABASES:    %d', [Info.iDatabases]));
    Add(Format('CURSORS:      %d', [Info.iCursors]));
    SaveToFile('c:\logcurs.txt');
  finally
    Free;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  table1.Open;
  table2.open;
  table3.Open;
  LogDbiSysInfo('c:\logcurs.txt');
end;

end.

Output for logcurs.txt:
-----------------------
BUFFER SPACE: 128
HEAP SPACE:   160
DRIVERS:      2
CLIENTS:      2
SESSIONS:     2
DATABASES:    4
CURSORS:      3



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile