46 |
|
{ TTest03 } |
47 |
|
|
48 |
|
{Test 03 is used to perform client side testing (UDR engine emulation) for the |
49 |
< |
UDR Select procedure declared in udr_test03.pas.} |
49 |
> |
UDR Select procedures declared in udr_test03.pas.} |
50 |
|
|
51 |
|
TTest03 = class(TFBUDRTestBase) |
52 |
|
private |
53 |
< |
procedure DoQuery(Attachment: IAttachment); |
53 |
> |
procedure DoAccSalaries(Attachment: IAttachment); |
54 |
> |
procedure DoReadText(Attachment: IAttachment); |
55 |
|
protected |
56 |
|
function GetTestID: AnsiString; override; |
57 |
|
function GetTestTitle: AnsiString; override; |
63 |
|
|
64 |
|
{ TTest03 } |
65 |
|
|
66 |
< |
procedure TTest03.DoQuery(Attachment: IAttachment); |
66 |
> |
procedure TTest03.DoAccSalaries(Attachment: IAttachment); |
67 |
|
var MyTestProc: TExternalProcedureWrapper; |
68 |
|
Transaction: ITransaction; |
69 |
|
Results: IProcedureResults; |
86 |
|
end; |
87 |
|
end; |
88 |
|
|
89 |
+ |
procedure TTest03.DoReadText(Attachment: IAttachment); |
90 |
+ |
var MyReadText: TExternalProcedureWrapper; |
91 |
+ |
Transaction: ITransaction; |
92 |
+ |
Results: IProcedureResults; |
93 |
+ |
begin |
94 |
+ |
UDRPlugin.Attachment := Attachment; |
95 |
+ |
MyReadText := UDRPlugin.GetExternalProcedure('MYREADTEXT','','fbudrtests!read_txt'); |
96 |
+ |
try |
97 |
+ |
MyReadText.InputParams[0].AsString := 'testsuite.conf'; |
98 |
+ |
writeln(OutFile,'Dump text file - testsuite.conf'); |
99 |
+ |
Transaction := Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit); |
100 |
+ |
Results := MyReadText.Execute(Transaction); |
101 |
+ |
while Results.FetchNext do |
102 |
+ |
begin |
103 |
+ |
writeln(OutFile,Results[0].AsString); |
104 |
+ |
end; |
105 |
+ |
writeln(OutFile,'EOF'); |
106 |
+ |
writeln(OutFile); |
107 |
+ |
finally |
108 |
+ |
MyReadText.Free; |
109 |
+ |
end; |
110 |
+ |
end; |
111 |
+ |
|
112 |
|
function TTest03.GetTestID: AnsiString; |
113 |
|
begin |
114 |
|
Result := '03'; |
120 |
|
end; |
121 |
|
|
122 |
|
const |
123 |
< |
DDL: array [0..0] of Ansistring = ('create or alter procedure MySelectProc () '+ |
123 |
> |
DDL: array [0..1] of Ansistring = ('create or alter procedure MySelectProc () '+ |
124 |
|
'returns (FullName VarChar(36), '+ |
125 |
< |
'Salary Numeric(10,2), AccSalary Numeric(10,2) ) as begin SUSPEND; end' |
125 |
> |
'Salary Numeric(10,2), AccSalary Numeric(10,2) ) as begin SUSPEND; end', |
126 |
> |
'create or alter procedure MyReadText ('+ |
127 |
> |
'path varchar(200) not null /*relative to udr directory */ '+ |
128 |
> |
') returns (text varchar(3000) not null) '+ |
129 |
> |
'As Begin Suspend; End' |
130 |
|
); |
131 |
|
|
132 |
< |
CleanUpDDL: array [0..0] of Ansistring = ('Drop procedure MySelectProc'); |
132 |
> |
CleanUpDDL: array [0..1] of Ansistring = ('Drop procedure MySelectProc', |
133 |
> |
'Drop procedure MyReadText'); |
134 |
|
|
135 |
|
|
136 |
|
{The test is run using the employee database. Note that dummy versions of the |
151 |
|
Attachment := FirebirdAPI.OpenDatabase(Owner.GetEmployeeDatabaseName,DPB); |
152 |
|
try |
153 |
|
ApplyDDL(Attachment,DDL); |
154 |
< |
DoQuery(Attachment); |
154 |
> |
DoAccSalaries(Attachment); |
155 |
> |
DoReadText(Attachment); |
156 |
|
finally |
157 |
|
ApplyDDL(Attachment,CleanUpDDL); |
158 |
|
Attachment.Disconnect; |