You are not logged in.
Pages: 1
Hi all,
It could be a noob question, but I have some doubts about transactions management in Mormot...
Say I have this situation: 3 TSQLRecords inside a function and if one of them returns a error, all the others have to rollback.
pseudo-code:
procedure Save;
var
obj1: TPerson; //
obj2: TAddress; // All TSQLRecord
obj3: TPhones; //
begin
startTransaction;
try
obj1.name := 'test1';
TSQLRest.Add(obj1);
obj2.Address := 'Street1';
TSQLRest.Add(obj2); //----> Say I have an error here
obj3.phone := '65432';
TSQLRest.Add(obj3);
Commit;
except
RollBack;
end;
end;
How would I implement the above situation in Mormot?
I saw some functions for transactions control, but inside batch methods. They control only for 1 object with multiple records.
Thanks in advance.
Offline
Use the batch methods, with automatic transaction.
Otherwise you may encounter unexpected race conditions when manual blocking transactions are used from client side.
OR use a SOA service and a short non blocking transaction on server side.
Offline
Pages: 1