MyDAC 5.5; automatic locking

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jkuiper_them
Posts: 28
Joined: Thu 20 Dec 2007 14:48

MyDAC 5.5; automatic locking

Post by jkuiper_them » Thu 22 May 2008 14:33

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 :?:

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 26 May 2008 14:00

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.

Post Reply