@@ -319,8 +319,7 @@ function TRawAsyncServer.json(ctxt: THttpServerRequest): cardinal;
319319 msgRec: TMessageRec;
320320begin
321321 msgRec.message := pointer(HELLO_WORLD);
322- ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
323- result := HTTP_SUCCESS;
322+ result := ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
324323end ;
325324
326325function TRawAsyncServer.db (ctxt: THttpServerRequest): cardinal;
@@ -329,8 +328,7 @@ function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
329328begin
330329 w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer));
331330 try
332- ctxt.SetOutJson(w);
333- result := HTTP_SUCCESS;
331+ result := ctxt.SetOutJson(w);
334332 finally
335333 w.Free;
336334 end ;
@@ -346,9 +344,8 @@ function TRawAsyncServer.queries(ctxt: THttpServerRequest): cardinal;
346344 gen := Lecuyer;
347345 for i := 0 to length(res) - 1 do
348346 res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen));
349- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
347+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
350348 ObjArrayClear(res);
351- result := HTTP_SUCCESS;
352349end ;
353350
354351function TRawAsyncServer.cached_queries (ctxt: THttpServerRequest): cardinal;
@@ -361,8 +358,7 @@ function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
361358 gen := Lecuyer;
362359 for i := 0 to length(res) - 1 do
363360 res[i] := fOrmCache.Get(ComputeRandomWorld(gen));
364- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
365- result := HTTP_SUCCESS;
361+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
366362end ;
367363
368364function OrmFortuneCompareByMessage (const A, B): integer;
@@ -436,9 +432,8 @@ function TRawAsyncServer.rawdb(ctxt: THttpServerRequest): cardinal;
436432 stmt.ExecutePrepared;
437433 if stmt.Step then
438434 begin
439- ctxt.SetOutJson(
435+ result := ctxt.SetOutJson(
440436 ' {"id":%,"randomNumber":%}' , [stmt.ColumnInt(0 ), stmt.ColumnInt(1 )]);
441- result := HTTP_SUCCESS;
442437 stmt.ReleaseRows;
443438 end ;
444439 stmt := nil ;
@@ -450,8 +445,7 @@ function TRawAsyncServer.rawqueries(ctxt: THttpServerRequest): cardinal;
450445begin
451446 if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then
452447 exit(HTTP_SERVERERROR);
453- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
454- result := HTTP_SUCCESS;
448+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
455449end ;
456450
457451function TRawAsyncServer.rawcached (ctxt: THttpServerRequest): cardinal;
@@ -464,8 +458,7 @@ function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
464458 gen := Lecuyer;
465459 for i := 0 to length(res) - 1 do
466460 res[i] := fRawCache[ComputeRandomWorld(gen) - 1 ];
467- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
468- result := HTTP_SUCCESS;
461+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
469462end ;
470463
471464function TRawAsyncServer.rawfortunes (ctxt: THttpServerRequest): cardinal;
@@ -555,8 +548,7 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal;
555548 end ;
556549 end ;
557550 stmt.ExecutePrepared;
558- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
559- result := HTTP_SUCCESS;
551+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
560552end ;
561553
562554// asynchronous PostgreSQL pipelined DB access
0 commit comments