Avoid table locking

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Hanne Berthelsen
Posts: 15
Joined: Thu 18 Nov 2004 07:51

Avoid table locking

Post by Hanne Berthelsen » Thu 19 May 2005 11:19

How do I avoid table being locked when opening a query (TMyQuery->Open) ?

I have two applications using the same table - the table cannot be used by second application when first application runs a query to generate a report (QuickReport).

What should be selected for TMyConnection or TMyQuery to avoid the locking ?

Regards Hanne

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 19 May 2005 11:22

The problem occurs because of locking MyISAM tables. If you try to
update underfetched table MySQL waits while it will be completely fetched.
Please refer to MySQL Reference manual 5.3 Locking Issues for details.
To avoid the problem you can use any of following solutions.
- set FetchAll to True;
- change type of the table into, for example, InnoDB.

Post Reply