[Nottingham] SQLite and 'locking'

martin martin at stupids.org
Mon Feb 26 17:39:20 GMT 2007


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.

As I said, I can't disagree on using 3rd normal form, but it doesn't
seem to me to be the main problem in this case.

-- 
Martin.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/nottingham/attachments/20070226/afedf242/attachment.bin


More information about the Nottingham mailing list