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 |
|
|
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); |
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)); |
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; |
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 |
|
|