Subject Re: [firebird-support] Re: Locking tables
Author Ann W. Harrison
Tim wrote:
>
> What's a gateway record?
>

It's a specific record that you have to modify before you're allowed to
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