Page 1 of 1

MyDAC 5.5; automatic locking

Posted: Thu 22 May 2008 14:33
by jkuiper_them
You announced this to the MyDAC 5.50 beta:

Added support of automatic records locking

Now I'm using this code:

Code: Select all

procedure TDM.MyQuery1BeforeEdit(DataSet: TDataSet);
var MyQuery : TMyQuery;
begin
  MyQuery := (DataSet as TMyQuery);
  if not MyQuery.Connection.InTransaction then
    MyQuery.Connection.StartTransaction;
  MyQuery.Lock(lrImmediately);
end;
Does it mean that this code above is not needed anymore :?:

Posted: Mon 26 May 2008 14:00
by Dimon
Automatic records locking takes place when the TCustomDADataset.LockMode property is set to lmPessimistic. In this case the code above is not necessary.
The default value of LockMode is lmNone. Therefore you should set it to lmPessimistic before query opening.