Subject RE: [firebird-support] How best to prevent overlapping updates by multiple users?
Author Svein Erling Tysvær
Generally speaking, Mitch, Firebird uses an optimistic approach to 'locking'. Still, that doesn't mean that two users can update the same record simultaneously. It should be possible to circumvent if using wrong transaction isolation, but normally, the second attempt to update the record would result in an error. This of course assumes that you attempt to do the update within the same transaction as you are using for reading.

Try for yourself and see how your program behaves, and read a bit about transaction isolation in Firebird.

HTH,
Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of mlq97
Sent: 6. mars 2008 16:45
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How best to prevent overlapping updates by multiple users?

I'm a bit puzzled as to the best way to achieve the following:

I have rows which represent documents and they include an "Issued"
date column and a "Cancelled" date column. A document can have 3 states:
"Draft" (both date columns are null).
"Issued" ("Issued" date column is not null."Cancelled" date column is
null).
"Cancelled" ("Cancelled" column is not null).

Depending on the document state, other columns may be "locked" and
updates to them are prohibited. At all times some of the columns must
remain editable.

What is the best way to cater for the situation where 2 users open the
same draft document simultaneously and one user changes its state to
"issued"? This supposedly locks certain columns but the other user
still sees the document as a "draft" and can still update the "locked"
columns?

I'd be really grateful for any guidance on this.
Many Thanks
Mitch