1 |
unit Test9; |
2 |
{$IFDEF MSWINDOWS} |
3 |
{$DEFINE WINDOWS} |
4 |
{$ENDIF} |
5 |
|
6 |
{$IFDEF FPC} |
7 |
{$mode delphi} |
8 |
{$codepage utf8} |
9 |
{$ENDIF} |
10 |
|
11 |
{Test 9: Database Information tests} |
12 |
|
13 |
{ |
14 |
This test opens the employee example databases with the supplied user name/password |
15 |
and then reads and prints all defined database information. |
16 |
} |
17 |
|
18 |
interface |
19 |
|
20 |
uses |
21 |
Classes, SysUtils, TestManager, IB; |
22 |
|
23 |
type |
24 |
|
25 |
{ TTest9 } |
26 |
|
27 |
TTest9 = class(TTestBase) |
28 |
private |
29 |
procedure GetDBInformation(Attachment: IAttachment); |
30 |
public |
31 |
function TestTitle: AnsiString; override; |
32 |
procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override; |
33 |
end; |
34 |
|
35 |
implementation |
36 |
|
37 |
{ TTest9 } |
38 |
|
39 |
procedure TTest9.GetDBInformation(Attachment: IAttachment); |
40 |
var DBInfo: IDBInformation; |
41 |
begin |
42 |
DBInfo := Attachment.GetDBInformation([isc_info_db_id,isc_info_allocation,isc_info_base_level, |
43 |
isc_info_implementation,isc_info_no_reserve,isc_info_ods_minor_version, |
44 |
isc_info_ods_version,isc_info_page_size,isc_info_version,isc_info_db_read_only]); |
45 |
WriteDBInfo(DBInfo); |
46 |
|
47 |
DBInfo := Attachment.GetDBInformation([isc_info_current_memory, isc_info_forced_writes, |
48 |
isc_info_max_memory, isc_info_num_buffers, isc_info_sweep_interval, |
49 |
isc_info_user_names]); |
50 |
WriteDBInfo(DBInfo); |
51 |
|
52 |
DBInfo := Attachment.GetDBInformation([isc_info_fetches,isc_info_marks, |
53 |
isc_info_reads, isc_info_writes]); |
54 |
WriteDBInfo(DBInfo); |
55 |
|
56 |
DBInfo := Attachment.GetDBInformation([isc_info_backout_count, isc_info_delete_count, |
57 |
isc_info_expunge_count,isc_info_insert_count, isc_info_purge_count, |
58 |
isc_info_read_idx_count, isc_info_read_seq_count, isc_info_update_count]); |
59 |
WriteDBInfo(DBInfo); |
60 |
end; |
61 |
|
62 |
function TTest9.TestTitle: AnsiString; |
63 |
begin |
64 |
Result := 'Test 9: Database Information tests'; |
65 |
end; |
66 |
|
67 |
procedure TTest9.RunTest(CharSet: AnsiString; SQLDialect: integer); |
68 |
var DPB: IDPB; |
69 |
Attachment: IAttachment; |
70 |
begin |
71 |
DPB := FirebirdAPI.AllocateDPB; |
72 |
DPB.Add(isc_dpb_user_name).setAsString(Owner.GetUserName); |
73 |
DPB.Add(isc_dpb_password).setAsString(Owner.GetPassword); |
74 |
DPB.Add(isc_dpb_lc_ctype).setAsString(CharSet); |
75 |
DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(SQLDialect); |
76 |
Attachment := FirebirdAPI.OpenDatabase(Owner.GetEmployeeDatabaseName,DPB); |
77 |
|
78 |
GetDBInformation(Attachment); |
79 |
end; |
80 |
|
81 |
initialization |
82 |
RegisterTest(TTest9); |
83 |
|
84 |
end. |
85 |
|