On 12/7/04 5:40 PM, Tim Bunce wrote:
> On Tue, Dec 07, 2004 at 04:40:51PM -0500, John Siracusa wrote:
>> That's what DBI wrappers do, and I have one of those too. But my DBI
>> wrapper reads its connection information for each "logical" data source from
>> a hash. Then there's a build_dsn() method that assembles the pieces
>> according to the name of the driver.
>>
>> If each DBD did that for me, I could just pass a reference to my connection
>> info hash directly to DBI->connect() and then remove the build_dsn() code
>> from my wrapper.
>
> Assuming that each DBD used the same names for elements with the same meaning
> (database vs dbname vs db vs sid etc etc).
That'd be nice, but it's not strictly necessary, IMO. It's not as if the
exact same connect args get reused for many different database types very
often. If you change the actual database (e.g., from Oracle to Postgres),
you're going to have to revisit the connect args anyway, if only to change
the user/pass. And at that point, you're going to have to look at the
DBD::Whatever docs to see what kind of connect args this new database type
accepts anyway. Maybe it doesn't even take host and port, for example.
That said, yeah, things like "database name", "host", and "port" should
probably have common param names. Let's take 5 minutes to come up with a
list :)
Here's the obvious list:
username
password
database
host
port
Here's the penny wise, pound foolish (IMO :) list:
user
password
db
host
port
Additions? Votes?
-John