in reply to Re^2: DBI:how to get name of the db ?
in thread DBI:how to get name of the db ?
In other words, it holds the part after the driver indication in the DSN part. When e.g. connecting to CSV like
my $dbh = DBI->connect ("dbi:CSV:f_ext=.csv/r;f_encoding=utf-8", undef +, undef, { RaiseError => 1 });
The return values for $dbh->{Name} will be f_ext=.csv/r;f_encoding=utf-8, which might not be very useful information.
The fact the DBD::Pg in your case returns the correct database name, might be because you initiated the connection using something like
my $dbh = DBI->connect ("dbi:Pg:dbname=test", ...);
but when you connect using just "dbi:Pg:" in combination with the environment variable $PGDATABASE, you might not get anything useful at all
$ env PGDATABASE=merijn perl -MDBI -wE'say DBI->connect("dbi:Pg:")->{N +ame}||"not known"' not known $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: DBI:how to get name of the db ?
by erix (Prior) on Dec 14, 2011 at 12:04 UTC |