Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Question about fetchall_arrayref

by sundialsvc4 (Abbot)
on Apr 28, 2014 at 16:13 UTC ( #1084145=note: print w/ replies, xml ) Need Help??

in reply to Question about fetchall_arrayref

(1) If you need to know the number of rows that meet the criteria for a query, ask the SQL servers to execute SELECT COUNT(*) AS numrows FROM ... to get a one-row result containing the count.

(2) Generally I think it is a much-preferred idea to retrieve rows one at a time, not to retrieve all rows.   Also, to retrieve it as a hashref and to access the columns by their name.   Your program should not care how many (millions of?) rows there might be, and it certainly should be written in the most descriptive, easy-to-understand and easy-to-maintain way possible.

Since this isn’t a code-writing service, I am not going to delve into the whys or the wherefores of your particular program.

Comment on Re: Question about fetchall_arrayref

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2015-11-25 23:11 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (693 votes), past polls