[Dbix-class] extended paging

Rodrigo rodrigolive at gmail.com
Mon Nov 30 12:28:43 GMT 2009


Hi all,
How can I make paging work when results are filtered on a non-sql condition?

For instance, I'm paging the results of the CD table but the filtered column
"title" is being localized after the data is retrieved.

my $rs =3D $c->model('DB::CD')->search(undef, { page=3D>1, rows=3D>20 });
while( my $row =3D $rs->next ) {
    next unless $c->localize( $row->title ) =3D~ /$title_filter/;
    push @json, { $row->get_columns };
}

Unfortunately I can't use a translation/localization table, which would make
things simpler.

Reading the whole CD table then filtering while looping is another option,
but it's very costly in terms of performance.

I know this may not be a DBIx::Class specific question, but I can't find
anything on this subject and I'm quite sure most of you have gone through
this problem at least once. Maybe there's a module there that can help me
out with this, such as a Data::Page derivative.

cheers,
   rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091130/c0f=
70cd8/attachment.htm


More information about the DBIx-Class mailing list