Page 1 of 1

TZConnection.ApplyUpdates suggestion

Posted: 25.09.2008, 11:33
by wobben
Equivalent to the TDbConnection I'm missing a small helper method, which I've reimplemented as a single function.

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;
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

Connection.ApplyUpdates([SomeTxQry, RelatedDetailQry]);

Posted: 25.09.2008, 21:06
by mdaems
Hi Wobben,

Why don't you get your hands dirty and add this method to the TZConnection component. The check for the right datasets could be done using the list FDatasets.

Just write, test and post it here. I'll add the method to SVN (for the next version, not as a patch to current stable branch)

Thanks,

Mark