great I have been using it for a few hours already :), thanks

On Fri, Jan 25, 2013 at 3:45 PM, Jeremy Evans <[email protected]>wrote:

> On Friday, January 25, 2013 8:37:49 AM UTC-8, Jeremy Evans wrote:
>>
>> Now each_page is slightly different, but if you just want to process the
>> whole dataset without keeping all rows in memory, it could be implemented
>> in a more transparent way (yielding rows instead of datasets, transparently
>> handling multiple queries).  Here's the general idea:
>>
>>   class Sequel::Dataset
>>     def each_paged(rows_per_fetch=**1000)
>>       offset = 0
>>       done = false
>>       until done
>>         done = true
>>         limit(rows_per_fetch, offset).each do |row|
>>           done = false
>>           yield row
>>         end
>>         offset += rows_per_fetch
>>       end
>>     end
>>   end
>>
>> I think it may be worth adding such a method to the core of Sequel, since
>> it is database-independent and generally useful.  I'm not sure if
>> each_paged is a good method name for it, though.  If anyone has a
>> suggestion for a better name, please speak up.
>>
>
> I decided to call it paged_each, and just committed it:
> https://github.com/jeremyevans/sequel/commit/5d820c6dbe742bf304963e4034acbe40c17c2f3c
>
> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Charles A. Monteiro
www.monteirosfusion.com
sent from the road

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to