summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_dbi.class')
-rw-r--r--it_dbi.class15
1 files changed, 8 insertions, 7 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 3ca2fc1..0457142 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -648,11 +648,12 @@ function replace($tags = array())
/**
- * Update a record in a table
- * @param $tags Additional key => value pairs (these have priority over member vars)
+ * Update current record or a number of records given by where condition
+ * @param $tags key => value pairs (these have priority over changes in member vars)
+ * @param $where condition to select records to be modified (if not current record)
* Does not destroy internal state of last select() call
*/
-function update($tags = array(), $query = null)
+function update($tags = array(), $where = null)
{
$this->_connect();
$result = true;
@@ -660,12 +661,12 @@ function update($tags = array(), $query = null)
/* Pre-processing, $tags is passed by reference and may be modified here */
$this->_write_pre_process($tags);
- if ($set = $this->_set($tags, isset($query)))
+ if ($set = $this->_set($tags, isset($where)))
{
- if (!isset($query))
- $query = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
+ if (!isset($where))
+ $where = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);
- if ($result = $this->query("UPDATE {$this->_p['table']} $set " . $this->_where($query, $this->_link)))
+ if ($result = $this->query("UPDATE {$this->_p['table']} $set " . $this->_where($where, $this->_link)))
{
if (array_key_exists($this->_p['keyfield'], $tags)) # Did we just update the key?
$this->_key = $tags[$this->_p['keyfield']];