Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DBI with ORDER BY

by data64 (Chaplain)
on Mar 09, 2005 at 22:32 UTC ( [id://438083]=note: print w/replies, xml ) Need Help??


in reply to DBI with ORDER BY

Perhaps your co-worker is referring to the "fetchall_hashref" method which essentially ends up creating a hash. Hence any sort order imposed by "ORDER BY" is lost.

Needless to say, if you are using "ORDER BY" do not use fetchall_hashref

Replies are listed 'Best First'.
Re^2: DBI with ORDER BY
by merlyn (Sage) on Mar 09, 2005 at 23:19 UTC
    Huh? The hashes are per-row. The rows still come out as a list or arrayref.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.


    update: Yup, I never use fetchall_hashref, and was confusing it with things that I use. Sorry. Too many similar sounding names.
      merlyn, I believe you're thinking of fetchrow_hashref and not fetchall_hashref. The latter does in fact retrieve all the results into a hash (a HoH), thereby effectively discarding any ordering an ORDER BY clause might have imposed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-28 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found