#1 2018-04-24 22:41:57

camu72
Member
From: Salta - Argentina
Registered: 2015-07-12
Posts: 28

TSQLTableJSON and TSQLRecord not in TSQLModel

In a context of Interfaced Service in Server side i would like (seudocode):

function GetSomeData(someParam: Integer): RawJSON;
var
  aJSON: rawUTF8;
  aObj: TMySQLRecord; // not in the model but declared shared in Server and Client
begin
  ...
  aJSON := '';  
  aObj := TMySQLRecord.Create;
  try
    for i := 0 to 100 do
    begin
      FillMyObject(aObj, i); // Empty and fill the published properties in a complex procedure
      aJSON := AddObjectToJSON(aJSON, aObj); << How can do that?
     { how can add aObj streamed as JSON in a not empty aJSON ready for TSQLTableJSON use?? }
    end
  Finally
    aObj.free;
  end;  
  result := aJSON;
end;

The idea is have a service that retrive a rawUTF8, which in the client side can be managed whit TSQLTableJSON and TMySQLRecord.
Note: TMySQLRecord is not in the model, because is filled with a complex procedure and not have a Table in the ExternalDB asociated.
Best ideas are accepted.
Thanks.

Offline

#2 2018-04-25 07:43:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: TSQLTableJSON and TSQLRecord not in TSQLModel

Check TJSONSerializer from mORMot.pas.
See e.g. https://synopse.info/files/html/api-1.1 … SERIALIZER

Offline

Board footer

Powered by FluxBB