Subject Re: [firebird-support] get_lock / release_lock
Author Milan Babuskov
Doru Constantin wrote:
> So, you say that I can modify for 30 minutes a document and then I try to
> see if I can commit the changes?
> I need to know that I can comit the changes before I begin to modify the
> doc. It is like pessimistic locking but without any record lock.

Just start the transaction and do the dummy update before starting to
modify it.

For example, you wisht to modify document with ID = 50:

1. start transaction
2. update document set some_field = some_field where ID = 50;
...let the user edit document...
3. update document set some_field = new_value where ID = 50;
4. commit transaction

After step 2, any other transaction try to do the same with ID=50 will
fail. If user decides to cancel editing, instead of 3 and 4, just do
'rollback' of transction.

--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com