MySQL and locking mechanism
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
MySQL and locking mechanism
Hello
I have a serious problem.
I have an application for Data entry. It takes a field one by one and presents the user to enter data.
I have a manual locking mechanism. The table with data has a boolean field, so when smb wants to edit the record it is set to True thus preventing other users to take it.
The procedure is as follows:
- Start transaction
- Get first matching record
- Set lock field to true
- Commit transaction
If two concurent users try to Get the same first matching record one of them waits until the other one commits transaction so it sees that it is manually locked and skips it.
Everything works fine until some point where application freezes.
Can you tell me where the problem can be? I think this is due to a deadlock somewhere. How MyDAC copes with deadlocks? Is there a mechanism to know that a dead lock appears?
Thanks. Bye
I have a serious problem.
I have an application for Data entry. It takes a field one by one and presents the user to enter data.
I have a manual locking mechanism. The table with data has a boolean field, so when smb wants to edit the record it is set to True thus preventing other users to take it.
The procedure is as follows:
- Start transaction
- Get first matching record
- Set lock field to true
- Commit transaction
If two concurent users try to Get the same first matching record one of them waits until the other one commits transaction so it sees that it is manually locked and skips it.
Everything works fine until some point where application freezes.
Can you tell me where the problem can be? I think this is due to a deadlock somewhere. How MyDAC copes with deadlocks? Is there a mechanism to know that a dead lock appears?
Thanks. Bye
Probably this topic of MySQL Reference Manual will help you to solve the problem.
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
-
GuzunNicolae
- Posts: 78
- Joined: Wed 17 Jan 2007 14:16
Very good. Thanks
But I want to know, what exactly have you fixed?
The application freezing or the Query to raise exception?
If the first can you please tell me what was the problem?
And when will be the next release of MyDAC? I need to solve this problem as fast as possible. The project already started.
But I want to know, what exactly have you fixed?
The application freezing or the Query to raise exception?
If the first can you please tell me what was the problem?
And when will be the next release of MyDAC? I need to solve this problem as fast as possible. The project already started.