ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/dbInfo/Unit1.pas
(Generate patch)

Comparing ibx/trunk/examples/dbInfo/Unit1.pas (file contents):
Revision 62 by tony, Wed Apr 12 09:19:59 2017 UTC vs.
Revision 82 by tony, Mon Jan 1 11:31:13 2018 UTC

# Line 6 | Line 6 | interface
6  
7   uses
8    Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 <  IB, IBDatabase, IBDatabaseInfo, IBExternals;
9 >  IB, IBDatabase, IBDatabaseInfo, IBQuery, IBExternals;
10  
11   type
12  
# Line 15 | Line 15 | type
15    TForm1 = class(TForm)
16      IBDatabase1: TIBDatabase;
17      IBDatabaseInfo1: TIBDatabaseInfo;
18 +    IBTransaction1: TIBTransaction;
19      Memo1: TMemo;
20 +    TableNameLookup: TIBQuery;
21      procedure FormShow(Sender: TObject);
22      procedure IBDatabase1AfterConnect(Sender: TObject);
23    private
24 +    procedure AddPerfStats(Heading: string; stats: TStrings);
25      { private declarations }
26      procedure ShowBoolValue(aValue: Long; WhenTrue, WhenFalse: string);
27      procedure ShowStrings(aCaption: string; List: TStrings);
# Line 55 | Line 58 | end;
58  
59   procedure TForm1.IBDatabase1AfterConnect(Sender: TObject);
60   begin
61 +  IBTransaction1.Active := true;
62 +  TableNameLookup.Active := true;
63    with IBDatabaseInfo1 do
64    begin
65      Memo1.Lines.Add('Allocation = ' + IntToStr(Allocation));
# Line 78 | Line 83 | begin
83      Memo1.Lines.Add('Marks = ' + IntToStr(Marks));
84      Memo1.Lines.Add('Reads = ' + IntToStr(Reads));
85      Memo1.Lines.Add('Writes = ' + IntToStr(Writes));
86 <    ShowStrings('Backout Count',BackoutCount);
87 <    ShowStrings('Delete Count',DeleteCount);
88 <    ShowStrings('Expunge Count',ExpungeCount);
89 <    ShowStrings('Insert Count',InsertCount);
90 <    ShowStrings('Purge Count',PurgeCount);
91 <    ShowStrings('Read Idx Count',ReadIdxCount);
92 <    ShowStrings('Read Seq Count',ReadSeqCount);
93 <    ShowStrings('Update Count',UpdateCount);
86 >    AddPerfStats('Backout Count',BackoutCount);
87 >    AddPerfStats('Delete Count',DeleteCount);
88 >    AddPerfStats('Expunge Count',ExpungeCount);
89 >    AddPerfStats('Insert Count',InsertCount);
90 >    AddPerfStats('Purge Count',PurgeCount);
91 >    AddPerfStats('Read Idx Count',ReadIdxCount);
92 >    AddPerfStats('Read Seq Count',ReadSeqCount);
93 >    AddPerfStats('Update Count',UpdateCount);
94 >    Memo1.Lines.Add('');
95      Memo1.Lines.Add('DB SQLDialect = ' + IntToStr(DBSQLDialect));
96      ShowBoolValue(ReadOnly,'Database is Read Only','Database is Read/Write');
97    end;
# Line 113 | Line 119 | begin
119    Memo1.Lines.Add(s);
120   end;
121  
122 + procedure TForm1.AddPerfStats(Heading: string;
123 +  stats: TStrings);
124 + var i: integer;
125 + begin
126 +  with Memo1.Lines do
127 +  begin
128 +    if stats.count = 0 then exit;
129 +    Add('');
130 +    Add(Heading);
131 +    for i := 0 to stats.Count - 1 do
132 +    begin
133 +      if TableNameLookup.Locate('RDB$RELATION_ID',stats.Names[i],[]) then
134 +        Add('  ' + TableNameLookup.FieldByName('RDB$RELATION_NAME').AsString + ' = ' + stats.ValueFromIndex[i]);
135 +    end;
136 +  end;
137 + end;
138 +
139 +
140   end.
141  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines