|
|
| There's more than one way to do things | |
| PerlMonks |
Implementation Of Fetchall_hashrefby Revelation (Deacon) |
| on Apr 02, 2002 at 19:57 UTC ( [id://156188]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.Revelation has asked for the wisdom of the Perl Monks concerning the following question:
As many may know, fetchall_hashref was never implemented for DBI, although fetchall_arrayref has been implemented. I've been focusing on strategies to create my own cookie cutter subroutine, which will let me fetch a value like so: my @recs = subroutine("with certain input that will be specified for each sub");, and to return a row of data a user would use: $recs[0 .. last row - 1]->{FIELD}; I've also decided that field should be case sensitive, and I hope that other perl monks will give sugestions to optimizing these versions, or another (faster hopefully) version (maybe implementing fetchall_arrayref, or some other optimization method that I'm not aware of?)
The 3 queries that I have written rely on two differant DBI queries: fetchrow_hashref, and bind_columns/fetchrow_arrayref. The bind_hash_query, and bind_hash_query_arraydec subroutines are very similiar, but deal with binding two differant ways (per the sugestion of perl.com, and perldoc.com). So, here's the three implementations of fetchall_hashref I have, and what exactly is needed for each to function: Notice: The code is not all my own, in fact it comes from multiple sources, with a few spoofs and spiffs by myself to create hashes, etc. The queries themselves: If Time Bunce is around, his help would be most appreciated ;) Gyan Kapur gyan.kapur@rhhllp.com
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||