You are not logged in.
Pages: 1
Hi,
I need to standardize the results from mormot, both when using queries via SQL and when using the ORM with its connection.
With queries via SQL I use an approach similar to the following to return a compact binary format to import to the client as a read-only dataset.
I use TSQLDBConnectionProperties and Sql strings.
//
function GetBin(AConnection: TSQLDBConnectionProperties; ASql: string): string;
var
stream: TStream;
begin
stream: := TStringStream.Create;
AConnection.Execute(ASql, []).FetchAllToBinary(tmpStream);
stream.Seek(0, soBeginning);
result := stream.DataString;
stream.free;
end;
//
Well, it works!
How can I obtain the same result when using TOrm with TRestServerDB as connection?
Thanks in advance!!!
Offline
Use the standard JSON serialization, for TOrm, in non-expanded format.
It won't be slower nor bigger, with proper compression over the wire, than the binary serialization.
Or you can use the binary serialization directly on the SQlite3 database instance, if you prefer - but I won't go into this direction.
Offline
Pages: 1