Inserts data into the chosen table.

@param  array $values Associative array of column values
@return bool
198006
public function insert(array $values = []): bool
	{
		$query = $this->compiler->insert($values);

		return $this->connection->query($query['sql'], $query['params']);
	}
933348
protected function values(array $values)
    {
        if (is_numeric(key($values))) {
            $this->insertValues[] = $values;
        } else {
            // Reorder the submitted values to match the fields array.
            foreach ($this->insertFields as $key) {
                $insert_values[$key] = $values[$key];
            }
            $this->insertValues[] = array_values($insert_values);
        }
        return $this;
    }
731441
public function insert($table, $values){
		$statement = Statement::createInsert($this->connection, $table, $values);
		foreach($this->observers as $observer){
			$statement->attachObserver($observer, $this->observers->getInfo());
		}
		return $statement;
	}
1336380
public function setValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
	}
742539
public function addValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);});
	}
962553
public function insert($fields) {
        // Create temporary variables for 
        // tokenized parameter
        $_tmp_fields = [];
        $_tmp_values = [];
        
        if (is_array($fields)) {
            foreach ($fields as $key => $value) {
                array_push($_tmp_fields, $key);
                
                if (is_string($value)) {
                    array_push($_tmp_values, '\'' . addslashes($value) . '\'');
                } else {
                    array_push($_tmp_values, $value);
                }
            }
            
            $this->_fields = implode($_tmp_fields, ', ');
            $this->_values = implode($_tmp_values, ', ');
        } else {
            return false;
        }
        
        $sql_query = 'INSERT INTO ' . $this->_table . 
                     '(' . $this->_fields . ')' .
                     ' VALUES(' . $this->_values . ')';
                     
        // Set the query
        $this->_sql_query = $sql_query;
        
        // Execute query
        return $this;
    }
366356
public function update(array $values)
    {
        // migrate the collection, if needed
        Schema\Builder::getInstance()->dynamic($this->query->getModel(), $values);

        $allowed = $this->fireEvent('updating_multiple', array($this, $values));

        if ($allowed === false) {
            return false;
        } elseif (is_array($allowed)) {
            $values = $allowed;
        }

        $result = $this->query->update($values);
        $this->fireEvent('updated_multiple', array($this, $values));

        return $result;
    }
463347
public function in(array $values)
    {
        foreach ($values as $value) {
            if (\is_array($value)) {
                $this->in($value);
            } else {
                $this->is($value);
            }
        }

        return $this;
    }
479783
public function setFromArray(array $values) {
        foreach ($values as $key => $val) {
            $this->set($key, $val);
        }
        return $this;
    }
868756
function values(array $values)
    {
        $cols = array();
        $vals = array();

        foreach ($values as $col => $val) {
            if (null !== $val) {
                $cols[] = $col;
                $vals[] = $val;
            }
        }

        foreach ($cols as &$col) {
            $this->nodes->columns[] = new UnqualifiedColumn($col);
        }

        $this->nodes->values = array_merge($this->nodes->values, $vals);
        return $this;
    }
451182
public function addProperties(array $values)
    {
        foreach ($values as $key => $value) {
            $this->add($key, $value);
        }

        return $this;
    }
904968
protected function addUpdatedAtColumn(array $values)
    {
        if (! $this->model->usesTimestamps()) return $values;

        $column = $this->model->getUpdatedAtColumn();

        return array_add($values, $column, $this->model->freshTimestampString());
    }
213847
public function addValues(array $values)
    {
        $valueReferences = [];

        foreach ($values as $value) {
            $valueReferences[] = $this->getReferences()->createReference($value);
        }

        $this->values[] = $valueReferences;

        return $this;
    }
570986
final public function insert( $values ) {
		$current_time = current_time( 'mysql', $this->use_gmt() );
		foreach ( [ 'created', 'updated' ] as $col ) {
			if ( ! isset( $values[ $col ] ) ) {
				$values[ $col ] = $current_time;
			}
		}
		try {
			$place_holders = $this->get_place_holders( $values );
			$result = $this->db->insert( $this->table, $values, $place_holders );
			if ( !$result ) {
				return new \WP_Error( 'db_error', __( 'Failed to insert data. Something is wrong with database.', 'karma' ) );
			} else {
				return (int) $this->db->insert_id;
			}
		} catch ( \Exception $e ) {
			return new \WP_Error( 'db_error', $e->getMessage() );
		}
	}
876014
protected function insertSingle(string $table, array $values): ?array {
		
		// this one is far less complex that our insertMultiple above.  we'll build our
		// statement and then pass control over to insertExecute which'll actually perform
		// our statement and return the appropriate results up the call stack.
		
		$statement = $this->insertBuild($table, $values);
		return $this->insertExecute($statement, $values);
	}
347533
public function in(array $values): bool
    {
        foreach ($values as $value) {
            if ($this->is($value)) {
                return true;
            }
        }

        return false;
    }
541311
private function insertOne(array $value)
    {
        $fields = array_keys($value);

        $sql = 'insert into `' . $this->table . '` values (';

        $sql .= implode(', ', Util::add2points($fields, true));

        $sql .= ');';

        $stmt = $this->connection->prepare($sql);

        $this->bind($stmt, $value);

        $stmt->execute();

        return (int) $stmt->rowCount();
    }