@@ -125,7 +125,7 @@ TRawAsyncServer = class(TSynPersistent)
125125 WORLD_COUNT = 10000 ;
126126 WORLD_READ_SQL = ' select id,randomNumber from World where id=?' ;
127127 WORLD_UPDATE_SQLN = ' update World as t set randomNumber = v.r from ' +
128- ' (SELECT unnest(?::bigint []), unnest(?::bigint []) order by 1) as v(id, r)' +
128+ ' (SELECT unnest(?::integer []), unnest(?::integer []) order by 1) as v(id, r)' +
129129 ' where t.id = v.id' ;
130130 FORTUNES_SQL = ' select id,message from Fortune' ;
131131
@@ -168,6 +168,7 @@ constructor TRawAsyncServer.Create(
168168 inherited Create;
169169 fDbPool := TSqlDBPostgresConnectionProperties.Create(
170170 ' tfb-database:5432' , ' hello_world' , ' benchmarkdbuser' , ' benchmarkdbpass' );
171+ fDbPool.ArrayParamsAsBinary := true;
171172 // customize JSON serialization for TFB expectations
172173 TOrmWorld.OrmProps.Fields.JsonRenameProperties([
173174 ' ID' , ' id' ,
@@ -658,19 +659,17 @@ procedure TAsyncWorld.OnQueries(Statement: TSqlDBPostgresAsyncStatement;
658659procedure TAsyncWorld.DoUpdates ;
659660var
660661 i: PtrInt;
661- ids, nums: TInt64DynArray ;
662+ params: TIntegerDynArray ;
662663begin
663- setLength(ids{ %H-} , count);
664- setLength(nums{ %H-} , count);
665664 for i := 0 to count - 1 do
666- with res[i] do
667- begin
668- randomNumber := ComputeRandomWorld;
669- ids [i] := id;
670- nums[i] := randomNumber ;
671- end ;
672- update.BindArray( 1 , ids) ;
673- update.BindArray (2 , nums );
665+ res[i].randomNumber := ComputeRandomWorld;
666+ SetLength(params, count);
667+ for i := 0 to count - 1 do
668+ params [i] := res[i]. id;
669+ update.BindArrayInt32( 1 , params) ;
670+ for i := 0 to count - 1 do
671+ params[i] := res[i].randomNumber ;
672+ update.BindArrayInt32 (2 , params );
674673 update.ExecuteAsync(request, OnRes);
675674end ;
676675
@@ -718,8 +717,8 @@ procedure TAsyncWorld.OnRes(Statement: TSqlDBPostgresAsyncStatement;
718717 if GetEnvironmentVariable(' TFB_TEST_NAME' ) = ' mormot-postgres-async' then
719718 begin
720719 // asynchronus test
721- servers := cpuCount * 2 ;
722- threads := 1 ;
720+ servers := cpuCount;
721+ threads := 4 ;
723722 end
724723 else
725724 if GetEnvironmentVariable(' TFB_TEST_NAME' ) = ' mormot-postgres-async2' then
0 commit comments