[development] Any solution for solving DB reserved wordconflict?

Larry Garfield larry at garfieldtech.com
Mon Feb 18 18:57:52 UTC 2008


On Mon, 18 Feb 2008 11:18:13 -0600, "David Durham, Jr." <david.durham.jr at gmail.com> wrote:
>> Totally correct. Each DB come with its specific delimited identifiers,
>> e.g. ` (MySQL), " (PostgreSQL, Oracle, DB2, SQLite), [ ] (MSSQL). So
>> what I am proposing in http://drupal.org/node/371 is quite simple: use
>> an universal token, as like as the idea of { } for table prefix.
> 
> Well, I see you're already on the right track.  I should have read
> that first ... :)      One thing to keep in mind is that delimited
> identifiers are case sensitive per the SQL standard.  That's probably
> not an issue, I just didn't see it brought up, and it's something to
> be aware of.  This is something that an ORM deals with easily because
> it already has the concept of identifiers.
> 
> -Dave

Actually, that's something a query builder helps with since it deals with structured data and the builder can do whatever escaping is needed without a regex.  An ORM is a different matter.

One of the take-aways for me from the Data API Design Sprint was that we do not, in fact, want a classic ORM.  An ORM is an Object-*Relational*-Mapper.  We need to be able to handle more data than just that coming from a local relational database.  That means we do not want an ORM, we want an object-storage-mapper.  

A query builder, on the other hand, is a different and still perfectly usable animal.  It's entirely SQL-centric, which for many uses is fine.  

I'm actually against adding more regexes to the database system.  Regexing a serialized data structure is a design flaw.  If we're colliding with reserved words, let's just update the schema to not use reserved words per the SQL 99 spec.  Problem solved.

--Larry Garfield



More information about the development mailing list