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
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk