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

Comparing ibx/trunk/fbintf/testsuite/Test3.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 70 by tony, Thu Oct 26 12:59:51 2017 UTC

# Line 1 | Line 1
1   unit Test3;
2 + {$IFDEF MSWINDOWS}
3 + {$DEFINE WINDOWS}
4 + {$ENDIF}
5  
6 < {$mode objfpc}{$H+}
6 > {$IFDEF FPC}
7 > {$mode delphi}
8   {$codepage utf8}
9 + {$ENDIF}
10  
11   { Test 3: ad hoc queries}
12  
# Line 34 | Line 39 | type
39    private
40      procedure DoQuery(Attachment: IAttachment);
41    public
42 <    function TestTitle: string; override;
43 <    procedure RunTest(CharSet: string; SQLDialect: integer); override;
42 >    function TestTitle: AnsiString; override;
43 >    procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override;
44    end;
45  
46  
# Line 48 | Line 53 | var Transaction: ITransaction;
53      ResultSet: IResultSet;
54      Statement: IStatement;
55      TPB: ITPB;
56 +    us: UnicodeString;
57   begin
58    writeln(OutFile,'Employee Count = ',Attachment.OpenCursorAtStart('Select count(*) from EMPLOYEE')[0].AsInteger);
59  
# Line 69 | Line 75 | begin
75    ResultSet := Attachment.OpenCursorAtStart('Select count(*) from EMPLOYEE');
76    writeln(OutFile,'Employee Count = ',ResultSet[0].AsInteger);
77  
78 +  {$IFNDEF FPC}
79 +  Transaction.Rollback; {Delphi does not dispose of interfaces until the end of the function
80 +                         so we need to explicitly rollback here. FPC will dispose of the
81 +                         interface as soon as it is overwritten - hence this is not needed.}
82 +  {$ENDIF}
83    Transaction := Attachment.StartTransaction([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],taRollback);
84    Statement := Attachment.PrepareWithNamedParameters(Transaction,'Execute Procedure DELETE_EMPLOYEE :EMP_NO',3);
85    Statement.GetSQLParams.ByName('EMP_NO').AsInteger := 8;
# Line 91 | Line 102 | begin
102           Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit),
103           'Select count(*) As Counter from EMPLOYEE Where EMP_NO < ?',3,[8])[0].AsInteger);
104  
105 +  writeln(OutFile,'"Johnson" Employee Count = ',Attachment.OpenCursorAtStart(
106 +         Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit),
107 +         'Select count(*) As Counter from EMPLOYEE Where LAST_NAME = ?',3,['Johnson'])[0].AsInteger);
108 +
109 +  us := UTF8Decode('Yanowski');   {Test a UnicodeString as a parameter}
110 +
111 +  writeln(OutFile,'"Yanowski" Employee Count = ',Attachment.OpenCursorAtStart(
112 +         Attachment.StartTransaction([isc_tpb_read,isc_tpb_nowait,isc_tpb_concurrency],taCommit),
113 +         'Select count(*) As Counter from EMPLOYEE Where LAST_NAME = ?',3,[us])[0].AsInteger);
114 +
115   end;
116  
117 < function TTest3.TestTitle: string;
117 > function TTest3.TestTitle: AnsiString;
118   begin
119    Result := 'Test 3: ad hoc queries';
120   end;
121  
122 < procedure TTest3.RunTest(CharSet: string; SQLDialect: integer);
122 > procedure TTest3.RunTest(CharSet: AnsiString; SQLDialect: integer);
123   var Attachment: IAttachment;
124      DPB: IDPB;
125   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines