summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weber2009-09-15 13:19:50 +0000
committerChristian Weber2009-09-15 13:19:50 +0000
commit83ff56781000923c6dddecf52e2669896411a8d2 (patch)
tree5cf893d50679caa75a35622fe1e7d8388b8e735d
parent7104401a0884ec2dc08e2b692d5a8edd28b37029 (diff)
downloaditools-83ff56781000923c6dddecf52e2669896411a8d2.tar.gz
itools-83ff56781000923c6dddecf52e2669896411a8d2.tar.bz2
itools-83ff56781000923c6dddecf52e2669896411a8d2.zip
update() no longer optimizes data away if a query is given
-rw-r--r--it_dbi.class8
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class
index d08f63f..b783e58 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -655,11 +655,11 @@ function update($tags = array(), $query = null)
/* Pre-processing, $tags is passed by reference and may be modified here */
$this->_write_pre_process($tags);
- if (!$query && !empty($this->_p['keyfield']))
- $query = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
-
- if ($set = $this->_set($tags))
+ if ($set = $this->_set($tags, isset($query)))
{
+ if (!isset($query))
+ $query = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
+
if ($result = $this->query("UPDATE {$this->_p['table']} $set " . $this->_where($query, $this->_link)))
{
if (array_key_exists($this->_p['keyfield'], $tags)) # Did we just update the key?