[development] Extend database abstraction layer,
to include table creation.
larry at garfieldtech.com
Sat May 13 15:36:12 UTC 2006
On Saturday 13 May 2006 10:17, Angela Byron wrote:
> Dries Buytaert wrote:
> > How can you understand the table definition proposed by Adrian (see
> > below), if you don't know any SQL? I don't think this gets you up to
> > speed any more quickly. Quite the contrary, you'd first have to learn
> > SQL and then you have to figure out how this Drupal specific definition
> > format maps onto it. Make no mistake, a Drupal-specific definition
> > language is no excuse for not having to learn MySQL. It does add an
> > additional step to the learning curve!
> This is a very good point, and something I don't think a lot of us have
> considered while proposing this.
> But I have a question... would the introduction of db_create_table()
> mean removing the ability to just continue copy/pasting PHPMyAdmin dumps
> into db_query()? Or are we simply proposing some additional API
> functions for developers who wish to write portable SQL code in an easy
Adding db_create_table() in no way needs to make db_query("CREATE TABLE...")
stop working. Adding .install files hasn't made the old .mysql files
suddenly not work. MANY contrib modules still use them, and they work
perfectly fine. They just look silly for users because they've an extra step
in installing that module.
Similarly, if Joe Contrib (to abuse a theme) decides to keep using a switch
statement and db_query() in his .install file, that won't break unless he's
on a host where the normal db user doesn't have create table permissions, in
which case we've already just broken him anyway. It's just more work for him
to not use the newer functions. It's less of a difference for the user than
if he were using the old .mysql files instead.
And if someone else comes across such a module and is annoyed by it, it's all
GPLed, so they can scratch that itch and tweak the file. That's already
happened to several contrib modules, as I understand it, to add .install
Unlike Form API, we're not breaking backward compatibility with
table-manipulation functions. The old methods will still work, just be no
longer the recommended way. That sounds like a win-win to me.
Larry Garfield AIM: LOLG42
larry at 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
More information about the development