[Bast-commits] r7300 - in DBIx-Class/0.08/trunk: lib/DBIx/Class
t/prefetch
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Aug 11 12:16:30 GMT 2009
Author: ribasushi
Date: 2009-08-11 12:16:28 +0000 (Tue, 11 Aug 2009)
New Revision: 7300
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/trunk/t/prefetch/grouped.t
Log:
Sanify group_by handling in complex prefetch rewrites
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-08-11 11:20:37 UTC (rev 7299)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-08-11 12:16:28 UTC (rev 7300)
@@ -1266,8 +1266,8 @@
# extra selectors do not go in the subquery and there is no point of ordering it
delete $sub_attrs->{$_} for qw/collapse select _prefetch_select as order_by/;
- # if we prefetch, we group_by primary keys only as this is what we would get out of the rs via ->next/->all
- # clobber old group_by regardless
+ # if we prefetch, we group_by primary keys only as this is what we would get out
+ # of the rs via ->next/->all. We DO WANT to clobber old group_by regardless
if ( keys %{$attrs->{collapse}} ) {
$sub_attrs->{group_by} = [ map { "$attrs->{alias}.$_" } ($rsrc->primary_columns) ]
}
@@ -1509,7 +1509,8 @@
if (my $g = $attrs->{group_by}) {
my @current_group_by = map
{ $_ =~ /\./ ? $_ : "$attrs->{alias}.$_" }
- (ref $g eq 'ARRAY' ? @$g : $g );
+ @$g
+ ;
if (
join ("\x00", sort @current_group_by)
@@ -2871,7 +2872,7 @@
);
}
- if ($attrs->{group_by} and ! ref $attrs->{group_by}) {
+ if ($attrs->{group_by} and ref $attrs->{group_by} ne 'ARRAY') {
$attrs->{group_by} = [ $attrs->{group_by} ];
}
Modified: DBIx-Class/0.08/trunk/t/prefetch/grouped.t
===================================================================
--- DBIx-Class/0.08/trunk/t/prefetch/grouped.t 2009-08-11 11:20:37 UTC (rev 7299)
+++ DBIx-Class/0.08/trunk/t/prefetch/grouped.t 2009-08-11 12:16:28 UTC (rev 7300)
@@ -258,7 +258,7 @@
'(
SELECT COUNT( * )
FROM (
- SELECT me.cd
+ SELECT SUBSTR(me.cd, 1, 1)
FROM track me
JOIN cd cd ON cd.cdid = me.cd
WHERE ( me.cd IN ( ?, ?, ?, ?, ? ) )
More information about the Bast-commits
mailing list