Insert a new record into the database.

@param  array $values

@return bool
353664
public function insert(array $values)
    {
        $result = parent::insert($values);

        $this->handler->setBuilder($this)
            ->invalidateQuery(Reflector::QUERY_TYPE_INSERT, $values);

        return $result;
    }
987654
public function insert(array $values, array $update=[], array $constraint=[]) {
		$sql = $this->buildInsertSQL([$values], $update, $constraint);
		$params = $this->getParameters();
		$this->db->query($sql, $params);
		return $this;
	}
433374
protected function insertInternal(array $fields = [])
    {
        $dirty = $this->getDirtyAttributes();

        $values = $this->getChangedAttributes($fields);
        if (empty($values)) {
            return true;
        }

        $connection = static::getConnection();
        $qb = $this->getQueryBuilder();

        $tableName = $qb->getQuotedName(TableNameResolver::getTableName($this->tableName()));
        $sql = $qb
            ->insert()
            ->table($tableName)
            ->values($values)
            ->toSQL();
        $inserted = $connection->executeUpdate($sql);
        if (false === $inserted) {
            return false;
        }

        foreach (self::getMeta()->getPrimaryKeyName(true) as $primaryKeyName) {
            if (
                empty($this->getAttribute($this->getSequenceName())) ||
                false === in_array($primaryKeyName, $dirty)
            ) {
                $values[$primaryKeyName] = $connection->lastInsertId($this->getSequenceName());
            }
        }

        $this->setAttributes($values);

        return true;
    }
1026864
public static function upsert(array $values, array $updateColumns = null)
    {

        if (empty($values))
            return true;

        if (! is_array(reset($values))) {

            $values = [$values];

        } else {

            foreach ($values as $key => $value) {

                ksort($value);
                $values[$key] = $value;
            }
        }

        $model = self::getModel();

        $sql = static::compileUpsert(
            $model->getConnection()->getQueryGrammar(), $values, $updateColumns);

        $values = static::inLineArray($values);

        return $model->getConnection()->affectingStatement($sql, $values);
    }
1054060
public function insert($table, $values)
    {
        $keys = array();
        $params = array();
        $placeholders = array();
        foreach ($values as $k => $v) {
            $keys[] = $this->db->quoteColumn($k);
            $params[':' . $k] = $v;
            $placeholders[] = ':' . $k;
        }
        $sql = "INSERT INTO " . $this->db->quoteTable($table) . ' (' . implode(', ', $keys) . ') VALUES (' . implode(',', $placeholders) . ')';
        $result = $this->setSql($sql)->execute($params);
        if (!$result) {
            return false;
        }

        return $this->db->lastInsertId();
    }
579896
public static function createFromValues(array $values)
    {
        if (\array_key_exists('keys', $values) && \is_array($values['keys'])) {
            return JWKSet::createFromKeyData($values);
        }

        return JWK::create($values);
    }
763102
public function add(...$values)
    {
        foreach ($values as $value) {
            $this->table->put($value, null);
        }
    }
571054
public function prepareInsert($table, array $values) {

        // Initialize the query.
        $query = [];

        $query[] = "INSERT INTO ";
        $query[] = $table;
        $query[] = " (`";
        $query[] = implode("`, `", array_keys($values));
        $query[] = "`) VALUES (";
        $query[] = implode(", ", array_values($values));
        $query[] = ")";

        // Return the query.
        return implode("", $query);
    }
26573
public function insertGetId(array $values, $sequence = null)
    {
        $result = parent::insertGetId($values, $sequence);

        $this->handler->setBuilder($this)
            ->invalidateQuery(Reflector::QUERY_TYPE_INSERT, $values);

        return $result;
    }
251650
public function add($values)
    {
        if (! is_array($values) && ! $values instanceof BaseCollection) {
            $values = func_get_args();
        }

        // Once we have made sure our input is an array of values, we will convert
        // them into value model objects (if no model instances are given). When
        // done we will just push all values into the current collection items.
        foreach ($values as $value) {
            $this->push($this->buildValue($value));
        }

        return $this;
    }
347801
public static function create($values = [], $save = false)
    {
        $className = get_called_class();

        // create class
        $ActiveRecord = new $className();
        $ActiveRecord->setFields($values);

        if ($save) {
            $ActiveRecord->save();
        }

        return $ActiveRecord;
    }
1094298
public function inserts(array $values): int
    {
        $params = [$this->name];
        foreach ($values as $name=>$pos) {
            $params[] = $pos[0];
            $params[] = $pos[1];
            $params[] = $name;
        }
        return intval($this->handle->rawCommand('geoadd', $params));
    }
433132
public function insertRow(array $values)
    {
        // @todo remove after testing
        if (
            !isset($values['text']) ||
            !isset($values['text_md5']) ||
            !isset($values['action']) ||
            !isset($values['parent']) ||
            !isset($values['lang_mask'])) {
            throw new \Exception('value set is incomplete: ' . var_export($values, true) . ", can't execute insert");
        }
        if (!isset($values['id'])) {
            $values['id'] = $this->getNextId();
        }
        if (!isset($values['link'])) {
            $values['link'] = $values['id'];
        }
        if (!isset($values['is_original'])) {
            $values['is_original'] = ($values['id'] == $values['link'] ? 1 : 0);
        }
        if (!isset($values['is_alias'])) {
            $values['is_alias'] = 0;
        }
        if (!isset($values['alias_redirects'])) {
            $values['alias_redirects'] = 0;
        }
        if (!isset($values['action_type'])) {
            if (preg_match('#^(.+):.*#', $values['action'], $matches)) {
                $values['action_type'] = $matches[1];
            }
        }
        if ($values['is_alias']) {
            $values['is_original'] = 1;
        }
        if ($values['action'] === 'nop:') {
            $values['is_original'] = 0;
        }

        /** @var $query \eZ\Publish\Core\Persistence\Database\InsertQuery */
        $query = $this->dbHandler->createInsertQuery();
        $query->insertInto($this->dbHandler->quoteTable($this->table));
        $this->setQueryValues($query, $values);
        $query->prepare()->execute();

        return $values['id'];
    }
661985
protected function addUpdatedAtColumn(array $values)
    {
        if (!$this->model->usesTimestamps()) {
            return $values;
        }

        return Arr::add(
            $values,
            $this->model->getUpdatedAtColumn(),
            $this->model->freshTimestampString()
        );
    }
451182
public function addProperties(array $values)
    {
        foreach ($values as $key => $value) {
            $this->add($key, $value);
        }

        return $this;
    }
754816
private function doInsert(array $values) {
        $db       = $this->db();
        $mapping  = $this->dao()->getMapping();
        $table    = $mapping['table'];
        $idColumn = $mapping['identity']['column'];
        $id       = null;
        if  (isset($values[$idColumn])) $id = $values[$idColumn];
        else unset($values[$idColumn]);

        // translate column values
        foreach ($values as &$value) {
            $value = $db->escapeLiteral($value);
        }; unset($value);

        // create SQL statement
        $sql = 'insert into '.$table.' ('.join(', ', \array_keys($values)).')
                   values ('.join(', ', $values).')';

        // execute SQL statement
        if ($id) {
            $db->execute($sql);
        }
        else if ($db->supportsInsertReturn()) {
            $id = $db->query($sql.' returning '.$idColumn)->fetchInt();
        }
        else {
            $id = $db->execute($sql)->lastInsertId();
        }
        return $id;
    }
429510
public function update(array $values)
    {
        $result = parent::update($values);

        $this->handler->setBuilder($this)
            ->invalidateQuery(Reflector::QUERY_TYPE_UPDATE, $values);

        return $result;
    }