[Israel.pm] Next/Previous item from database

Yuval Yaari yuval at windax.com
Fri May 28 09:52:19 PDT 2004


Gabor Szabo said:
> On Wed, 26 May 2004, Yuval Yaari wrote:
>
>> I use Class::DBI::Iterator for these things...
>> You could also add_constructor or set_sql for it...
>>
>> Class::DBI is the right choice, anyway :)
>>
>
> Thanks for all the responses.
>
> Just to let you know I went with a simple
> "fetch the list every time and go over it" solution though probably
> later I'll replace it with the iterator.

The iterator is even more simple (AFAIK it should be simpler but it
doesn't sound good :)).

my $It = NameSpace::Words->retrieve_all;
$It->slice($start, $end);

Keeping $start and $end and passing it on from (and esp. to) a template is
easy. Very easy.

I'm not sure this fits your needs, your original e-mail is at work and I'm
using my webmail right now.

It's pretty fast for me, though my table has around 20,000 rows, and I
extract 20 rows at a time.
I sometimes also extract around 100 at a time.
But it should be Fast Enough (TM) anyway - if you needed extreme
performance you would have chosen DBI and not Class::DBI :)


  --Yuval





More information about the Perl mailing list