my $attrs = { %{ $self->_resolved_attrs } };
+ return $self->count_rs->first unless $attrs->{software_limit};
+
# this is a little optimization - it is faster to do the limit
# adjustments in software, instead of a subquery
my ($rows, $offset) = delete @{$attrs}{qw/rows offset/};
is ($rs->all, 2, 'Correct number of objects');
$schema->is_executed_sql_bind( sub {
- is ($rs->count, 2, 'Correct count via count()');
+ is ($rs->count({}, { software_limit => 1 }), 2, 'Correct count via count()');
}, [[
'SELECT COUNT( * )
FROM cd me
is ($rs->all, 1, 'Correct number of objects');
$schema->is_executed_sql_bind( sub {
- is ($rs->count, 1, 'Correct count via count()');
+ is ($rs->count({}, { software_limit => 1 }), 1, 'Correct count via count()');
}, [ [
'SELECT COUNT( * )
FROM (
my $rs = $books_45_and_owners->search ({}, {order_by => $ord_set->{order_by}});
- # query actually works
- ok( defined $rs->count, 'Query actually works' );
-
is_same_sql_bind(
$rs->as_query,
"(SELECT me.id, me.source, me.owner, me.price, owner__id, owner__name