Class it_dbi:

/**
 * Insert a record into table. Values are taken assoc array $tags. Keys in $tags
 * should contain row names unless "dyncols" exists in schema (they are stored as
 * dynamic columns then). Keys with - prefix suppress quoting of values.
 * After inserting, all values are valid (record is read back).
 * Does not destroy internal state of last select() call
 * @param $tags key => value pairs to set
 * @return true for success, false for failure (e.g. duplicate entry for key)
 */
function insert($tags = array(), $command = "INSERT")
{
    $this->_connect();

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

    if ($this->_p['randomid'] && !isset($tags[$this->_p['keyfield']]))
        $tags[$this->_p['keyfield']] = bin2hex(random_bytes(16));

    $values = $this->_values($tags, "insert");

    if ($result = $this->query($query = "$command INTO {$this->_p['table']} " . $values))
    {
        $id = ($this->_p['autoincrement'] && !isset($tags[$this->_p['keyfield']])) ? $this->_insertid : $tags[$this->_p['keyfield']];
        if ($this->_p['keyfield'] && !$this->read($id) && $this->_p['safety'])
            $this->_fatal("insert(): can't read record back (key truncated?), id=\"$id\"", $query);

        $this->_touchedids[$this->_key] = true;
    }
    else
        $this->clear();

    return $result;
}