[Bast-commits] r6339 - DBIx-Class/0.08/trunk/lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue May 19 18:46:41 GMT 2009
Author: ribasushi
Date: 2009-05-19 18:46:40 +0000 (Tue, 19 May 2009)
New Revision: 6339
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
Log:
Simplify __count() - explicitly specify which attributes to copy, instead of deleting a whole bunch of them
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-05-19 17:52:39 UTC (rev 6338)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-05-19 18:46:40 UTC (rev 6339)
@@ -1150,7 +1150,7 @@
=cut
-my @count_via_subq_attrs = qw/join seen_join prefetch group_by/;
+my @count_via_subq_attrs = qw/join seen_join prefetch group_by having/;
sub count {
my $self = shift;
return $self->search(@_)->count if @_ and defined $_[0];
@@ -1212,9 +1212,8 @@
$attrs ||= { %{$self->{attrs}} };
- # take off any subquery attrs (they'd be incorporated in the subquery),
- # any column specs, any pagers, record_filter is cdbi, and no point of ordering a count
- delete $attrs->{$_} for (@count_via_subq_attrs, qw/columns +columns select +select as +as rows offset page pager order_by record_filter/);
+ # these are the only attributes that actually matter for count
+ $attrs = { map { exists $attrs->{$_} ? ( $_ => $attrs->{$_} ) : () } qw/where bind alias from from_bind/ };
$attrs->{select} = { count => '*' };
$attrs->{as} = [qw/count/];
More information about the Bast-commits
mailing list