@@ -295,7 +295,7 @@ function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
295
295
var
296
296
i: PtrInt;
297
297
res: TOrmWorlds;
298
- cache: POrmCacheEntry ;
298
+ cache: POrmCacheTable ;
299
299
begin
300
300
cache := fStore.Orm.Cache.Table(TOrmCachedWorld);
301
301
SetLength(res, GetQueriesParamValue(ctxt, ' COUNT=' ));
@@ -479,14 +479,16 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal;
479
479
cnt := getQueriesParamValue(ctxt);
480
480
if not getRawRandomWorlds(cnt, res) then
481
481
exit;
482
- if cnt > 20 then
482
+ // generate new randoms
483
+ for i := 0 to cnt - 1 do
484
+ res[i].randomNumber := ComputeRandomWorld;
485
+ if cnt > 15 then
483
486
begin
487
+ // fill parameters arrays for update with nested select (PostgreSQL only)
484
488
setLength(ids{ %H-} , cnt);
485
489
setLength(nums{ %H-} , cnt);
486
- // generate new randoms, fill parameters arrays for update
487
490
for i := 0 to cnt - 1 do
488
491
begin
489
- res[i].randomNumber := ComputeRandomWorld;
490
492
ids[i] := res[i].id;
491
493
nums[i] := res[i].randomNumber;
492
494
end ;
@@ -496,10 +498,10 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal;
496
498
end
497
499
else
498
500
begin
501
+ // fill parameters for update up to 15 items as CASE .. WHEN .. THEN ..
499
502
stmt := conn.NewStatementPrepared(ComputeUpdateSql(cnt), false, true);
500
503
for i := 0 to cnt - 1 do
501
504
begin
502
- res[i].randomNumber := ComputeRandomWorld;
503
505
stmt.Bind(i * 2 + 1 , res[i].id);
504
506
stmt.Bind(i * 2 + 2 , res[i].randomNumber);
505
507
stmt.Bind(cnt * 2 + i + 1 , res[i].id);
0 commit comments