Row locking and InnoDB

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Row locking and InnoDB

Post by vortex77 » Mon 12 Mar 2007 10:06

Hi,

is there a way to check data lock for single row?

I'm using INNODB and have created procedure to lock current record. Everything is working fine until i try to access that record from another user (different computer). Than program just frezzes until innodb_lock_wait_timeout passes and than show's error message.
I guess thats the way it should work, but i need to check for this lock before it goes on timeout.


Please help!

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 12 Mar 2007 12:11

There are two ways to solve this problem. The first one is to decrease the innodb_lock_wait_timeout parameter as much as possible. The second way is to implement locking yourself by adding a column that indicates that the row is beeing locked to your table. In the second case, you will have to implement procedures to manage and check values in the added column.

vortex77
Posts: 15
Joined: Wed 20 Sep 2006 11:03

Post by vortex77 » Mon 12 Mar 2007 12:17

Thank you.

I did this using your 1 solution, but was hoping that myDAC could provide a "nicer" way of checking for locks. Anyway tnx very much.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 12 Mar 2007 12:51

Unfortunately MySQL server does not provide another way to check if the record is being locked.

Post Reply