Subject | Re: [firebird-support] lock conflict on no wait transaction |
---|---|
Author | Helen Borrie |
Post date | 2008-01-18T13:42:56Z |
At 12:05 AM 19/01/2008, you wrote:
Behind the scenes, at the client, you would have some mechanism whereby you save the user's changes somewhere, rollback the transaction and start over using the saved changes, so that the user simply has to click a button. There are several alternative ways you might want to handle that exception, as well...
./heLen
>> >How can I avoid this error?No, not if they are not "errors". A locking conflict is an EXCEPTION. It results from a conflict between two attempts to update the same record. We CATCH exceptions in our application and act accordingly.
>> >
>> >lock conflict on no wait transaction
>> >deadlock
>> >update conflicts with concurrent update
>>
>> Can you explain why you want to avoid this error?
>
>Shouldn't we avoid errors in our applications? :)
>Actually, it wasn't clear for me what would cause such error. Now IWell, it *could* be a long transaction or a short transaction. It's not the length of the transaction that causes the locking conflict. It is the fact that the database engine is DESIGNED to prevent one transaction from updating a record if another user already has a pending update (or a delete) on that record. You (application developer) are meant to catch that particular locking conflict in the error status vector, interpret its implications and handle it. Typically, you would intercept that exception and give the user a message such as "Someone else is changing that record. Please try again."
>know it's a long transaction locking a lot of records.
Behind the scenes, at the client, you would have some mechanism whereby you save the user's changes somewhere, rollback the transaction and start over using the saved changes, so that the user simply has to click a button. There are several alternative ways you might want to handle that exception, as well...
./heLen