Главная страница | назад





Article #16405: Retrieving BDE system information

 Question and Answer Database

FAQ1405D.txt   Retrieving BDE system information
Category   :Database/VCL
Platform    :All
Product    :All 32 bit  

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

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99