Class it_dbi:

/**
 * 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)
 * @return number of modified records (or false on error). WARNING: read LIMIT docs before using it
 * Does not destroy internal state of last select() call
 */
function update($tags = array(), $where = null)
{
    $this->_connect();
    $result = 0; # in case we optimize away the query

    /* Pre-processing, $tags is passed by reference and may be modified here */
    $tags = static::_write_preprocess($tags);

    if ($set = $this->_set($tags, isset($where)))
    {
        if (!isset($where))
            $where = array($this->_p['keyfield'] => $this->_data[$this->_p['keyfield']]);

        if ($result = $this->query("UPDATE " . $this->_from($where, true) . " $set " . $this->_where($where)))
        {
            $result = $this->_affectedrows;

            if (array_key_exists($this->_p['keyfield'], $tags))    # Did we just update the key?
                $this->_key = $tags[$this->_p['keyfield']];

            if (isset($this->_key) && $this->read($this->_key))
                $this->_nofetch = false; # So we can do while(iterate()) update();
        }
    }

    $this->_touchedids[$this->_key] = true;

    return $result;
}