NAME

Class::ReluctantORM::Monitor::RowCount - Count rows returned

SYNOPSIS

use aliased 'Class::ReluctantORM::Monitor::RowCount';
my $mon = RowCount->new(highwater_count => N, fatal_threshold => X);
Class::ReluctantORM->install_global_monitor($mon);
Pirate->install_class_monitor($mon);

# Do a query....
Pirate->fetch(...);

# Read from the monitor
my $row_count = $mon->last_measured_value();

# Reset counter to 0 if desired - the counter gets reset at 
# the beginning of every query anyway, but you might have need
# to reset it in a fetchrow callback
$mon->reset();

DESCRIPTION

Tracks the number of rows returned by a query, The counter is reset at the beginning of execution of a query, and it is incremented as each row is fetched.

Note that number of rows does not match the number of objects returned by a fetch. Joins can make the row count significantly higher by many factors.

This is a Measuring Monitor.