|
@@ -319,8 +319,7 @@ var
|
|
msgRec: TMessageRec;
|
|
msgRec: TMessageRec;
|
|
begin
|
|
begin
|
|
msgRec.message := pointer(HELLO_WORLD);
|
|
msgRec.message := pointer(HELLO_WORLD);
|
|
- ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec));
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
|
|
function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal;
|
|
@@ -329,8 +328,7 @@ var
|
|
begin
|
|
begin
|
|
w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer));
|
|
w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer));
|
|
try
|
|
try
|
|
- ctxt.SetOutJson(w);
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(w);
|
|
finally
|
|
finally
|
|
w.Free;
|
|
w.Free;
|
|
end;
|
|
end;
|
|
@@ -346,9 +344,8 @@ begin
|
|
gen := Lecuyer;
|
|
gen := Lecuyer;
|
|
for i := 0 to length(res) - 1 do
|
|
for i := 0 to length(res) - 1 do
|
|
res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen));
|
|
res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen));
|
|
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
ObjArrayClear(res);
|
|
ObjArrayClear(res);
|
|
- result := HTTP_SUCCESS;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
|
|
function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal;
|
|
@@ -361,8 +358,7 @@ begin
|
|
gen := Lecuyer;
|
|
gen := Lecuyer;
|
|
for i := 0 to length(res) - 1 do
|
|
for i := 0 to length(res) - 1 do
|
|
res[i] := fOrmCache.Get(ComputeRandomWorld(gen));
|
|
res[i] := fOrmCache.Get(ComputeRandomWorld(gen));
|
|
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
end;
|
|
end;
|
|
|
|
|
|
function OrmFortuneCompareByMessage(const A, B): integer;
|
|
function OrmFortuneCompareByMessage(const A, B): integer;
|
|
@@ -436,9 +432,8 @@ begin
|
|
stmt.ExecutePrepared;
|
|
stmt.ExecutePrepared;
|
|
if stmt.Step then
|
|
if stmt.Step then
|
|
begin
|
|
begin
|
|
- ctxt.SetOutJson(
|
|
|
|
|
|
+ result := ctxt.SetOutJson(
|
|
'{"id":%,"randomNumber":%}', [stmt.ColumnInt(0), stmt.ColumnInt(1)]);
|
|
'{"id":%,"randomNumber":%}', [stmt.ColumnInt(0), stmt.ColumnInt(1)]);
|
|
- result := HTTP_SUCCESS;
|
|
|
|
stmt.ReleaseRows;
|
|
stmt.ReleaseRows;
|
|
end;
|
|
end;
|
|
stmt := nil;
|
|
stmt := nil;
|
|
@@ -450,8 +445,7 @@ var
|
|
begin
|
|
begin
|
|
if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then
|
|
if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then
|
|
exit(HTTP_SERVERERROR);
|
|
exit(HTTP_SERVERERROR);
|
|
- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
|
|
function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal;
|
|
@@ -464,8 +458,7 @@ begin
|
|
gen := Lecuyer;
|
|
gen := Lecuyer;
|
|
for i := 0 to length(res) - 1 do
|
|
for i := 0 to length(res) - 1 do
|
|
res[i] := fRawCache[ComputeRandomWorld(gen) - 1];
|
|
res[i] := fRawCache[ComputeRandomWorld(gen) - 1];
|
|
- ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds));
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRawAsyncServer.rawfortunes(ctxt: THttpServerRequest): cardinal;
|
|
function TRawAsyncServer.rawfortunes(ctxt: THttpServerRequest): cardinal;
|
|
@@ -555,8 +548,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
stmt.ExecutePrepared;
|
|
stmt.ExecutePrepared;
|
|
- ctxt.SetOutJson(@res, TypeInfo(TWorlds));
|
|
|
|
- result := HTTP_SUCCESS;
|
|
|
|
|
|
+ result := ctxt.SetOutJson(@res, TypeInfo(TWorlds));
|
|
end;
|
|
end;
|
|
|
|
|
|
// asynchronous PostgreSQL pipelined DB access
|
|
// asynchronous PostgreSQL pipelined DB access
|