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 = $c->model('DB::CD')->search(undef, { page=>1, rows=>20 });
while( my $row = $rs->next ) {
    next unless $c->localize( $row->title ) =~ /$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
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to