[Dbix-class] @bind confusion

Wolfgang Kinkeldei wolfgang at kinkeldei.de
Tue Aug 3 11:14:14 GMT 2010


Hi,

Am 03.08.2010 um 12:11 schrieb Peter Rabbitson:

> Wolfgang Kinkeldei wrote:
>> ...
>> however, if the join is present:
>> DBIx::Class::ResultSet::all(): Cannot bind unknown placeholder 3 (3) at /Library/Perl/5.10.0/DBIx/Class/Storage/DBI.pm line 1475.
> 
> Please provide the DBIC_TRACE=1 of what SQL is generated right before you see
> this error.

The result is:

SELECT (SELECT COUNT( * ) FROM person_role me WHERE ( role_id = ? )) FROM person me LEFT JOIN person_region person_regions ON person_regions.person_id = me.person_id WHERE ( me.person_id = ? ): 'admin', 'admin', '42'

and the error-message reads:

Cannot bind unknown placeholder 3 (3) at /Library/Perl/5.10.0/DBIx/Class/Storage/DBI.pm line 1475.



However, if I omit a join in the main query, the sql is correctly generated like this:

SELECT (SELECT COUNT( * ) FROM person_role me WHERE ( role_id = ? )) FROM person me WHERE ( me.person_id = ? ): 'admin', '42'



Again, the query is absolutely stupid but simple enough to trigger the wrong behavior.



Best,

Wolfgang Kinkeldei

-- 

' /\_/\ ' .print[split??,"".(($/=q|Cms)+-03467:;<=|)=~tr!C-z -B! -z!)x
'( o.o )' .$/]->[hex]foreach split qr<>,qq+1ecd039ad65b025b8063475b+||
' > ^ < ' .q<!-- Wolfgang Kinkeldei - mailto:wolfgang at kinkeldei.de -->





More information about the DBIx-Class mailing list