Class::DBI::Search::Count - return count of results rather than results


Class-DBI-Search-Count documentation  | view source Contained in the Class-DBI-Search-Count distribution.

Index


NAME

Top

Class::DBI::Search::Count - return count of results rather than results

SYNOPSIS

Top

	use base 'Class::DBI';

	__PACKAGE__->add_searcher(
		search_count => 'Class::DBI::Search::Count'
	);

	my $recent = CD->search_count(year => 2005);

This is equivalent to, but, as the counting is done at the database rather than in perl, faster than:

  my $recent = CD->search(year => 2005)->count;

DESCRIPTION

Top

This is a simple search plugin for Class::DBI to return a count of results rather than the results themselves.

METHODS

Top

add_searcher

	__PACKAGE__->add_searcher(
		method_name => 'Class::DBI::Search::Count'
	);

As with all Search plugins you can choose the method name for the search that it generates.

sql

We override the SQL to be our own COUNT(*) version

We override this to return our count rather than the search results.

AUTHOR

Top

Tony Bowden

BUGS and QUERIES

Top

Please direct all correspondence regarding this module to: bug-Class-DBI-Search-Count@rt.cpan.org

COPYRIGHT AND LICENSE

Top


Class-DBI-Search-Count documentation  | view source Contained in the Class-DBI-Search-Count distribution.