From: Justin Hunter Date: Mon, 16 Mar 2009 15:48:28 +0000 (+0000) Subject: don't remove the where clause unless we're doing distinct, it needs to be there X-Git-Tag: v0.08103~101^2~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8178ea5b9a1433ddba61be1e73f1f6d821486b39;p=dbsrgits%2FDBIx-Class.git don't remove the where clause unless we're doing distinct, it needs to be there --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 25d91e9..bde72fe 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1163,13 +1163,14 @@ sub _count { # Separated out so pager can get the full count $attrs->{select} = $group_by; $attrs->{from} = [ { 'mesub' => (ref $self)->new($self->result_source, $attrs)->cursor->as_query } ]; + delete $attrs->{where}; } $attrs->{select} = { count => '*' }; $attrs->{as} = [qw/count/]; # offset, order by, group by, where and page are not needed to count. record_filter is cdbi - delete $attrs->{$_} for qw/rows offset order_by group_by where page pager record_filter/; + delete $attrs->{$_} for qw/rows offset order_by group_by page pager record_filter/; my $tmp_rs = (ref $self)->new($self->result_source, $attrs); my ($count) = $tmp_rs->cursor->next;