@@ -319,8 +319,7 @@ function TRawAsyncServer.json(ctxt: THttpServerRequest): cardinal;
319
319
msgRec: TMessageRec;
320
320
begin
321
321
msgRec.message := pointer(HELLO_WORLD);
322
- ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
323
- result := HTTP_SUCCESS;
322
+ result := ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
324
323
end ;
325
324
326
325
function TRawAsyncServer.db (ctxt: THttpServerRequest): cardinal;
@@ -329,8 +328,7 @@ function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
329
328
begin
330
329
w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer));
331
330
try
332
- ctxt.SetOutJson(w);
333
- result := HTTP_SUCCESS;
331
+ result := ctxt.SetOutJson(w);
334
332
finally
335
333
w.Free;
336
334
end ;
@@ -346,9 +344,8 @@ function TRawAsyncServer.queries(ctxt: THttpServerRequest): cardinal;
346
344
gen := Lecuyer;
347
345
for i := 0 to length(res) - 1 do
348
346
res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen));
349
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
347
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
350
348
ObjArrayClear(res);
351
- result := HTTP_SUCCESS;
352
349
end ;
353
350
354
351
function TRawAsyncServer.cached_queries (ctxt: THttpServerRequest): cardinal;
@@ -361,8 +358,7 @@ function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
361
358
gen := Lecuyer;
362
359
for i := 0 to length(res) - 1 do
363
360
res[i] := fOrmCache.Get(ComputeRandomWorld(gen));
364
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
365
- result := HTTP_SUCCESS;
361
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
366
362
end ;
367
363
368
364
function OrmFortuneCompareByMessage (const A, B): integer;
@@ -436,9 +432,8 @@ function TRawAsyncServer.rawdb(ctxt: THttpServerRequest): cardinal;
436
432
stmt.ExecutePrepared;
437
433
if stmt.Step then
438
434
begin
439
- ctxt.SetOutJson(
435
+ result := ctxt.SetOutJson(
440
436
' {"id":%,"randomNumber":%}' , [stmt.ColumnInt(0 ), stmt.ColumnInt(1 )]);
441
- result := HTTP_SUCCESS;
442
437
stmt.ReleaseRows;
443
438
end ;
444
439
stmt := nil ;
@@ -450,8 +445,7 @@ function TRawAsyncServer.rawqueries(ctxt: THttpServerRequest): cardinal;
450
445
begin
451
446
if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then
452
447
exit(HTTP_SERVERERROR);
453
- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
454
- result := HTTP_SUCCESS;
448
+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
455
449
end ;
456
450
457
451
function TRawAsyncServer.rawcached (ctxt: THttpServerRequest): cardinal;
@@ -464,8 +458,7 @@ function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
464
458
gen := Lecuyer;
465
459
for i := 0 to length(res) - 1 do
466
460
res[i] := fRawCache[ComputeRandomWorld(gen) - 1 ];
467
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
468
- result := HTTP_SUCCESS;
461
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
469
462
end ;
470
463
471
464
function TRawAsyncServer.rawfortunes (ctxt: THttpServerRequest): cardinal;
@@ -555,8 +548,7 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal;
555
548
end ;
556
549
end ;
557
550
stmt.ExecutePrepared;
558
- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
559
- result := HTTP_SUCCESS;
551
+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
560
552
end ;
561
553
562
554
// asynchronous PostgreSQL pipelined DB access
0 commit comments