TZConnection.ApplyUpdates suggestion
Posted: 25.09.2008, 11:33
Equivalent to the TDbConnection I'm missing a small helper method, which I've reimplemented as a single function.
Perhaps you may implement this in the next release of ZeosLib. It's a small addition, but helps to transfer existing BDE code into ZeosLib for those, like me, who used to code like this:
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]);