From 0e9ad232a2a176c417d0bd3e772792eba3c4bbd4 Mon Sep 17 00:00:00 2001 From: "pavel.mash" Date: Wed, 25 Dec 2024 14:31:04 +0200 Subject: [PATCH] [mORMot] - upgrade to mORMot@2.3.9262 with HTTP pipelining mode improvements --- frameworks/Pascal/mormot/setup_and_build.sh | 2 +- frameworks/Pascal/mormot/src/raw.pas | 24 +++++++-------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/frameworks/Pascal/mormot/setup_and_build.sh b/frameworks/Pascal/mormot/setup_and_build.sh index c19884f9e1b..5c16c908799 100755 --- a/frameworks/Pascal/mormot/setup_and_build.sh +++ b/frameworks/Pascal/mormot/setup_and_build.sh @@ -35,7 +35,7 @@ echo "Download statics from $URL ..." wget -qO- "$URL" | tar -xz -C ./libs/mORMot/static # uncomment for fixed commit URL -URL=https://github.com/synopse/mORMot2/tarball/2017bddac17a838c9584763e4bd7538aa6f8a529 +URL=https://github.com/synopse/mORMot2/tarball/53bee75f81062db0700c97dfa9dfb5e9ce408679 #URL="https://api.github.com/repos/synopse/mORMot2/tarball/$USED_TAG" echo "Download and unpacking mORMot sources from $URL ..." wget -qO- "$URL" | tar -xz -C ./libs/mORMot --strip-components=1 diff --git a/frameworks/Pascal/mormot/src/raw.pas b/frameworks/Pascal/mormot/src/raw.pas index 1f24df7173d..2ea5735327e 100644 --- a/frameworks/Pascal/mormot/src/raw.pas +++ b/frameworks/Pascal/mormot/src/raw.pas @@ -319,8 +319,7 @@ function TRawAsyncServer.json(ctxt: THttpServerRequest): cardinal; msgRec: TMessageRec; begin msgRec.message := pointer(HELLO_WORLD); - ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec)); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(@msgRec, TypeInfo(TMessageRec)); end; function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal; @@ -329,8 +328,7 @@ function TRawAsyncServer.db(ctxt: THttpServerRequest): cardinal; begin w := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(Lecuyer)); try - ctxt.SetOutJson(w); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(w); finally w.Free; end; @@ -346,9 +344,8 @@ function TRawAsyncServer.queries(ctxt: THttpServerRequest): cardinal; gen := Lecuyer; for i := 0 to length(res) - 1 do res[i] := TOrmWorld.Create(fStore.Orm, ComputeRandomWorld(gen)); - ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); + result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); ObjArrayClear(res); - result := HTTP_SUCCESS; end; function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal; @@ -361,8 +358,7 @@ function TRawAsyncServer.cached_queries(ctxt: THttpServerRequest): cardinal; gen := Lecuyer; for i := 0 to length(res) - 1 do res[i] := fOrmCache.Get(ComputeRandomWorld(gen)); - ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); end; function OrmFortuneCompareByMessage(const A, B): integer; @@ -436,9 +432,8 @@ function TRawAsyncServer.rawdb(ctxt: THttpServerRequest): cardinal; stmt.ExecutePrepared; if stmt.Step then begin - ctxt.SetOutJson( + result := ctxt.SetOutJson( '{"id":%,"randomNumber":%}', [stmt.ColumnInt(0), stmt.ColumnInt(1)]); - result := HTTP_SUCCESS; stmt.ReleaseRows; end; stmt := nil; @@ -450,8 +445,7 @@ function TRawAsyncServer.rawqueries(ctxt: THttpServerRequest): cardinal; begin if not GetRawRandomWorlds(GetQueriesParamValue(ctxt), res) then exit(HTTP_SERVERERROR); - ctxt.SetOutJson(@res, TypeInfo(TWorlds)); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(@res, TypeInfo(TWorlds)); end; function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal; @@ -464,8 +458,7 @@ function TRawAsyncServer.rawcached(ctxt: THttpServerRequest): cardinal; gen := Lecuyer; for i := 0 to length(res) - 1 do res[i] := fRawCache[ComputeRandomWorld(gen) - 1]; - ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(@res, TypeInfo(TOrmWorlds)); end; function TRawAsyncServer.rawfortunes(ctxt: THttpServerRequest): cardinal; @@ -555,8 +548,7 @@ function TRawAsyncServer.rawupdates(ctxt: THttpServerRequest): cardinal; end; end; stmt.ExecutePrepared; - ctxt.SetOutJson(@res, TypeInfo(TWorlds)); - result := HTTP_SUCCESS; + result := ctxt.SetOutJson(@res, TypeInfo(TWorlds)); end; // asynchronous PostgreSQL pipelined DB access