The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Class::DBI::Plugin::CountSearch - get COUNT(*) results from the database with search functionality

SYNOPSIS

        use base 'Class::DBI';
        use Class::DBI::Plugin::CountSearch;
        
        my $count = My::Class->count_search('year' => '1994');
        

DESCRIPTION

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().

METHODS

        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(*).

count_search_like

        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(*).

AUTHOR

Todd Holbrook, <tholbroo@sfu.ca>.

Plugin importing and _do_count_search borrowed from Tony Bowden's Class::DBI and Class::DBI::Plugin::RetrieveAll.

COPYRIGHT

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.