summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-01 00:11:22 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-01 00:11:22 +0100
commit87f4dc27230debc0af281c9780f2ba939fe07608 (patch)
tree259a4689333e2e43a9b90993454244a448730dad
parent3b72eb58e61581b7e92012a322be48e216491d7c (diff)
Fix an update_string() bug
-rw-r--r--system/database/DB_driver.php30
-rw-r--r--system/database/DB_query_builder.php2
2 files changed, 4 insertions, 28 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);
}
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index a3585586e..cc43d834c 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1575,7 +1575,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
$sql = $this->_update($this->protect_identifiers($this->qb_from[0], TRUE, NULL, FALSE), $this->qb_set);
-
+var_dump($sql);
$this->_reset_write();
return $this->query($sql);
}