AnyDAC
ContentsIndexHome
PreviousUpNext
TADRdbmsDataSet.UpdateTransaction Property

Gets / sets reference to transaction object.

Group
Links

The UpdateTransaction property allows to associate dataset internal update commands with explicit transaction object. If it is not specified, then dataset update commands will be associated with connection default update transaction. If it is not specified, then - with dataset Transaction. 

For Prepare, Open, ExecSQL, ExecProc, Execute methods will be used Transaction objects. 

Currently explicit update transaction object assignment is supported only for Interbase / Firebird servers.

property UpdateTransaction: TADCustomTransaction;
var
  oSelectTransaction: TADTransaction;
  oUpdateTransaction: TADTransaction;
  oCusts: TADQuery;
.....
  oSelectTransaction := TADTransaction.Create(nil);
  oSelectTransaction.Connection := ADConnection1;
  oSelectTransaction.Options.ReadOnly := True;

  oUpdateTransaction := TADTransaction.Create(nil);
  oUpdateTransaction.Connection := ADConnection1;

  oCusts := TADQuery.Create(nil);
  oCusts.Connection := ADConnection1;
  oCusts.Transaction := oSelectTransaction;
  oCusts.UpdateTransaction := oUpdateTransaction;
  oCusts.Open('select * from Customers'); // uses oSelectTransaction
  ...
  oCusts.Edit; // uses oUpdateTransaction, if needed
  ...
  oCusts.Post; // uses oUpdateTransaction
What do you think about this topic? Send feedback!