On Fri, Dec 03, 2004 at 05:48:35PM +1300, Sam Vilain wrote:
> Ken Williams wrote:
> >
> >On Dec 1, 2004, at 3:48 AM, Tim Bunce wrote:
> >
> >>I know what it does, I'm trying to find real examples that demonstrate
> >>why people think it's needed. Nick has provided a good one. Any others?
> >
> >Suppose someone's creating a GUI app (Perl/Tk, etc.) in which the end
> >user fills in the server, port, user, password, and database into a
> >screen of some sort. The back-end app will have to know how to
> >translate that into a DBI connection string. And it's probably not
> >reasonable to make the user understand the details of how to make a DBI
> >connection string in this case.
>
> Can I point out that you seem to be assuming the MySQL/Pg model of how
> servers, ports, databases, users and passwords work.
>
> This all has no meaning to SQL*Net (Oracle), SQLite, ODBC and probably
> other databases, too.
>
> I suspect this is part of the reason that Tim is questioning your
> objectives!
Yes. It's finely balanced though. I can see merit on both sides.
The "fill in a form" situation is relatively common. But beyond the
"MySQL/Pg model of how servers, ports, databases" work there's also
the question of specifying attributes. Taking mysql as an example,
specifying mysql_client_found_rows=1 is common (or should be :)
and mysql_local_infile=1 can be needed (at least for some versions).
Then there's SSL:
mysql_ssl=1
mysql_ssl_client_key=...
mysql_ssl_client_cert=...
mysql_ssl_ca_file=...
mysql_ssl_ca_path=...
mysql_ssl_cipher=...
I wouldn't like to be filling in all that on a form. (And there's
no need to tell me there are ways to avoid specifying all those
through config files, I'm just making a general point here :)
I try to make the DBI design hit the "sweet spot" of general utility
(while still enabling driver-specific features in a way that's portable).
It's clear to me that the DBI hasn't quite hit the sweet spot here.
The simplest fix is to standardize one set of driver DSN attribute
names so that at least the host, port, and database (schema) can
be specified in a portable way.
Most drivers already support the "foo=bar;..." style in the DSN string.
They'd just need to support alternative names for some attributes.
As for what names to use, "host" and "port" are easy choices.
For the database there's "db", "dbname", and "database".
I'd probably go with "db".
Tim.