I have an Accept button which performs ApplyUpdates of the master, then ApplyUpdates of the detail, and a Cancel button which performs a CancelUpdates of each. Since it's not acceptable that a partial version of a record be accessible by other users, I'm wrapping the ApplyUpdates within a transaction block.
There's no problem as long as everything goes well in the server; the problem comes when one of the detail records fails on post for any reason. I have to rollback in this case, but the modifications made to all posted records (including the master) are lost.
For this purpose I would need a method that applies the updates without removing the record changes even if they're successfully posted, so that I can remove them manually on success at the end. Something like this:
Code: Select all
Conn.StartTransaction;
try
Master.ApplyUpdatesNoFree;
Detail.ApplyUpdatesNoFree;
except
Conn.Rollback;
// changes are still cached at this point
Master.Edit;
raise;
end;
Conn.Commit;
Master.FreeUpdates;
Detail.FreeUpdates;
TIA,
-- Pedro Gimeno