search_related from prefetching resultsets
- Fix regression on all-null returning searches (properly switch
LEFT JOIN to JOIN in order to distinguish between both cases)
+ - Fix regression in groupedresultset count() used on strict-mode
+ MySQL connections
- Better isolation of RNO-limited queries from the rest of a
prefetching resultset
- New MSSQL specific resultset attribute to allow hacky ordered
sub _subq_count_select {
my ($self, $source, $rs_attrs) = @_;
+
+ return $rs_attrs->{group_by} if $rs_attrs->{group_by};
+
my @pcols = map { join '.', $rs_attrs->{alias}, $_ } ($source->primary_columns);
return @pcols ? \@pcols : [ 1 ];
}
=> 'Nothing Found!';
}
+# check for proper grouped counts
+{
+ my $ansi_schema = DBICTest::Schema->connect ($dsn, $user, $pass, { on_connect_call => 'set_strict_mode' });
+ my $rs = $ansi_schema->resultset('CD');
+
+ my $years;
+ $years->{$_->year|| scalar keys %$years}++ for $rs->all; # NULL != NULL, thus the keys eval
+
+ lives_ok ( sub {
+ is (
+ $rs->search ({}, { group_by => 'year'})->count,
+ scalar keys %$years,
+ 'grouped count correct',
+ );
+ }, 'Grouped count does not throw');
+}
+
ZEROINSEARCH: {
my $cds_per_year = {
2001 => 2,