[edit] Solved by using CDbCriteria::addInCondition()
Hi folks. I’m trying to update a set of records identified by an IN(…) condition, and the query fails intermittently, once every several runs. The table contains binary sha1 values in a TINYBLOB field, and the sha1 values (processed by $db->quoteValue) are in a csv string in the $condition parameter. I’d be happy to do this another way if I’m approaching it bass-ackwards.
I prototyped this with a call to findAll(), but will need to use updateAll eventually, or similar. There is no updateAllByAttributes() which is why I didn’t start off using findAllByAttributes().
foreach( $sha1Array as $sha1Bin ) {
$sha1CSV .= "'$sha1Bin',";
}
$sha1CSV = rtrim( $sha1CSV, ',' );
$records = Handle::model()->findAll( "Handle.handle IN($sha1CSV)" );
When it fails, this exception is thrown:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
Please to apply clue-by-four?