Edit record on TmyTable FetchAll=False problem

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Edit record on TmyTable FetchAll=False problem

Post by kenny » Mon 03 Jan 2005 10:15

Hi,
I used Delphi 5 Ent, MyDAC v3.30.2.15

One of my table contained over than 10000 records
When I open it using TmyTable by setting properties

TItem.FetchAll := False;
TItem.open;

Open is ok, then I used
TItem.Edit;
TItem.Fieldbyname('weight').value := 10;
TItem.Post;

The error appeared : "Lost connection to MySQL server during query" :(

But if my table contained less than few hundreds, then is error wont appeared.

Is this a bugs? Or I have to aware about using FetchAll or else where?
Thanks!

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

Re: Edit record on TmyTable FetchAll=False problem

Post by Ikar » Tue 04 Jan 2005 07:48

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