Subject | Handling deadlocks using ODBC |
---|---|
Author | robertz82 |
Post date | 2005-12-08T09:28:09Z |
Hi @All
I've got a problem with deadlock-handling. I'm writing a small
interface for Firebird access using C++ and ODBC. I'm new at database
programming and firebird. Hope you'll understand my problem =)
The situation:
User one posts a statement like this
"update table set field = 'XXX' where pk = 1"
... and don't commits because he's running a transaction and has to
do a little more stuff that has to be "rollbacked" if anything fails.
User two is just browsing around and has to edit one of the records,
user one has updated before. In C++ using ODBC I use:
Recordset.Edit()
// [...] Set field values [...]
Recordset.Update()
to edit and save a record. The problem is: Recordset.Update() always
returns AFTER user one commits or rollbacks his transaction. This is
simply too late. Is there any way to define a deadlock-detection
delay and force Update() to return ?
BTW: Optimistic locking simply suxx in most cases. Is there any way
to implement pessimistic locking in Firebird ?
Greetingz,
Robert
I've got a problem with deadlock-handling. I'm writing a small
interface for Firebird access using C++ and ODBC. I'm new at database
programming and firebird. Hope you'll understand my problem =)
The situation:
User one posts a statement like this
"update table set field = 'XXX' where pk = 1"
... and don't commits because he's running a transaction and has to
do a little more stuff that has to be "rollbacked" if anything fails.
User two is just browsing around and has to edit one of the records,
user one has updated before. In C++ using ODBC I use:
Recordset.Edit()
// [...] Set field values [...]
Recordset.Update()
to edit and save a record. The problem is: Recordset.Update() always
returns AFTER user one commits or rollbacks his transaction. This is
simply too late. Is there any way to define a deadlock-detection
delay and force Update() to return ?
BTW: Optimistic locking simply suxx in most cases. Is there any way
to implement pessimistic locking in Firebird ?
Greetingz,
Robert