diff options
author | Andrey Andreev <narf@devilix.net> | 2016-12-12 13:17:52 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-12-12 13:17:52 +0100 |
commit | 8338bbb3586e31432caa503b6530dcea583dd8d8 (patch) | |
tree | bbdbeb24c710f56be97db10e6f914383629ef82e /system/database/drivers/postgre/postgre_driver.php | |
parent | f2a613d67c23ba253f35a73d208e0dcaf6080b40 (diff) |
Fix #4892 - update_batch()
Regression caused by 0c23e9122666a30797079bea9415da135d4f7e12 trying to fix #4871
Supersedes #4929
Diffstat (limited to 'system/database/drivers/postgre/postgre_driver.php')
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php index dfd87f95a..51916fcc1 100644 --- a/system/database/drivers/postgre/postgre_driver.php +++ b/system/database/drivers/postgre/postgre_driver.php @@ -550,13 +550,13 @@ class CI_DB_postgre_driver extends CI_DB { $ids = array(); foreach ($values as $key => $val) { - $ids[] = $val[$index]; + $ids[] = $val[$index]['value']; foreach (array_keys($val) as $field) { if ($field !== $index) { - $final[$field][] = 'WHEN '.$val[$index].' THEN '.$val[$field]; + $final[$val[$field]['field']][] = 'WHEN '.$val[$index]['value'].' THEN '.$val[$field]['value']; } } } @@ -564,12 +564,12 @@ class CI_DB_postgre_driver extends CI_DB { $cases = ''; foreach ($final as $k => $v) { - $cases .= $k.' = (CASE '.$index."\n" + $cases .= $k.' = (CASE '.$val[$index]['field']."\n" .implode("\n", $v)."\n" .'ELSE '.$k.' END), '; } - $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE); + $this->where($val[$index]['field'].' IN('.implode(',', $ids).')', NULL, FALSE); return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where'); } |