On Tue, 03 Aug 2004 22:45:46 -0700, Dean Arnold wrote:
> Hashrefs are declarative....SQL is declarative...
> Methods are procedural.

So?  DBI isn't supposed to be SQL, it's supposed to be a database
abstraction interface.  The structure and syntax of SQL is
intentionally separate, so much so that DBI doesn't even want to ever
have to parse SQL, let alone try to model its interface after it. 
That was not a motivation for the existing interface, AFAIK.  And even
if it was, it'd still be misguided :)

> I realize many perl users seem hell bent on turning the language into 
> Java-yuk-foo. Please don't.

Funny, "Java-yuk-foo" is exactly what I think when I see names like
"RaiseError" and "PrintError" ;)

> As for me, give me a tie, and let declaration guide me....

As has been pointed out, it's pretty hard to, say, prepare or execute
SQL "declaratively."  But regardless, DBI is not trying to be SQL. 
DBI is an interface that takes SQL arguments to some of its functions,
but also includes lots of other functions that don't involved SQL at
all: handle and cursor traits, connecting and disconnecting,
transaction management, fetching, param binding, etc. etc.

This "extra" functionality is arguably the most important part of DBI,
since the actual SQL must necessarily be allowed to be
vendor-specific.  The unifying interface of DBI is made up of the
actual functions that take SQL strings as arguments (not the SQL
strings themselves) plus all the other functions that don't involve
SQL at all, but instead deal with the abstractions generated by the
functions that do accept SQL.

DBI's existing interfaces makes it much more difficult and fidgety to
subclass things easily, or even aggregate the component parts. 
There's a lot of "magic" lurking behing all those innocent looking
$sth and $dbh variables.  It's not a particularly friendly or
extensible interface, and there's definitely a big mismatch with the
direction of Perl 6 style interfaces.  Even if it has to wait for DBI
3 or 4, the days of "magical" assignments to $h->{'JavaYukFoo'} are
numbered...

(...I hope! :)

-John

Reply via email to