Databasen - Revisited

Ovid publiustemp-londonpm at
Thu Oct 19 15:54:19 BST 2006

--- Piers Cawley <pdcawley at> wrote:
> > That's an alarmingly common idiom in badly written webby code - 
> > either that or trying to work out what the inserted ID was by doing
> > SELECT MAX(id) just after the insert. Racetastic.
> Which reminds me, I wonder how ActiveRecord does that.

In the relational model outlined by date, that would be a compile time
failure because each column (attribute, whatever) has a domain and a
set of operators which affect that domain.  Even though 'id' would
appear to be numeric, numeric operators and functions would fail
because they're not applicable.  By the same token, the following
idiocy would become a compile-time failure:

  SELECT name
  FROM   customer
  WHERE  customer.age >

Now *that* would really be useful (because I've seen plenty of stupid,
yet conceptually similar, queries).



Buy the book --
Perl and CGI --

More information about the mailing list