diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-01 00:11:22 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-01 00:11:22 +0100 |
commit | 87f4dc27230debc0af281c9780f2ba939fe07608 (patch) | |
tree | 259a4689333e2e43a9b90993454244a448730dad /system/database/DB_driver.php | |
parent | 3b72eb58e61581b7e92012a322be48e216491d7c (diff) |
Fix an update_string() bug
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r-- | system/database/DB_driver.php | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index e8286aaa1..795ed6711 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1080,43 +1080,19 @@ abstract class CI_DB_driver { */ public function update_string($table, $data, $where) { - if ($where === '') + if (empty($where)) { return FALSE; } + $this->where($where); + $fields = array(); foreach ($data as $key => $val) { $fields[$this->protect_identifiers($key)] = $this->escape($val); } - if ( ! is_array($where)) - { - $dest = array($where); - } - else - { - $dest = array(); - foreach ($where as $key => $val) - { - $prefix = (count($dest) === 0) ? '' : ' AND '; - $key = $this->protect_identifiers($key); - - if ($val !== '') - { - if ( ! $this->_has_operator($key)) - { - $key .= ' ='; - } - - $val = ' '.$this->escape($val); - } - - $dest[] = $prefix.$key.$val; - } - } - return $this->_update($this->protect_identifiers($table, TRUE, NULL, FALSE), $fields, $dest); } |