Class::DBI::Search::LIMITed - add 'LIMIT' to Class::DBI searches
use base 'Class::DBI'; __PACKAGE__->add_searcher( limited_search => 'Class::DBI::Search::LIMITed' ); my @by_date = My::Class->limited_search( ... , { order_by => 'name', limit => 10, }); # or, if you want it to be the default search __PACKAGE__->add_searcher( search => 'Class::DBI::Search::LIMITed' ); my @by_date = My::Class->search( ... , { order_by => 'name', limit => '20, 10', });
This is a simple search plugin to a Class::DBI subclass which allows for the addition of a LIMIT option to a SELECT query.
__PACKAGE__->add_searcher( method_name => 'Class::DBI::Search::LIMITed' );
As with all Search plugins you can choose the method name for the search that it generates. You can either make a distinct limit-ed search method (e.g. search_limited()), or just make it your default search() method.
This overrides the default 'fragment' method in Class::DBI::Search::Basic to add any 'limit' option passed in your search query.
This is only useful for databases which support a LIMIT modifier, such as MySQL.
Tony Bowden
Please direct all correspondence regarding this module to: bug-Class-DBI-Search-LIMITed@rt.cpan.org
Copyright (C) 2005 Tony Bowden. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Class::DBI::Search::LIMITed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::DBI::Search::LIMITed
CPAN shell
perl -MCPAN -e shell install Class::DBI::Search::LIMITed
For more information on module installation, please visit the detailed CPAN module installation guide.