in reply to Getting Column Names from DBI?

The fetchrow_hashref() method will return the column names as keys. For newer DBI there is a FetchHashKey attribute which gives some control over the form of the keys. See the DBI pod.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Getting Column Names from DBI?
by diotalevi (Canon) on Oct 09, 2002 at 21:03 UTC

    Perhaps I'm daft but I've always preferred DBI's fancy form of binding directly to hash variables.

    (direct quoting from DBI) Here's a more fancy example that binds columns to the values inside a hash (thanks to H.Merijn Brand): $sth->execute; my %row; $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } )); while ($sth->fetch) { print "$row{region}: $row{sales}\n"; }
    __SIG__ printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B:: +svref_2object(sub{})->OUTSIDE