summaryrefslogtreecommitdiff
path: root/it_dbi.class
diff options
context:
space:
mode:
authorUrban Müller2010-10-28 17:31:51 +0000
committerUrban Müller2010-10-28 17:31:51 +0000
commit82d2d98a11234ee24dafc01e1565cdf1c4584cd7 (patch)
tree10f3e0b9df714347fa2ccb2f04c9ef86b9aef520 /it_dbi.class
parent3835b993ce2f720c59e7067861f924d2705ec1e1 (diff)
downloaditools-82d2d98a11234ee24dafc01e1565cdf1c4584cd7.tar.gz
itools-82d2d98a11234ee24dafc01e1565cdf1c4584cd7.tar.bz2
itools-82d2d98a11234ee24dafc01e1565cdf1c4584cd7.zip
better documentation
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']];