Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Tie'ing a dbh result set? (unknown size)

by jfroebe (Vicar)
on Jul 26, 2011 at 17:29 UTC ( #916806=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Tie'ing a dbh result set? (unknown size)
in thread Tie'ing a dbh result set?

One teeny tiny problem with that.. if the size of the Tie'd array is say a maximum of 5000 entries, the 5001st will not be returned correctly to your for loop as the size of the array is 5000 not 5001. (assuming you grabbed the next 5,000 rows)

One way around this is by Tie'ing the array to a hash where the key is the index value. The next grab could either replace the key/value pairs with 5001/row data or purge the hash data structure and assign a new one depending on which is better for the application in question. The FETCHSIZE() will have to report this pseudo size so the for loop thinks there is another entry to retrieve.

The module Tie::File implements something similar.

Jason L. Froebe

Blog, Tech Blog


Comment on Re^4: Tie'ing a dbh result set? (unknown size)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-09-22 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (208 votes), past polls