From 83ff56781000923c6dddecf52e2669896411a8d2 Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Tue, 15 Sep 2009 13:19:50 +0000 Subject: update() no longer optimizes data away if a query is given --- it_dbi.class | 8 ++++---- 1 file 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? -- cgit v1.2.3