MySQL and locking mechanism
Posted: Fri 22 Jun 2007 14:58
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