Yes you can.  From the fine cheetah book, under metadata...

my @tables = $dbh->tables();
foreach my $table ( @tables ) {
    print "Table: $table\n";
}



-Mike


At 11:49 AM 11/26/2002, Jeff Seger wrote:
I may be wrong...I seem to be making a habit of it lately...but I don't
think you can.  SHOW TABLES is a mysql command, not an sql statement.

On Tue, 2002-11-26 at 10:02, darren chamberlain wrote:
> * Chris Rogers <[EMAIL PROTECTED]> [2002-11-26 09:45]:
> > Is there a way to get a list of all table names in specific database
> > using DBI::mysql in Perl?
>
> Can you use SHOW TABLES?  E.g.:
>
>   sub show_tables {
>       my $dbh = shift;
>       my ($sth, @tables, $table);
>
>       $sth = $dbh->prepare("SHOW TABLES");
>       $sth->execute;
>
>       while ($table = $sth->fetchrow) {
>           push @tables, $table;
>       }
>
>       $sth->finish;
>
>       return @tables;
>   }
>
> (darren)
>
> --
> I have learnt silence from the talkative, toleration from the
> intolerant, and kindness from the unkind; yet strange, I am
> ungrateful to these teachers.
>     -- Kahlil Gibran
>



Reply via email to