[Dbix-class] @bind confusion

Peter Rabbitson rabbit+dbic at rabbit.us
Tue Aug 3 11:20:24 GMT 2010


Wolfgang Kinkeldei wrote:
> Hello,
> 
> when using subqueries in the 'from' part of a query, sometimes the list of @bind parameters is not maintained correct. As a simple testcase please find a primitive subselect enclosed that just does a count with a correlated subquery.
> 
> <snip>
> # a simple counting subquery
> my $subquery = 
>     $schema->resultset('PersonRole')
>         ->search( { role_id => 'admin' } ) # 1st bind param
>         ->count_rs
>         ->as_query;
> 
> my @people = 
>     $schema->resultset('Person')
>         ->search(
>             {
>                 'me.person_id' => 42, # 2nd bind param
>             },
>             {
>                 select => [ $subquery ],
>                 # whatever you join here, @bind gets confused
>                 join => 'person_regions'
>             })
>         ->all;
> <snap>
> 


All I can say at this point is that the problem lies somewhere in the way
count_rs processes arguments. However I need to see a *real* world search()
query to wrap my head around which use-case did I miss when I designed the
feature. Please provide me with a complete meaningful search()/DBIC_TRACE
pair, no matter how complex as long as it is complete.

Cheers



More information about the DBIx-Class mailing list