ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/testsuite/Test9.pas
Revision: 45
Committed: Tue Dec 6 10:33:46 2016 UTC (8 years ago) by tony
Content type: text/x-pascal
File size: 2380 byte(s)
Log Message:
Committing updates for Release R2-0-0

File Contents

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