From 12acce6c57651bbd7144da0990ca7acbc382afa5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 20 Apr 2009 18:20:27 +0000 Subject: [PATCH] use the rowsPerPage option to getMatchingAssets as a limit clause when usePaginator is not used. --- lib/WebGUI/Keyword.pm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/WebGUI/Keyword.pm b/lib/WebGUI/Keyword.pm index ff39cb20d..d96597a13 100644 --- a/lib/WebGUI/Keyword.pm +++ b/lib/WebGUI/Keyword.pm @@ -277,11 +277,7 @@ Instead of returning an array reference of assetId's, return a paginator object. =head3 rowsPerPage If usePaginator is passed, then this variable will set the number of rows per page that the paginator uses. - -=head3 limit - -Limit the number of assetIds that are returned. This should not be used in conjunction -with usePaginator. +If usePaginator is not passed, then this variable will limit the number of assetIds that are returned. =cut @@ -333,15 +329,15 @@ sub getMatchingAssets { my $query = 'select distinct assetKeyword.assetId from assetKeyword left join asset using (assetId) where '.join(' and ', @clauses).' order by creationDate desc, lineage'; - if ($options->{limit}) { - $query .= ' limit '. $options->{limit}; - } # perform the search if ($options->{usePaginator}) { my $p = WebGUI::Paginator->new($self->session, undef, $options->{rowsPerPage}); $p->setDataByQuery($query, undef, undef, \@params); return $p; } + elsif ($options->{rowsPerPage}) { + $query .= ' limit '. $options->{rowsPerPage}; + } return $self->session->db->buildArrayRef($query, \@params); }