Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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

by jfroebe (Parson)
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?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-06-18 12:15 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.