[Nottingham] SQLite and 'locking'

David Aldred david at familyaldred.org.uk
Mon Feb 26 18:02:33 GMT 2007


On Monday 26 February 2007 17:39, martin wrote:
> On Mon, 2007-02-26 at 09:21 -0800, Ovid wrote:
> > --- David Aldred <david at familyaldred.org.uk> wrote:
> > > 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.
> >
> > No offense, but I don't think you really want that.
> >
> > Most bugs in database applications stem from lack of data integrity and
> > what you're describing smacks of a violation of third normal form.
>
> I agree with the normalisation in your example, and also with the use of
> surrogate keys, but doesn't the problem here come from duplication of
> information rather than a de-normalised layout?
>
> In other words, by removing the "booked" flag and instead using
> booked_by == null to indicate no booking, the integrity issue goes away.

Yes, that seems a more straightforward answer to that issue!  

-- 
David Aldred



More information about the Nottingham mailing list