You are not logged in.
Pages: 1
Hi,
how can I serialize json in fast way (like mormot itself):
GetCustomerList is serialize with mormot and takes 650ms but my GetCustomerList2 takes 2100ms. 3 times slower.
https://gist.github.com/a-nouri/f0a0036 … 29ea86e345
where is my buttlenck.
Offline
How many items do you have in the resultset?
Sounds like a lot of time to take 2 seconds with TDocVariantData process.
Anyway, what I would do in your case may be just:
var LJson: RawUtf8;
...
dbStmt.ExecutePreparedAndFetchAllAsJson(True, LJson);
Result.Status := HTTP_SUCCESS;
Result.Content := '{"status":"success","data":' + LJson + '}';Offline
hahahaha. it was easy!
thank you ![]()
Offline
Another problem
i have field in mysql like this
`code` varbinary(6)
ExecutePreparedAndFetchAllAsJson return this field as garbage character (MDAwMDAx). but
LJson := dbStmt.FetchAllToDocVariantArray();
TDocVariantData(LJson).ToJson return '000001' that it is correct!
Last edited by anouri (2025-11-15 13:31:36)
Offline
I know that
select CAST(code AS CHAR(10)) code,descr from table
solve the problem. but why there is difference between two functions?
Last edited by anouri (2025-11-15 13:27:32)
Offline
VarBinary is a BLOB, so it is encoded as base-64 - not garbage.
Use an only tool: MDAwMDAx is the base64 encoded value of 000001.
Cast() in SQL forces conversion to text - this is the expected way to consume this field.
How many rows do you return?
Which compiler, DB and connection properties class are you using?
Offline
Yes. You are right
Thanks
Offline
Pages: 1