ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/udr/udr/testsuite/Test01.pas
(Generate patch)

Comparing ibx/branches/udr/udr/testsuite/Test01.pas (file contents):
Revision 380 by tony, Mon Jan 10 10:08:03 2022 UTC vs.
Revision 381 by tony, Sat Jan 15 00:06:22 2022 UTC

# Line 74 | Line 74 | begin
74    {initialize the emulator with the database connection}
75    UDRPlugin.Attachment := Attachment;
76    {Get the emulator wrapper for the row_count function, declared as MyRowCount}
77 <  MyRowCount := UDRPlugin.GetExternalFunction('MYROWCOUNT','','fbudrtests!row_count');
77 >  MyRowCount := UDRPlugin.makeFunction('MYROWCOUNT','','fbudrtests!row_count');
78    try
79      writeln(OutFile,'Row Count for Employee');
80      {set the input parameter to the EMPLOYEE table}
# Line 83 | Line 83 | begin
83      ParamInfo(MyRowCount.InputParams);
84      Transaction := Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit);
85      {invoke the function and print the result}
86 <    writeln('Employee Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
86 >    writeln(Outfile,'Employee Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
87      writeln(OutFile);
88  
89      {Try again with the DEPARTMENT table}
90      MyRowCount.InputParams[0].AsString := 'DEPARTMENT';
91      ParamInfo(MyRowCount.InputParams);
92 <    writeln('Dept Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
92 >    writeln(Outfile,'Dept Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
93      writeln(OutFile);
94  
95      {And again but demonstrate exception handling by using an invalid table name}
# Line 97 | Line 97 | begin
97      try
98        ParamInfo(MyRowCount.InputParams);
99        Rows := MyRowCount.Execute(Transaction).AsInteger;
100 <      writeln('Dept Row Count = ',Rows);
100 >      writeln(Outfile,'Dept Row Count = ',Rows);
101        writeln(OutFile);
102      except on E: Exception do
103        writeln(Outfile,'Expected exception: ',E.Message);
# Line 108 | Line 108 | begin
108  
109    writeln(OutFile);
110    {Now call the external version with an error}
111 <  MyRowCount := UDRPlugin.GetExternalFunction('BADROWCOUNT','','fbudrtests!bad_row_count');
111 >  MyRowCount := UDRPlugin.makeFunction('BADROWCOUNT','','fbudrtests!bad_row_count');
112    try
113      try
114        writeln(OutFile,'Row Count for Employee');
115        MyRowCount.InputParams[0].AsString := 'EMPLOYEE';
116        ParamInfo(MyRowCount.InputParams);
117        Transaction := Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit);
118 <      writeln('Employee Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
118 >      writeln(Outfile,'Employee Row Count = ',MyRowCount.Execute(Transaction).AsInteger);
119      except on E: Exception do
120        writeln(Outfile,'Expected exception: ',E.Message);
121      end;
# Line 132 | Line 132 | var ReturnInfo: TExternalFunctionWrapper
132      Transaction: ITransaction;
133   begin
134    UDRPlugin.Attachment := Attachment;
135 <  ReturnInfo := UDRPlugin.GetExternalFunction('RETURNINFO','','fbudrtests!return_info!Hello World');
135 >  ReturnInfo := UDRPlugin.makeFunction('RETURNINFO','','fbudrtests!return_info!Hello World');
136    try
137      Transaction := Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit);
138      writeln(OutFile,'Info returned = ',ReturnInfo.Execute(Transaction).AsString);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines