Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-09-18 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls