in reply to List columns for a MySQL table

Or, for a more portable approach, use the Catalogue methods that the DBI spec defines and that all DBDs should implement.

Update: Ok. I see you originally used column_info and changed for performance reasons. If column_info is that much slower than raw SQL then I'd suggest that someone should raise a bug against DBD::mysql :-)

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: List columns for a MySQL table
by EvanK (Chaplain) on Jun 30, 2006 at 18:02 UTC
    i dont think it was that column_info() itself was slower, but the processing required on the output of it to get an array of column names probably was...this was the original snippet (with jhourcle's improvement of using map()):
    my $sth = $dbh->column_info( undef, $db, $table, '%'); my $ref = $sth->fetchall_arrayref; my @cols = map { $_->[3] } @$ref;

    __________
    Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
    - Terry Pratchett