Class::DBI::Plugin::CountSearch - get COUNT(*) results from the database with search functionality
use base 'Class::DBI'; use Class::DBI::Plugin::CountSearch; my $count = My::Class->count_search('year' => '1994');
This plugin adds support for COUNT(*) results directly from the database without having to load the records into an iterator or array. It provides 'count_search' and 'count_search_like' which take arguments exactly like Class::DBI::search().
my $count = My::Movies->count_search('year' => '1994');
This method will be exported into the calling class, and allows for retrieving a count of records using the Class::DBI::search() interface. The count is done using COUNT(*).
my $count = My::Movies->count_search_like('title' => 'Jaws%');
This method will be exported into the calling class, and allows for retrieving a count of records using the Class::DBI::search_like() interface. The count is done using COUNT(*).
Todd Holbrook, <tholbroo@sfu.ca>.
Plugin importing and _do_count_search borrowed from Tony Bowden's Class::DBI and Class::DBI::Plugin::RetrieveAll.
Copyright (C) 2004 Todd Holbrook, Simon Fraser University. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Class::DBI::Plugin::CountSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::DBI::Plugin::CountSearch
CPAN shell
perl -MCPAN -e shell install Class::DBI::Plugin::CountSearch
For more information on module installation, please visit the detailed CPAN module installation guide.