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

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-12-19 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls