"show databases" via DBD::mysql

Paul Makepeace london.pm.org at paulm.com
Thu Jan 12 16:03:39 GMT 2006


I've tried a bunch of things with $dbh->table_info and none seem to be
returning anything about the catalogs/schema, just tables of the
selecting dbname. Anyone?

FWIW,

	my $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1})
			or die "Couldn't connect to $dsn: ", $DBI::errstr;

	my $catalog = '%';
	my $schema  = '';
	my $table   = '';
	my $type    = '';
	my $sth = $dbh->table_info( $catalog, $schema, $table, $type );
	my $rs = $sth->fetchall_arrayref({});
	print Dumper($rs);

If I omit dbname=foo from the DSN it complains about a database not
being selected.

Paul

PS for those that don't read subject lines assiduously, this is about
   MySQL not any other, very possibly compliant, DB.

-- 
Paul Makepeace .............................. http://paulm.com/inchoate/

"If you believe you are one of the gods, then racial hatred will be the
 new religion."
   -- http://paulm.com/toys/surrealism/


More information about the london.pm mailing list