Construct and execute an insert query

@access public
@param string $table The table to insert into
@param array $params The values to insert into the table
549522
public function insert($table, $params) {
		$params = $this->filter_table_data($table, $params, $this);

		$keys = array_keys($params);
		foreach ($keys as $key => $value) {
			$keys[$key] = $this->quote_identifier($value);
		}

		$query = 'INSERT INTO ' . $this->quote_identifier($table) . ' (' . implode(',', $keys) . ') VALUES (';

		for ($i=0; $i < count($params); $i++) {
			if ($i > 0) {
				$query .= ', ';
			}
			$query .= '?';
		}

		$query .= ') ';
		$statement = $this->get_statement($query, $params);
		$statement->execute();
	}
1088277
public function insert($table, array $bind)
    {
        $this->_connect();
        $newbind = array();
        if (is_array($bind)) {
            foreach ($bind as $name => $value) {
                if($value !== null) {
                    $newbind[$name] = $value;
                }
            }
        }

        return parent::insert($table, $newbind);
    }
629959
public function perform($action, $table, $body = [], array $params = [])
    {
        $request = $this->db->getQueryBuilder()->perform($action, $table, $body, $params);
        $this->setRequest($request);

        return $this->send();
    }
588479
public function insert($table, array $columns)
    {
        if (empty($columns)) {
            return 0;
        }
        return $this->getInsertBuilder()
            ->setTable($table)
            ->setColumns($columns)
            ->execute();
    }
922413
public function insert($table, $datas = [], $INSERT = SQL::INSERT): array
    {
        if (\is_array($table)) {
            $datas = $table[SQL::VALUES] ?? $table[SQL::SET];
            $table = $this->getTable($table, SQL::INSERT);

            if (\is_string($datas)) {
                $INSERT = $datas;
            }
        }

        if (\is_string($INSERT) && \strpos($INSERT, ' ') !== false) {
            $INSERT = \array_map('\trim', \explode(' ', $INSERT));
        }

        if (\is_array($INSERT)) {
            $do = \in_array(SQL::REPLACE, $INSERT, true) ? 'REPLACE' : 'INSERT';
            $parts = [$do];

            $subs = [
                SQL::LOW_PRIORITY => 'LOW_PRIORITY',
                SQL::DELAYED => 'DELAYED',
            ];
            if ($do === SQL::INSERT) {
                $subs[SQL::HIGH_PRIORITY] = 'HIGH_PRIORITY';
            }
            foreach ($subs as $k => $sub) {
                if (\in_array($k, $INSERT, true)) {
                    $parts[] = $sub;
                    break;
                }
            }

            if ($do === SQL::INSERT && \in_array(SQL::IGNORE, $INSERT, true)) {
                $parts[] = 'IGNORE';
            }

            $INSERT = \implode(' ', $parts);
        } else {
            $INSERT = $INSERT === SQL::REPLACE ? 'REPLACE' : 'INSERT';
        }

        // Check indexed or associative array
        if (!isset($datas[0])) {
            $datas = [$datas];
        }

        $columns = \array_keys($datas[0]);

        $stack = [];
        $map = [];

        foreach ($datas as $data) {
            if (\array_keys($data) !== $columns) {
                throw new \InvalidArgumentException('Some rows contain inconsistencies');
            }

            $values = [];
            foreach ($columns as $key) {
                if ($raw = $this->buildRaw($data[$key], $map)) {
                    $values[] = $raw;
                    continue;
                }

                $values[] = $mapKey = $this->mapKey();

                if (!isset($data[$key])) {
                    $map[$mapKey] = [null, PDO::PARAM_NULL];
                } else {
                    $value = $data[$key];
                    $map[$mapKey] = $this->typeMap($value, \gettype($value));
                }

            }

            $stack[] = '(' . \implode(', ', $values) . ')';
        }

        $columns = \array_map([$this, 'columnQuote'], $columns);

        $sql = $INSERT . ' INTO ' . $this->tableQuote($table) .
            ' (' . \implode(', ', $columns) . ') VALUES ' . \implode(', ', $stack);

        return [$sql, $map];
    }
445935
public function insert($table, $data)
    {
        // empty data
        if (empty($data))
            Throw new \ErrorException("SQL Error: Can't insert empty data.");

        // prepare data
        $cols = ($values = array());
        foreach ($data as $column => $value) {
            $cols[] = '`' . $column . '`';
            $values[] = "'" . $this->escape($value) . "'";
        }

        // build query string...
        $query_string = 'INSERT INTO `' . $this->getPrefix() . $table . '` (' . implode(',', $cols) . ') VALUES (' . implode(',', $values) . ')';

        return $this->doQuery($query_string); // ... and execute
    }
970558
public function insert($table = null)
    {
        $this->type = self::TYPE_INSERT;
        if ($table) {
            $this->table($table);
        }

        return $this;
    }
147221
public void insert(QueryParameters params) throws SQLException {
        getCurrentResultSet().moveToInsertRow();

        updateResultSetCurrentLine(getCurrentResultSet(), params);
        getCurrentResultSet().insertRow();

        getCurrentResultSet().moveToCurrentRow();
    }
1226611
protected function insertPrepared( $table, $rows ) {

        $columns = $this->getColumns( $rows );
        if ( empty( $columns ) ) return;

        $query = $this->insertHead( $table, $columns );
        $query .= "( ?" . str_repeat( ", ?", count( $columns ) - 1 ) . " )";

        $statement = $this->prepare( $query );

        foreach ( $rows as $row ) {

            $values = array();

            foreach ( $columns as $column ) {

                $value = (string) $this->format( @$row[ $column ] );
                $values[] = $value;

            }

            $this->onQuery( $query, $values );

            $statement->execute( $values );

        }

        return $statement;

    }
565270
public function insertQuery(string $prefix, string $table = null): InsertQuery
    {
        return new InsertQuery($this, $this->getCompiler($prefix), $table);
    }
1234229
public static function insert( $table, $values = array(), $handler = null )
	{
		return Query_Insert::create( $table, $handler )->values( $values );
	}
110412
public function insert($params)
    {
        if (is_array($params)) {
            $count_rows = count($params['columns']);
            $increment = 1;
            foreach ($params['columns'] as $keys => $value) {
                for ($i = 1; $i <= $count_rows; $i++) {
                    $data[$keys] = $value;
                }
            }
            foreach ($data as $keys => $values) {
                if ($increment == $count_rows) {
                    $columns[] = "{$keys} = '{$values}'";
                } else {
                    $columns[] = "{$keys} = '{$values}'";
                }
                $increment++;
            }
            $columns = implode(' , ', $columns);
            $query = "INSERT INTO `{$params['table']}`SET {$columns}";
            if (isset($params['debug']) and strtolower($params['debug']) === 'on') {
                var_dump($query);
            }

            return $query;
        } else {
            return false;
        }
    }
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);
    }
643802
public function insert($table, array $fields)
    {
        $keys = array_keys($fields);
        $values = array_values($fields);

        $replace = function() { return '?'; };

        $marks = array_map($replace, $keys);

        $key = implode(',', $keys);
        $mark = implode(',', $marks);

        $sql = "INSERT INTO {$table} ($key) VALUES ($mark)";

        $result = $this->query($sql, $values);

        $identity = $this->selectOne("SELECT @@IDENTITY as IDENTITY");
        if (empty($identity)) {
            return $result;
        } else {
            return $identity->IDENTITY;
        }
    }
510259
public function execute($params = null)
    {
        if (is_array($params)) {
            $hasZeroIndex = array_key_exists(0, $params);

            foreach ($params as $key => $val) {
                if ($hasZeroIndex && is_int($key)) {
                    $this->bindValue($key + 1, $val);
                } else {
                    $this->bindValue($key, $val);
                }
            }
        }

        if (! sasql_stmt_execute($this->stmt)) {
            throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
        }

        $this->result = sasql_stmt_result_metadata($this->stmt);

        return true;
    }
996199
public function insert(string $table) : QueryBuilder
    {
        $this->_query[] = "INSERT INTO";
        $this->_query[] = "`". $this->sanitize($table) ."`";

        return $this;
    }
1277769
public function execute($query = null, array $params = []) : object
    {
        // When using one argument and its array, assume its $params
        if (is_array($query)) {
            $params = $query;
            $query = null;
        }

        if (!$query) {
            $query = $this->getSQL();
        }

        return parent::execute($query, $params);
    }