[Bast-commits] r6358 - in DBIx-Class/0.08/trunk: lib/DBIx/Class
t/count
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu May 21 07:59:51 GMT 2009
Author: ribasushi
Date: 2009-05-21 07:59:50 +0000 (Thu, 21 May 2009)
New Revision: 6358
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/trunk/t/count/prefetch.t
Log:
Duh, no point of having ordered subqueries while counting, Debolaz++
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-05-21 07:45:52 UTC (rev 6357)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-05-21 07:59:50 UTC (rev 6358)
@@ -1162,8 +1162,8 @@
# copy for the subquery, we need to do some adjustments to it too
my $sub_attrs = { %$attrs };
- # these can not go in the subquery either
- delete $sub_attrs->{$_} for qw/prefetch collapse select +select as +as columns +columns/;
+ # these can not go in the subquery, and there is no point of ordering it
+ delete $sub_attrs->{$_} for qw/prefetch collapse select +select as +as columns +columns order_by/;
# force a group_by and the same set of columns (most databases require this)
$sub_attrs->{columns} = $sub_attrs->{group_by} ||= [ map { "$attrs->{alias}.$_" } ($self->result_source->primary_columns) ];
Modified: DBIx-Class/0.08/trunk/t/count/prefetch.t
===================================================================
--- DBIx-Class/0.08/trunk/t/count/prefetch.t 2009-05-21 07:45:52 UTC (rev 6357)
+++ DBIx-Class/0.08/trunk/t/count/prefetch.t 2009-05-21 07:59:50 UTC (rev 6358)
@@ -32,7 +32,7 @@
is_same_sql_bind (
$sql,
\@bind,
- 'SELECT COUNT( * ) FROM (SELECT cds.cdid FROM artist me LEFT JOIN cd cds ON cds.artist = me.artistid LEFT JOIN track tracks ON tracks.cd = cds.cdid JOIN artist artist ON artist.artistid = cds.artist WHERE tracks.position = ? OR tracks.position = ? GROUP BY cds.cdid ORDER BY tracks.cd) count_subq',
+ 'SELECT COUNT( * ) FROM (SELECT cds.cdid FROM artist me LEFT JOIN cd cds ON cds.artist = me.artistid LEFT JOIN track tracks ON tracks.cd = cds.cdid JOIN artist artist ON artist.artistid = cds.artist WHERE tracks.position = ? OR tracks.position = ? GROUP BY cds.cdid) count_subq',
[ qw/'1' '2'/ ],
);
}
More information about the Bast-commits
mailing list