Problem using column_info method and mysql

Problem using column_info method and mysql

am 18.04.2008 16:24:30 von denis

Hello,

I try to fetch column information from a mysql database, but I got the
following error :

DBD::mysql::db column_info failed: Incorrect database name '' at
../indexes.pl line 17.

Here is the code I use :

#!/usr/bin/perl

use warnings;
use DBI;
use strict;

my $dsn='DBI:mysql:xxx:xxx';
my $dbh= DBI->connect($dsn,"xxx","xxx") or die "Unable to connect to
database ($DBI::errstr)";

my $sth=$dbh->table_info('','','%','');

while (my @row = $sth->fetchrow_array) {
my $sth2=$dbh->column_info('',$row[1],$row[2],'%');
while (my @row2 = $sth2->fetchrow_array) {
print "@row2";
}
}

I try several things on the column_info(), nothing worked, and I found
nothing on the mailing list.

What do I make wrong ?

I use mysql 5.0.45-1ubuntu3.3 and libdbi-perl 1.57-1 both in the ubuntu
repositories.

Thanks in advance

Best regards

Denis Sacchet

--
Denis Sacchet aka. Ouba ("`-/")_.-'"``-._
. . `; -._ )-;-,_`)
"Computers are like air conditionners (v_,)' _ )`-.\ ``-'
They stop working properly when you _.- _..-_/ / ((.'
open Windows !!!" ((,.-' ((,/

Re: Problem using column_info method and mysql

am 19.04.2008 02:42:03 von mgainty

Be sure to specify the $databasemy $dsn='DBI:mysql:$database';Bon
ChanceMartin------ Original Message -----
From: "Denis Sacchet"
To:
Sent: Friday, April 18, 2008 10:24 AM
Subject: Problem using column_info method and mysql


> Hello,
>
> I try to fetch column information from a mysql database, but I got the
> following error :
>
> DBD::mysql::db column_info failed: Incorrect database name '' at
> ./indexes.pl line 17.
>
> Here is the code I use :
>
> #!/usr/bin/perl
>
> use warnings;
> use DBI;
> use strict;
>
> my $dsn='DBI:mysql:xxx:xxx';
> my $dbh= DBI->connect($dsn,"xxx","xxx") or die "Unable to connect to
> database ($DBI::errstr)";
>
> my $sth=$dbh->table_info('','','%','');
>
> while (my @row = $sth->fetchrow_array) {
> my $sth2=$dbh->column_info('',$row[1],$row[2],'%');
> while (my @row2 = $sth2->fetchrow_array) {
> print "@row2";
> }
> }
>
> I try several things on the column_info(), nothing worked, and I found
> nothing on the mailing list.
>
> What do I make wrong ?
>
> I use mysql 5.0.45-1ubuntu3.3 and libdbi-perl 1.57-1 both in the ubuntu
> repositories.
>
> Thanks in advance
>
> Best regards
>
> Denis Sacchet
>
> --
> Denis Sacchet aka. Ouba ("`-/")_.-'"``-._
> . . `; -._ )-;-,_`)
> "Computers are like air conditionners (v_,)' _ )`-.\ ``-'
> They stop working properly when you _.- _..-_/ / ((.'
> open Windows !!!" ((,.-' ((,/
>