Code: Select all
procedure TZConnection_ApplyUpdates(aConn: TZConnection; DataSets: array of TZAbstractDataset);
var
I: Integer;
DS: TZAbstractDataset;
begin
aConn.StartTransaction;
try
for I := 0 to High(DataSets) do
begin
DS := DataSets[I];
if DS.Connection <> aConn then
raise EZSQLException.Create(Format(SUpdateWrongDB, [DS.Name, aConn.Name]));
DataSets[I].ApplyUpdates;
end;
aConn.Commit;
except
aConn.Rollback;
raise;
end;
for I := 0 to High(DataSets) do
DataSets[I].CommitUpdates;
end;
Code: Select all
Connection.ApplyUpdates([SomeTxQry, RelatedDetailQry]);