MyDAC

TCustomMyDataSet.Lock Method

Locks the current record for the current connection.

Class

TCustomMyDataSet

Syntax

procedure Lock; overload; override;

Remarks

Locks the current record for the current connection. Serves to prevent simultaneous editing of the same record by several users. Makes sense only for InnoDB tables and can be called only inside transaction context.

If any other connection tries to modify the locked record, it will wait for the time specified by innodb_lock_wait_timeout server variable, by default 50 seconds.If during this time the record will not be unlocked, an exception raises.

The record is unlocked on finishing transaction (Commit or Rollback).

Note: This method is uncompatible with the TCustomMyDataSet.FetchAll property set to False.

Lock can be used only with queries returning resultset.

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback