Subject | How do I "lock tables" in FireBird SQL? |
---|---|
Author | Zd |
Post date | 2007-07-15T15:51:23Z |
Dear group,
I've just joined and I'd like to ask for your help.
I'm migrating from MySQL to Firebird (Firebird seems to be sooo much better!) and I've run into a database design issue.
In the system I'm designing, multiple users access documents, but one document can only be edited by one person at a time.
Thus, I thought about creating a separate "resource reservation" table, where users can reserve resources for themselves - till they need it.
A typical reservation would consist of a SELECT then an INSERT operation. If the SELECT operation says that there is no other reservation on that SPECIFIC record, the user can use INSERT to reserve it.
The problem: between one user's SELECT and INSERT statements, another user could do an INSERT - the result would be 2 reservations on the same resource, which is a catastrophe!
In MySQL, you could issue a LOCK TABLE command, do the select/insert then call UNLOCK TABLES.
How do I go about solving this problem in Firebird? What's the best solution for this?
Thank you so much for the help!
-Zd
[Non-text portions of this message have been removed]
I've just joined and I'd like to ask for your help.
I'm migrating from MySQL to Firebird (Firebird seems to be sooo much better!) and I've run into a database design issue.
In the system I'm designing, multiple users access documents, but one document can only be edited by one person at a time.
Thus, I thought about creating a separate "resource reservation" table, where users can reserve resources for themselves - till they need it.
A typical reservation would consist of a SELECT then an INSERT operation. If the SELECT operation says that there is no other reservation on that SPECIFIC record, the user can use INSERT to reserve it.
The problem: between one user's SELECT and INSERT statements, another user could do an INSERT - the result would be 2 reservations on the same resource, which is a catastrophe!
In MySQL, you could issue a LOCK TABLE command, do the select/insert then call UNLOCK TABLES.
How do I go about solving this problem in Firebird? What's the best solution for this?
Thank you so much for the help!
-Zd
[Non-text portions of this message have been removed]