Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: fetchrow_array

by injunjoel (Priest)
on May 27, 2005 at 18:26 UTC ( [id://461188]=note: print w/replies, xml ) Need Help??


in reply to Re^3: fetchrow_array
in thread fetchrow_array

Greetings all,
Here is my crack at it.
we know that
$sth->{NAME_lc};
returns the column names selected and lower-cased. with that we then utilized those names as a hash slice from the hash %row with the
@row{ @{$sth->{NAME_lc}}};
part. So up to this point we have a hash %row with keys equal to the lower-cased column names returned from the query. So next we reference the slice for the bind_columns call, which we accomplish by doing an \ on the entire list; the same as saying
$sth->bind_columns(\($var1, $var2, $var3));
which would create references for each var in the list.
Nice way of doing it and probably one I will adopt in the future since I mostly use either fetchrow_hashref or just bind explicit vars.
Does that make sense?

-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found