Databasen - Revisited

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


--- Piers Cawley <pdcawley at bofh.org.uk> 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 > customer.id

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

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/


More information about the london.pm mailing list