Re: Username and Password attributes in DBI connect

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Tue, 29 Oct 2013 09:26:56 +0100, Michiel Beijen
<[email protected]> wrote:

> Hi,
> 
> DBD::mysql received a bug report
> (https://rt.cpan.org/Public/Bug/Display.html?id=89835) which reads:
> 
> "DBI docs say:
> =========
> The username and password can also be specified using the attributes
> Username and Password, in which case they take precedence over the
> $username and $password parameters.
> =========
> 
> This refers to: https://github.com/perl5-dbi/dbi/blob/master/DBI.pm#L2750
> 
> I think this should look like this:
> 
> my $dbh = DBI->connect(
>     "DBI:mysql:test",
>     {
>         PrintError => 0,
>         Username => 'foo',
>         Password => 'bar'
>     }
> );

I think it should look like this:

my $dbh = DBI->connect ("dbi:mysql:test", undef, undef, {
    PrintError => 0,   #                  ^^^^^  ^^^^^
    Username   => $user,
    Password   => $pass,
    });

> I think *if* this is supposed to be working it should be implemented
> in DBI rather than in the driver, am I right?

If called like what I just showed, DBD::XXX::dr::connect can do with it
whatever it likes

> --
> Mike


-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.19   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.