[Bast-commits] r8316 - in DBIx-Class/0.08/trunk: .
lib/DBIx/Class/Storage/DBI t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Fri Jan 15 00:32:00 GMT 2010
Author: ribasushi
Date: 2010-01-15 00:31:58 +0000 (Fri, 15 Jan 2010)
New Revision: 8316
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm
DBIx-Class/0.08/trunk/t/71mysql.t
Log:
Strict mysql bugfix
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2010-01-15 00:25:39 UTC (rev 8315)
+++ DBIx-Class/0.08/trunk/Changes 2010-01-15 00:31:58 UTC (rev 8316)
@@ -15,6 +15,8 @@
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
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm 2010-01-15 00:25:39 UTC (rev 8315)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/AmbiguousGlob.pm 2010-01-15 00:31:58 UTC (rev 8316)
@@ -27,6 +27,9 @@
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 ];
}
Modified: DBIx-Class/0.08/trunk/t/71mysql.t
===================================================================
--- DBIx-Class/0.08/trunk/t/71mysql.t 2010-01-15 00:25:39 UTC (rev 8315)
+++ DBIx-Class/0.08/trunk/t/71mysql.t 2010-01-15 00:31:58 UTC (rev 8316)
@@ -225,6 +225,23 @@
=> '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,
More information about the Bast-commits
mailing list