Todd Holbrook > Class-DBI-Plugin-CountSearch-1.02 > Class::DBI::Plugin::CountSearch

Download:
Class-DBI-Plugin-CountSearch-1.02.tgz

Dependencies

Annotate this POD

Related Modules

Class::DBI
more...
By perlmonks.org

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.02   Source  

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 ^

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

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.

syntax highlighting: