--- ibx/trunk/fbintf/testsuite/Test7.pas 2021/02/25 11:27:14 314 +++ ibx/trunk/fbintf/testsuite/Test7.pas 2021/02/25 11:56:36 315 @@ -1,4 +1,32 @@ -unit Test7; +(* + * Firebird Interface (fbintf) Test suite. This program is used to + * test the Firebird Pascal Interface and provide a semi-automated + * pass/fail check for each test. + * + * The contents of this file are subject to the Initial Developer's + * Public License Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy + * of the License here: + * + * http://www.firebirdsql.org/index.php?op=doc&id=idpl + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing rights + * and limitations under the License. + * + * The Initial Developer of the Original Code is Tony Whyman. + * + * The Original Code is (C) 2016 Tony Whyman, MWA Software + * (http://www.mwasoftware.co.uk). + * + * All Rights Reserved. + * + * Contributor(s): ______________________________________. + * +*) + +unit Test7; {$IFDEF MSWINDOWS} {$DEFINE WINDOWS} {$ENDIF} @@ -30,13 +58,13 @@ interface uses - Classes, SysUtils, TestManager, IB; + Classes, SysUtils, TestApplication, FBTestApp, IB; type { TTest7 } - TTest7 = class(TTestBase) + TTest7 = class(TFBTestBase) private procedure UpdateDatabase(Attachment: IAttachment); public @@ -54,12 +82,16 @@ const 'Dated TIMESTAMP, '+ 'Notes VarChar(64) Character Set ISO8859_1,'+ 'MyArray Integer [0:16],'+ + 'MyArray2 Timestamp [0:16],'+ + 'MyArray3 Numeric(10,2) [0:16],'+ 'Primary Key(RowID)'+ ')'; sqlInsert = 'Insert into TestData(RowID,Title,Dated,Notes) Values(:RowID,:Title,:Dated,:Notes)'; sqlUpdate = 'Update TestData Set MyArray = :MyArray Where RowID = 1'; + sqlUpdate2 = 'Update TestData Set MyArray2 = :MyArray2 Where RowID = 1'; + sqlUpdate3 = 'Update TestData Set MyArray3 = :MyArray3 Where RowID = 1'; { TTest7 } @@ -69,6 +101,8 @@ var Transaction: ITransaction; ResultSet: IResultSet; i,j: integer; ar: IArray; + aDateTime: TDateTime; + f: double; begin Transaction := Attachment.StartTransaction([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],taCommit); Statement := Attachment.Prepare(Transaction,'Select * from TestData'); @@ -82,11 +116,10 @@ begin ByName('rowid').AsInteger := 1; {$IFDEF DCC} ByName('title').AsString := UTF8Encode('Blob Test ©€'); - ByName('Notes').AsString := UTF8Encode('Écoute moi'); {$ELSE} ByName('title').AsString := 'Blob Test ©€'; - ByName('Notes').AsString := 'Écoute moi'; {$ENDIF} + ByName('Notes').AsString := 'Écoute moi'; ByName('Dated').AsDateTime := EncodeDate(2016,4,1) + EncodeTime(9,30,0,100); end; Statement.Execute; @@ -105,7 +138,32 @@ begin end; Statement.SQLParams[0].AsArray := ar; Statement.Execute; + + Statement := Attachment.PrepareWithNamedParameters(Transaction,sqlUpdate2); + ParamInfo(Statement.GetSQLParams); + ar := Attachment.CreateArray(Transaction,'TestData','MyArray2'); + for i := 0 to 16 do + begin + aDateTime := EncodeDate(2020,5,1) + EncodeTime(12,i,0,0); + ar.SetAsDateTime(i,aDateTime); + end; + Statement.SQLParams[0].AsArray := ar; + Statement.Execute; + + Statement := Attachment.PrepareWithNamedParameters(Transaction,sqlUpdate3); + ParamInfo(Statement.GetSQLParams); + ar := Attachment.CreateArray(Transaction,'TestData','MyArray3'); + f := 0; + for i := 0 to 16 do + begin + ar.SetAsFloat(i,f); + f := f + 1.05 + end; + Statement.SQLParams[0].AsArray := ar; + Statement.Execute; + Statement := Attachment.Prepare(Transaction,'Select * from TestData'); + PrintMetaData(Statement.GetMetaData); ReportResults(Statement); ResultSet := Statement.OpenCursor;