Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Select quuery result sets

by Anonymous Monk
on Aug 25, 2010 at 17:14 UTC ( #857251=note: print w/replies, xml ) Need Help??

in reply to Select quuery result sets

Hashes/hashrefs do no guarantee any order returned via keys or values.

Use fetchrow_arrayref() or fetchrow_array() with positions (0,1,2,3,4...), or if you feel like pre-defining the variables, use bind_col() or bind_columns().


Replies are listed 'Best First'.
Re^2: Select quuery result sets
by sundialsvc4 (Abbot) on Aug 25, 2010 at 20:51 UTC

    Hence my suggestion, above, that the simplest approach is simply to remove any assumptions (hence, dependencies) upon the order of the field-names in the query.     Since you have full control over the entire procedure, simply deal with the two problems separately.   The SELECT statement only need make sure that the necessary columns are returned.   Build a separate (Perl) list containing the column-names in the order that you need to present them.   Then, iterate through that list.   Problem (neatly) solved.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://857251]
[Corion]: Also, there's one colleague who wants to join a well-established weekly telco, and I'm not convinced of the use there...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-03-29 07:38 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (344 votes). Check out past polls.