Christopher H. Laco wrote:
> Aside form that, my failing tests come down to this hack:
> 
>>         $options->{'distinct'} = 1;
>>         if (defined $options->{'join'}) {
>>             if (!ref $options->{'join'} || ref $options->{'join'} eq 'HASH') 
>> {
>>                 $options->{'join'} = [$options->{'join'}];
>>             };
>>         } else {
>>             $options->{'join'} = [];
>>         };
>>         push @{$options->{'join'}}, {'map_user_role' => 'user'};
> 
> 
> The hashes in an array trick used to work:    join =>  [ {}, {} ]
> Now it doesn't...this fixes my issue:         join =>  {}
> 
> But causes havoc if the user has already supplied a value for join...
> 
> Is this a don't do that, or an it still still work-ism?
> 
> -=Chris
> 
> 

OK. Breath in. Breath out. One of these queries is not like the other..
The first query returns 2 results...and it used to return 1 days ago:
The second query returns 1 result....

> my @roles = $schema->resultset('Roles')->search({
>     'user.id' => 2
> }, {
>     distinct => 1,
>     join => {'map_user_role' => 'user'}
> })->all;
> SELECT me.id, me.name, me.description, me.created, me.updated FROM role me 
> LEFT JOIN user_role map_user_role ON ( map_us
> er_role.role_id = me.id )  JOIN user user ON ( user.id = 
> map_user_role.user_id ) WHERE ( user.id = ? ) GROUP BY me.id, m
> e.name, me.description, me.created, me.updated: '2'


> my @roles = $schema->resultset('Roles')->search({
>     'user_id' => 2
> }, {
>     distinct => 1,
>     join => {'map_user_role' => 'user'}
> })->all;
> SELECT me.id, me.name, me.description, me.created, me.updated FROM role me 
> LEFT JOIN user_role map_user_role ON ( map_us
> er_role.role_id = me.id )  JOIN user user ON ( user.id = 
> map_user_role.user_id ) WHERE ( user_id = ? ) GROUP BY me.id, m
> e.name, me.description, me.created, me.updated: '2'

No prefetches anywhere...yes something is not right...
If I roll back to current from a few days ago... they both return just 1
result...

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to