1 |
+ |
(* |
2 |
+ |
* Firebird Interface (fbintf) Test suite. This program is used to |
3 |
+ |
* test the Firebird Pascal Interface and provide a semi-automated |
4 |
+ |
* pass/fail check for each test. |
5 |
+ |
* |
6 |
+ |
* The contents of this file are subject to the Initial Developer's |
7 |
+ |
* Public License Version 1.0 (the "License"); you may not use this |
8 |
+ |
* file except in compliance with the License. You may obtain a copy |
9 |
+ |
* of the License here: |
10 |
+ |
* |
11 |
+ |
* http://www.firebirdsql.org/index.php?op=doc&id=idpl |
12 |
+ |
* |
13 |
+ |
* Software distributed under the License is distributed on an "AS |
14 |
+ |
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
15 |
+ |
* implied. See the License for the specific language governing rights |
16 |
+ |
* and limitations under the License. |
17 |
+ |
* |
18 |
+ |
* The Initial Developer of the Original Code is Tony Whyman. |
19 |
+ |
* |
20 |
+ |
* The Original Code is (C) 2016 Tony Whyman, MWA Software |
21 |
+ |
* (http://www.mwasoftware.co.uk). |
22 |
+ |
* |
23 |
+ |
* All Rights Reserved. |
24 |
+ |
* |
25 |
+ |
* Contributor(s): ______________________________________. |
26 |
+ |
* |
27 |
+ |
*) |
28 |
+ |
|
29 |
|
unit Test9; |
30 |
|
{$IFDEF MSWINDOWS} |
31 |
|
{$DEFINE WINDOWS} |
46 |
|
interface |
47 |
|
|
48 |
|
uses |
49 |
< |
Classes, SysUtils, TestManager, IB; |
49 |
> |
Classes, SysUtils, TestApplication, FBTestApp, IB; |
50 |
|
|
51 |
|
type |
52 |
|
|
53 |
|
{ TTest9 } |
54 |
|
|
55 |
< |
TTest9 = class(TTestBase) |
55 |
> |
TTest9 = class(TFBTestBase) |
56 |
|
private |
57 |
|
procedure GetDBInformation(Attachment: IAttachment); |
58 |
|
public |
66 |
|
|
67 |
|
procedure TTest9.GetDBInformation(Attachment: IAttachment); |
68 |
|
var DBInfo: IDBInformation; |
69 |
+ |
DBRequest: IDIRB; |
70 |
|
begin |
71 |
< |
DBInfo := Attachment.GetDBInformation([isc_info_db_id,isc_info_allocation,isc_info_base_level, |
71 |
> |
{First check ODS version to avoid information requests supported DB 2.5 and later} |
72 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_ods_version,isc_info_ods_minor_version]); |
73 |
> |
if (DBInfo.Count > 1) and (DBInfo[0].AsInteger > 11) or |
74 |
> |
((DBInfo[0].AsInteger = 11) and (DBInfo[1].AsInteger > 1)) then |
75 |
> |
begin |
76 |
> |
WriteDBInfo(Attachment.GetDBInformation(isc_info_db_id)); |
77 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_allocation,isc_info_base_level, |
78 |
|
isc_info_implementation,isc_info_no_reserve,isc_info_ods_minor_version, |
79 |
< |
isc_info_ods_version,isc_info_page_size,isc_info_version]); |
79 |
> |
isc_info_ods_version,isc_info_page_size,isc_info_version,isc_info_db_read_only, |
80 |
> |
isc_info_creation_date,fb_info_pages_used,fb_info_pages_free]); |
81 |
> |
WriteDBInfo(DBInfo); |
82 |
> |
|
83 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_current_memory, isc_info_forced_writes, |
84 |
> |
isc_info_max_memory, isc_info_num_buffers, isc_info_sweep_interval, |
85 |
> |
isc_info_user_names,isc_info_active_tran_count]); |
86 |
> |
WriteDBInfo(DBInfo); |
87 |
> |
|
88 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_fetches,isc_info_marks, |
89 |
> |
isc_info_reads, isc_info_writes]); |
90 |
> |
WriteDBInfo(DBInfo); |
91 |
> |
|
92 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_backout_count, isc_info_delete_count, |
93 |
> |
isc_info_expunge_count,isc_info_insert_count, isc_info_purge_count, |
94 |
> |
isc_info_read_idx_count, isc_info_read_seq_count, isc_info_update_count]); |
95 |
> |
WriteDBInfo(DBInfo); |
96 |
> |
|
97 |
> |
DBRequest := Attachment.AllocateDIRB; |
98 |
> |
|
99 |
> |
DBRequest.Add(isc_info_page_size); |
100 |
> |
|
101 |
> |
{Only enable during unit test. This result will always be different for |
102 |
> |
each run and you will only get false positives in the log} |
103 |
> |
// DBRequest.Add(fb_info_page_contents).AsInteger := 100; |
104 |
> |
WriteDBInfo(Attachment.GetDBInformation(DBRequest)); |
105 |
> |
end |
106 |
> |
else |
107 |
> |
begin |
108 |
> |
WriteDBInfo(Attachment.GetDBInformation(isc_info_db_id)); |
109 |
> |
DBInfo := Attachment.GetDBInformation([isc_info_allocation,isc_info_base_level, |
110 |
> |
isc_info_implementation,isc_info_no_reserve,isc_info_ods_minor_version, |
111 |
> |
isc_info_ods_version,isc_info_page_size,isc_info_version,isc_info_db_read_only]); |
112 |
|
WriteDBInfo(DBInfo); |
113 |
|
|
114 |
|
DBInfo := Attachment.GetDBInformation([isc_info_current_memory, isc_info_forced_writes, |
124 |
|
isc_info_expunge_count,isc_info_insert_count, isc_info_purge_count, |
125 |
|
isc_info_read_idx_count, isc_info_read_seq_count, isc_info_update_count]); |
126 |
|
WriteDBInfo(DBInfo); |
127 |
+ |
|
128 |
+ |
DBRequest := Attachment.AllocateDIRB; |
129 |
+ |
DBRequest.Add(isc_info_page_size); |
130 |
+ |
WriteDBInfo(Attachment.GetDBInformation(DBRequest)); |
131 |
+ |
end; |
132 |
|
end; |
133 |
|
|
134 |
|
function TTest9.TestTitle: AnsiString; |
144 |
|
DPB.Add(isc_dpb_user_name).setAsString(Owner.GetUserName); |
145 |
|
DPB.Add(isc_dpb_password).setAsString(Owner.GetPassword); |
146 |
|
DPB.Add(isc_dpb_lc_ctype).setAsString(CharSet); |
75 |
– |
DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(SQLDialect); |
147 |
|
Attachment := FirebirdAPI.OpenDatabase(Owner.GetEmployeeDatabaseName,DPB); |
148 |
|
|
149 |
|
GetDBInformation(Attachment); |