On Saturday 10 June 2006 14:25, Gerhard Killesreiter wrote:
I didn't want to see us write an sql parser, but if one already exists (which coincidentally happens to be written by a trusted drupal contributor) we should definitely use it.
Just for the record: I don't really like parsers.
I'd prefer we write our SQL as structured arrays. It will still be readable as SQL and it is easier to manipulate, ie insert additional conditions or remove them.
Cheers, Gerhard
Would this be the appropriate time to say that I've a patch awaiting feedback that does exactly that for INSERT, UPDATE, and DELETE statements? :-) http://drupal.org/node/53488 (Originally written because I despise SQL's INSERT syntax, but I've found them very convenient for flexibility, too.) Doing the same for SELECT statements is harder, because SELECT statements are potentially an order of magnitude more complex. It has been done, though, (PEAR::DB_DataObjects comes to mind), if we really want to go that route. That's a separate issue, though. As for database/table/schema creation, yes please! As a module developer, I work in MySQL because that's what my hosts have and what I know. At the same time, I don't want to make my module non-Postgres friendly simply through ignorance but really don't have the time to learn Postgres' ins and outs. A simple way to support all Drupal-supported databases for table creation means more modules that support Postgres out of the box. (They could still have MySQLisms in the code itself, but that's less likely and a separate issue.) More to the point, it means that if the Oracle or MSSQL or SQLite support patches ever hit core, they'll have a grand total of 0 contrib modules that support them right now. If most of contrib were using some thin table creation abstraction layer, then Oracle or whatnot would have support of most of core out of the box. That's a good thing. -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson