AW: <<Spam-Verdacht>> warning message: DBI->connect using "old-style" syntax is depre

AW: <<Spam-Verdacht>> warning message: DBI->connect using "old-style" syntax is depre

am 06.01.2006 15:51:02 von Gisbert.Selke

> -----Ursprüngliche Nachricht-----
> Von: John Chambers [mailto:JLChambers@klikwood.com]
> Gesendet: Freitag, 6. Januar 2006 15:39
> A few weeks ago, I upgraded an old Debian system to Sarge, and I =
started
> receiving these error messages:
> DBI->connect using 'old-style' syntax is deprecated and will=20
> be an error in future versions at blib/lib/invlib.pm line 20
> in my apache logs.=20
> Now, I'm building a newer system from scratch, and when I=20
> make test my local modules, I'm getting that message.
> The scripts still work, but I prefer no warnings
Good idea.

> What is the new syntax? Here is my call:
> (my $dbh =3D DBI->connect( 'sheet', 'jc', 'secret', 'mysql' ) ) or =
die
> "Cannot do \$dbh->connect: $DBI::errstr\n";
A very brief look into the DBI docs reveals:

$dbh =3D DBI->connect($data_source, $username, $password)
or die $DBI::errstr;
$dbh =3D DBI->connect($data_source, $username, $password, \%attr)
or die $DBI::errstr;
[...]
Examples of $data_source values are:

dbi:DriverName:database_name
dbi:DriverName:database_name@hostname:port
dbi:DriverName:database=3Ddatabase_name;host=3Dhostname;port =3Dport
[...]
For compatibility with old DBI scripts, the driver can be specified =
by
passing its name as the fourth argument to connect (instead of \%attr):

$dbh =3D DBI->connect($data_source, $user, $pass, $driver);

In this ``old-style'' form of connect, the $data_source should not =
start
with ``dbi:driver_name:''. (If it does, the embedded driver_name will =
be
ignored). Also note that in this older form of connect, the
$dbh->{AutoCommit} attribute is undefined, the $dbh->{PrintError} =
attribute
is off, and the old DBI_DBNAME environment variable is checked if =
DBI_DSN is
not defined. Beware that this ``old-style'' connect will be withdrawn =
in a
future version of DBI.

\Gisbert

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org