[nycphp-talk] ORM vs SQL: the ultimate showdown
Ben Sgro (ProjectSkyLine)
ben at projectskyline.com
Sat Sep 15 12:56:23 EDT 2007
Good point. I've only been writing code for MSSQL and MySQL, and currently
Anything that makes our job easier seems good to me!
----- Original Message -----
From: "Paul Houle" <paul at devonianfarm.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Saturday, September 15, 2007 1:14 PM
Subject: Re: [nycphp-talk] ORM vs SQL: the ultimate showdown
> Ben Sgro (ProjectSkyLine) wrote:
>> Why not just do:
>> SET ...
>> first_name = $firstname,
>> last_name = $lastname, ...
>> Which is *basically* the same as what your saying ORM is useful for in
>> this case...
> That's a very nice syntax. It's also mysql-specific. I love mysql,
> and it may be very sensible to build a mysql app that takes advantage of
> great features like this, but many of us need to write apps for
> postgreSQL, Oracle, MS SQL and other databases that don't support this
> (superior) syntax.
> Another advantage of an ORM system is that it can use database metadata
> to validate data much better than addslashes() can. For instance, some
> databases will let you get away with
> UPDATE TABLE SET an_integer_field='55';
> Other databases (for instance, MS Access) won't, and you need to
> UPDATE TABLE SET an_integer_field=55;
> If '55' comes from the outside, you'll want to validate that it's an
> integer. Do you want to write that code by hand every time? Or would you
> like your ORM system to automatically detect the type based on database
> metadata, and give you an intelligible error message like :
> "776krashyourdatabase is not an integer" rather than "Invalid SQL Syntax
> (Code 7719290)."
> I find that I spent entirely too much time dealing with error
> conditions in my code, and welcome anything that makes that work easier.
> New York PHP Community Talk Mailing List
> NYPHPCon 2006 Presentations Online
> Show Your Participation in New York PHP
More information about the talk