[Nottingham] SQLite and 'locking'
David Aldred
david at familyaldred.org.uk
Mon Feb 19 22:30:52 GMT 2007
There was a discussion here a bit ago about databases and (specifically) why
MySQL wasn't always the best around - I've got a related question and want to
check my understanding!
I want a routine which checks whether a 'status' field in a record
is 'booked', and if it isn't changes it to 'booked' and updates
the 'bookedby' field to show who's booked it. Actually it's slightly more
complex than that, but that's the basic issue.
I don't want more than one person able to get a booking, so if person A is
between reading the status and changing it, person B's (and persons C..Z, of
course!) shouldn't be able even to read the status.
If I do something like:
BEGIN EXCLUSIVE
<read the status and check it's not already booked>
<book what needs booking>
END
Does that achieve what I need? I think it does....
--
David Aldred
More information about the Nottingham
mailing list