Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 47779
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: AGRUNDMA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08108
Fixed in: 0.08109



Subject: group_by as a scalar ref fails
calling $rs->first on this no longer works. It worked OK in 0.08107. The problem is the group_by => \"SUBSTR(me.namesort, 1, 1)" where the code now expects group_by to always be an array ref. do { my $a = bless({ _result_class => "Slim::Schema::PageBar", _source_handle => bless({ schema => "Slim::Schema", source_moniker => "Contributor" }, "DBIx::Class::ResultSourceHandle"), attrs => { alias => "me", as => ["letter", "count"], group_by => \"SUBSTR(me.namesort, 1, 1)", "join" => ["contributorAlbums"], order_by => "me.namesort", result_class => "Slim::Schema::PageBar", "select" => [\"SUBSTR(me.namesort, 1, 1)", { count => \"DISTINCT(me.id)" }], where => { "contributorAlbums.role" => { in => [1, 5] } }, }, cond => 'fix', count => undef, pager => undef, }, "Slim::Schema::ResultSet::Contributor"); $a->{cond} = $a->{attrs}{where}; $a; } [09-07-10 14:33:03.6742] Slim::Schema::Storage::throw_exception (87) Error: Not an ARRAY reference at /Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/CPAN/DBIx/Class/Storage/DBI.pm line 1429. [09-07-10 14:33:03.6748] Slim::Schema::Storage::throw_exception (87) Backtrace: frame 0: Slim::Utils::Log::logBacktrace (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/Slim/Schema/Storage.pm line 87) frame 1: Slim::Schema::Storage::throw_exception (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/CPAN/DBIx/Class/Storage/DBI.pm line 545) frame 2: DBIx::Class::Storage::DBI::dbh_do (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/CPAN/DBIx/Class/Storage/DBI/Cursor.pm line 101) frame 3: DBIx::Class::Storage::DBI::Cursor::next (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/CPAN/DBIx/Class/ResultSet.pm line 949) frame 4: DBIx::Class::ResultSet::next (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/CPAN/DBIx/Class/ResultSet.pm line 1479) frame 5: DBIx::Class::ResultSet::first (/Users/andy/dev/Slim/7.4/branches/noweb-sqlite/server/Slim/Web/Pages/Common.pm line 386)
On Fri Jul 10 14:56:34 2009, AGRUNDMA wrote: Show quoted text
> calling $rs->first on this no longer works. It worked OK in 0.08107. > > The problem is the group_by => \"SUBSTR(me.namesort, 1, 1)" where the > code now expects group_by to always be an array ref. > > do { > my $a = bless({ > _result_class => "Slim::Schema::PageBar", > _source_handle => bless({ schema => "Slim::Schema", source_moniker > => "Contributor" }, "DBIx::Class::ResultSourceHandle"), > attrs => { > alias => "me", > as => ["letter", "count"], > group_by => \"SUBSTR(me.namesort, 1, 1)", > "join" => ["contributorAlbums"], > order_by => "me.namesort", > result_class => "Slim::Schema::PageBar", > "select" => [\"SUBSTR(me.namesort, 1, 1)", { count => > \"DISTINCT(me.id)" }], > where => { "contributorAlbums.role" => { in => [1, 5] > } }, > }, > cond => 'fix', > count => undef, > pager => undef, > }, "Slim::Schema::ResultSet::Contributor"); > $a->{cond} = $a->{attrs}{where}; > $a; > } > > [09-07-10 14:33:03.6742] Slim::Schema::Storage::throw_exception (87) > Error: Not an ARRAY reference at > /Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/CPAN/DBIx/Class/Storage/DBI.pm > line 1429. > [09-07-10 14:33:03.6748] Slim::Schema::Storage::throw_exception (87) > Backtrace: > > frame 0: Slim::Utils::Log::logBacktrace > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/Slim/Schema/Storage.pm > line 87) > frame 1: Slim::Schema::Storage::throw_exception > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/CPAN/DBIx/Class/Storage/DBI.pm > line 545) > frame 2: DBIx::Class::Storage::DBI::dbh_do > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/CPAN/DBIx/Class/Storage/DBI/Cursor.pm > line 101) > frame 3: DBIx::Class::Storage::DBI::Cursor::next > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/CPAN/DBIx/Class/ResultSet.pm > line 949) > frame 4: DBIx::Class::ResultSet::next > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/CPAN/DBIx/Class/ResultSet.pm > line 1479) > frame 5: DBIx::Class::ResultSet::first > (/Users/andy/dev/Slim/7.4/branches/noweb- > sqlite/server/Slim/Web/Pages/Common.pm > line 386) >
I didn't even know this syntax is supported. Please write me a t/resultset/group_by.t (create a new file), with some crazy group_by usage. Commit it to trunk directly, I'll fix whatever fallout there was (I can think of 3 places off the top of my head, where I assume scalar|array). Cheers