Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^6: Perl DBI

by Tux (Monsignor)
on Jul 01, 2013 at 10:51 UTC ( #1041812=note: print w/ replies, xml ) Need Help??

in reply to Re^5: Perl DBI
in thread Perl DBI

There are plenty ways to do it fast. The "best" way might be using a hash combined with bind_columns as described in the documentation:

my $dbh = DBI->connect ($dsn, $user, $pass, { FetchHashKeyName => "NAM +E_lc", }); my ($sth, %rec) = $dbh->prepare ("select * from $tbl"); $sth->execute; $sth->bind_columns (\(@rec{@{$sth->{NAME_lc}}})); while ($sth->fetch) { $rec{"ne"} eq $bsc or next; # All fields accessible by their name (lc) }

Enjoy, Have FUN! H.Merijn

Comment on Re^6: Perl DBI
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041812]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-11-25 15:00 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (679 votes), past polls