Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084145]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-05-22 07:01 GMT
Find Nodes?
    Voting Booth?