I have this code from a tutorial from Embarcadero to pass dataset as JSON:
procedure TServerMethods1.ApplyChangesDepartmentEmployees( const ADeltaList: TFDJSONDeltas);
var LApply: TFDJSONDeltasApplyUpdates;
begin
TFDJSONDeltasApplyUpdates.Create(ADeltaList);
LApply.ApplyUpdates('Departement', FDQueryDepartment.Command);
if LApply.Errors.Count = 0 then
LApply.ApplyUpdates('Emplyees', FDQueryDepartmentEmployees.Command);
if LApply.Errors.Count > 0 then
Exception.Create(LApply.Errors.Strings.Text);
end;
But I have some questions about the code:
What is TFDJSONDeltas ? and what Deltas mean ?
Why I have to create TFDJSONDeltasApplyUpdates ?
What ApplyUpdates do and what is its syntax ?
This all I got from documentation: http://docwiki.embarcadero.com/Libraries/XE8/en/Data.FireDACJSONReflect.TFDJSONDeltasApplyUpdates
Very old question but thought of answering.
JSON Delta is a differential JSON which can be patched to an existing JSON string.
It is helpful for mobile applications where Data connection may not be consistent.
ApplyUpdatesapplies aDataTable in SQLusing theJSONDelta.Syntax: