ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/testsuite/Test7.pas
(Generate patch)
# Line 1 | Line 1
1 < unit Test7;
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 Test7;
30   {$IFDEF MSWINDOWS}
31   {$DEFINE WINDOWS}
32   {$ENDIF}
# Line 30 | Line 58
58   interface
59  
60   uses
61 <  Classes, SysUtils, TestManager, IB;
61 >  Classes, SysUtils, TestApplication, FBTestApp, IB;
62  
63   type
64  
65    { TTest7 }
66  
67 <  TTest7 = class(TTestBase)
67 >  TTest7 = class(TFBTestBase)
68    private
69      procedure UpdateDatabase(Attachment: IAttachment);
70    public
# Line 54 | Line 82
82      'Dated TIMESTAMP, '+
83      'Notes VarChar(64) Character Set ISO8859_1,'+
84      'MyArray Integer [0:16],'+
85 +    'MyArray2 Timestamp [0:16],'+
86 +    'MyArray3 Numeric(10,2) [0:16],'+
87      'Primary Key(RowID)'+
88      ')';
89  
90    sqlInsert = 'Insert into TestData(RowID,Title,Dated,Notes) Values(:RowID,:Title,:Dated,:Notes)';
91  
92    sqlUpdate = 'Update TestData Set MyArray = :MyArray Where RowID = 1';
93 +  sqlUpdate2 = 'Update TestData Set MyArray2 = :MyArray2 Where RowID = 1';
94 +  sqlUpdate3 = 'Update TestData Set MyArray3 = :MyArray3 Where RowID = 1';
95  
96   { TTest7 }
97  
# Line 69 | Line 101
101      ResultSet: IResultSet;
102      i,j: integer;
103      ar: IArray;
104 +    aDateTime: TDateTime;
105 +    f: double;
106   begin
107    Transaction := Attachment.StartTransaction([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],taCommit);
108    Statement := Attachment.Prepare(Transaction,'Select * from TestData');
# Line 82 | Line 116
116      ByName('rowid').AsInteger := 1;
117      {$IFDEF DCC}
118      ByName('title').AsString := UTF8Encode('Blob Test ©€');
85    ByName('Notes').AsString := UTF8Encode('Écoute moi');
119      {$ELSE}
120      ByName('title').AsString := 'Blob Test ©€';
88    ByName('Notes').AsString := 'Écoute moi';
121      {$ENDIF}
122 +    ByName('Notes').AsString := 'Écoute moi';
123      ByName('Dated').AsDateTime := EncodeDate(2016,4,1) + EncodeTime(9,30,0,100);
124    end;
125    Statement.Execute;
# Line 105 | Line 138
138    end;
139    Statement.SQLParams[0].AsArray := ar;
140    Statement.Execute;
141 +
142 +  Statement := Attachment.PrepareWithNamedParameters(Transaction,sqlUpdate2);
143 +  ParamInfo(Statement.GetSQLParams);
144 +  ar := Attachment.CreateArray(Transaction,'TestData','MyArray2');
145 +  for i := 0 to 16 do
146 +  begin
147 +    aDateTime := EncodeDate(2020,5,1) + EncodeTime(12,i,0,0);
148 +    ar.SetAsDateTime(i,aDateTime);
149 +  end;
150 +  Statement.SQLParams[0].AsArray := ar;
151 +  Statement.Execute;
152 +
153 +  Statement := Attachment.PrepareWithNamedParameters(Transaction,sqlUpdate3);
154 +  ParamInfo(Statement.GetSQLParams);
155 +  ar := Attachment.CreateArray(Transaction,'TestData','MyArray3');
156 +  f := 0;
157 +  for i := 0 to 16 do
158 +  begin
159 +    ar.SetAsFloat(i,f);
160 +    f := f + 1.05
161 +  end;
162 +  Statement.SQLParams[0].AsArray := ar;
163 +  Statement.Execute;
164 +
165    Statement := Attachment.Prepare(Transaction,'Select * from TestData');
166 +  PrintMetaData(Statement.GetMetaData);
167    ReportResults(Statement);
168  
169    ResultSet := Statement.OpenCursor;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines