On Thu, 19 Apr 2001 10:17:44 +0800 (PHT), Victor Michael Blancas alluded:
> Why is it that for DBD::Pg 0.95, the connect string is:
>
> $dbh = DBI->connect("dbi:Pg:dbname=$dbname", $username, $password);
>
> but in DBD::Pg 0.96, this doesn't work. I was only able to connect using
> the following connect string:
>
> $dbh = DBI->connect("dbi:Pg:dbname=$dbname;user=$username;password=$password");
>
> Is this a new DBI spec, or just for DBD::Pg. Could someone enlighten me.
> Thanks.
It's a bug, Here's a patch from Mark Stosberg:
--- Pg.pm.org Sun Apr 15 20:55:37 2001
+++ Pg.pm Sun Apr 15 20:54:07 2001
@@ -79,11 +79,15 @@
$Name =~ s/^.*dbname\s*=\s*//;
$Name =~ s/\s*;.*$//;
- $user = "" unless defined($user);
- $auth = "" unless defined($auth);
+ # if the $user and $auth aren't defined,
+ # first default to $ENV{DBI_USER} and $ENV{DBI_PASS}
+ # and then to "" if they are still undefined
+
+ $user = $ENV{DBI_USER} unless defined($user);
+ $auth = $ENV{DBI_PASS} unless defined($auth);
- $user = $ENV{DBI_USER} unless $user eq "";
- $auth = $ENV{DBI_PASS} unless $auth eq "";
+ $user = "" unless defined($user);
+ $auth = "" unless defined($auth);
my($dbh) = DBI::_new_dbh($drh, {
'Name' => $Name,
Jeff