Subject | Re: [firebird-support] Re: Locking tables |
---|---|
Author | Ann W. Harrison |
Post date | 2005-01-13T17:14:22Z |
Tim wrote:
modify other records. In the case at hand, reserving rooms, the gateway
record is the one that describes the room. It's locked by modifying it
with the current user name.
A gateway record is way to provide predicates locking on complex
predicates.
Regards,
Ann
Example:
structure
rooms table including a "being reserved by" field
reservations table includes room identifier
triggers on the reservations table disallow new inserts or
updates unless the room "being reserved by" field matches
the current user
sequence
start transaction
modify room "being reserved by field"
if that succeeds, continue,
otherwise rollback an retry.
validate that the time is free
insert/update reservation
commit
>It's a specific record that you have to modify before you're allowed to
> What's a gateway record?
>
modify other records. In the case at hand, reserving rooms, the gateway
record is the one that describes the room. It's locked by modifying it
with the current user name.
A gateway record is way to provide predicates locking on complex
predicates.
Regards,
Ann
Example:
structure
rooms table including a "being reserved by" field
reservations table includes room identifier
triggers on the reservations table disallow new inserts or
updates unless the room "being reserved by" field matches
the current user
sequence
start transaction
modify room "being reserved by field"
if that succeeds, continue,
otherwise rollback an retry.
validate that the time is free
insert/update reservation
commit