ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/testsuite/Test09.pas
Revision: 323
Committed: Thu Feb 25 12:14:35 2021 UTC (3 years, 8 months ago) by tony
Content type: text/x-pascal
File size: 2752 byte(s)
Log Message:
Fixed Merged

File Contents

# User Rev Content
1 tony 323 (*
2     * IBX Test suite. This program is used to test the IBX non-visual
3     * components and provides a semi-automated pass/fail check for each test.
4     *
5     * The contents of this file are subject to the Initial Developer's
6     * Public License Version 1.0 (the "License"); you may not use this
7     * file except in compliance with the License. You may obtain a copy
8     * of the License here:
9     *
10     * http://www.firebirdsql.org/index.php?op=doc&id=idpl
11     *
12     * Software distributed under the License is distributed on an "AS
13     * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14     * implied. See the License for the specific language governing rights
15     * and limitations under the License.
16     *
17     * The Initial Developer of the Original Code is Tony Whyman.
18     *
19     * The Original Code is (C) 2021 Tony Whyman, MWA Software
20     * (http://www.mwasoftware.co.uk).
21     *
22     * All Rights Reserved.
23     *
24     * Contributor(s): ______________________________________.
25     *
26     *)
27 tony 315 unit Test09;
28    
29     {$mode objfpc}{$H+}
30    
31     {Test 9: Extract DDL from example Employee Database}
32    
33     interface
34    
35     uses
36     Classes, SysUtils, TestApplication, IBXTestbase, IB, IBExtract;
37    
38     const
39     aTestID = '09';
40     aTestTitle = 'Extract DDL from example Employee Database';
41    
42     type
43    
44     { TTest09 }
45    
46     TTest09 = class(TIBXTestBase)
47     private
48     FExtract: TIBExtract;
49     procedure HandleExtractLine(Sender: TObject; start, count: integer);
50     protected
51     procedure CreateObjects(Application: TTestApplication); override;
52     function GetTestID: AnsiString; override;
53     function GetTestTitle: AnsiString; override;
54     procedure InitTest; override;
55     public
56     procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override;
57     end;
58    
59    
60     implementation
61    
62     { TTest09 }
63    
64     procedure TTest09.HandleExtractLine(Sender: TObject; start, count: integer);
65     var i: integer;
66     begin
67     for i := 0 to count - 1 do
68     writeln(OutFile,FExtract.Items[start + i]);
69     end;
70    
71     procedure TTest09.CreateObjects(Application: TTestApplication);
72     begin
73     inherited CreateObjects(Application);
74     FExtract := TIBExtract.Create(Application);
75     FExtract.Database := IBDatabase;
76     FExtract.Transaction := IBTransaction;
77     FExtract.OnExtractLines := @HandleExtractLine;
78     end;
79    
80     function TTest09.GetTestID: AnsiString;
81     begin
82     Result := aTestID;
83     end;
84    
85     function TTest09.GetTestTitle: AnsiString;
86     begin
87     Result := aTestTitle;
88     end;
89    
90     procedure TTest09.InitTest;
91     begin
92     ReadOnlyTransaction;
93     IBDatabase.DatabaseName := Owner.GetEmployeeDatabaseName;
94     end;
95    
96     procedure TTest09.RunTest(CharSet: AnsiString; SQLDialect: integer);
97     begin
98     IBDatabase.Connected := true;
99     writeln(OutFile);
100     writeln(OutFile,'Extracting Database Schema and Data');
101     FExtract.ExtractObject(eoDatabase,'',[etGrantsToUser]);
102     end;
103    
104     initialization
105     RegisterTest(TTest09);
106    
107     end.
108