正确代码:修改两处1949行和1955行
protected function _update_batch($table, $values, $index)
{
$index_escaped = $this->protect_identifiers($index);
$ids = array();
foreach ($values as $key => $val)
{
$ids[] = $val[$index_escaped];
foreach (array_keys($val) as $field)
{
if ($field !== $index)
{
$final[$field][] = 'WHEN '.$index_escaped.' = '.$val[$index_escaped].' THEN '.$val[$field];
}
}
}
$cases = '';
foreach ($final as $k => $v)
{
$cases .= $k." = CASE \n"
.implode("\n", $v)."\n"
.'ELSE '.$k.' END, ';
}
$this->where($index_escaped.' IN('.implode(',', $ids).')', NULL, FALSE);
return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
}