You are not logged in.
Pages: 1
Dear Ab,
Thank you for the quick reponse and fantastic framework.
Workaround may be to create all slave instances in a first BATCH, then create the master instances in a second BATCH.
This is my current method. Doing it this way enables me to delete the slave (detail) records if the second BATCH fails for some reason.
We may add a feature at TSQLRestBatch level to make the whole process in a single step, e.g. by adding a new TSQLRestBatch.AddDetail() method, which would fill the column ID during the BATCH execution...
But it is not implemented yet.
In my book, this will fill a current gap in Client side BATCH processing (recommended) as I saw from the documentation, Transactions are not good to use on Client side when multiple client access is anticipated.
Hope to see this feature soon ... ![]()
Dear All (and Ab),
How do I alter the example code below (as from documentation) to use client side batch commands (BatchStart, BatchAdd and BacthSend)?
I do not know how to get the IDs for instances One and Two in batch mode, because IDs only become available as part of the BatchSend results.
begin
One := TSQLMyFileInfo.Create;
Two := TSQLMyFileInfo.Create;
MyFile := TSQLMyFile.Create;
try
One.MyFileDate := ....
One.MyFileSize := ...
MyFile.FirstOne := TSQLMyFileInfo(MyDataBase.Add(One,True)); // add One and store ID in MyFile.FirstOne
Two.MyFileDate := ....
Two.MyFileSize := ...
MyFile.SecondOne:= TSQLMyFileInfo(MyDataBase.Add(Two,True)); // add Two and store ID in MyFile.SecondOne
MyDataBase.Add(MyFile,true);
finally
MyFile.Free;
Two.Free;
One.Free;
end;
end;Pages: 1