我将 Zend_Db 与 Oracle 适配器一起使用,并且尝试使用子句IN()
中的语句执行查询WHERE
。
该语句不会产生任何错误,也不会执行更新。我尝试了以下形式:
$arrLinesCanceled = array('0000000001', '0000000002');
// attempt 1
$db->query(
"UPDATE my_table SET STATUS = :status WHERE id IN(:lineIds)",
array(
'lineIds' => $arrLinesCanceled,
'status' => 'C',
))->execute();
// attempt 2 (this actually errors out with 'not all parameters are bound')
$db->query(
"UPDATE my_table SET STATUS = :status WHERE id IN(:lineIds)"
)->execute(array(
'lineIds' => $arrLinesCanceled,
'status' => 'C',
));
// attempt 3
$stmtUpdateDetailStatus = $db->prepare(
"UPDATE my_table SET STATUS = :status WHERE id IN(:lineIds)");
$stmtUpdateDetailStatus->execute(array(
'lineIds' => $arrLinesCanceled,
'status' => 'C',
));
// last, very desperate attempt
$db->query("UPDATE my_table SET STATUS = :status WHERE id IN(:lineIds)", array(
':lineIds' => $arrLinesCanceled,
':status' => 'C',
))->execute(array(
':lineIds' => $arrLinesCanceled,
':status' => 'C',
));
为了确保输入正确,这里是实际print_r
的$arrLinesCanceled
Array( [0] => 6617 [1] => 6618)
Oracle 11 或 Zend_Db 适配器不支持吗?我看不出有什么问题...