Insert query

@param string $table (optional)
@return $this
970558
public function insert($table = null)
    {
        $this->type = self::TYPE_INSERT;
        if ($table) {
            $this->table($table);
        }

        return $this;
    }
565270
public function insertQuery(string $prefix, string $table = null): InsertQuery
    {
        return new InsertQuery($this, $this->getCompiler($prefix), $table);
    }
385756
public function table($table)
    {
        $this->table = $table;
        $alias = $this->alias ?? $this->table;

        if (!in_array('`' . $table . '`.*', $this->select) && !in_array('`' . $alias . '`.*', $this->select)) {
            $this->select[] = '`' . $table . '`.*';
        }

        return $this;
    }
624166
public function table($table)
    {
        if( $table instanceof Expression ) {
            $this->table = $table;
        } else {
            $this->table = (string) $table;
        }
        return $this;
    }
1070254
public function setTable(Table $table = null)
    {
        $this->table = $table;

        if ($table && !in_array($this, $table->getRows())) {
            $table->addRow($this);
        }

        return $this;
    }
326939
public function setTable($table)
    {
        if ($table === null) {
            $this->table = $table;
            return $this;
        }

        if (!is_string($table)) {
            throw new InvalidArgumentException(
                'Table reference must be a string.'
            );
        }

        if ($table === '') {
            throw new InvalidArgumentException(
                'Table reference can not be empty.'
            );
        }

        $this->table = $table;
        return $this;
    }
578062
public function insert($table, array $data)
    {
        $table = $this->getTable($table);
        $field = implode(', ', array_keys($data));

        $placeholder = array();
        foreach ($data as $key => $value) {
            if ($value instanceof \stdClass && isset($value->scalar)) {
                $placeholder[] = $value->scalar;
                unset($data[$key]);
            } else {
                $placeholder[] = '?';
            }
        }
        $placeholder = implode(', ', $placeholder);

        $query = "INSERT INTO $table ($field) VALUES ($placeholder)";
        return $this->executeUpdate($query, array_values($data));
    }
150623
public function table($table)
    {
        $ar = static::cyrus();
        $ar->setTableName($table);
        static::$dataSource = true;

        return $this;
    }
1149157
public function insert($table, array $data)
    {
        $table  = $this->quote()->identifier($table);
        $fields = implode(', ', array_keys($data));
        $values = implode(', ', array_map([$this->quote(), 'value'], $data));
        $sql = "INSERT INTO $table ($fields) VALUES ($values)";

        $stmt = $this->query($sql);

        return $stmt->rowCount();
    }
217087
public function from($table)
    {
        $this->fromTable = (is_null($table)) ? get_class($this) : $table;

        return $this;
    }
103933
public static function insert($table, array $set)
	{
		$query = 'INSERT INTO ' . self::escapeTableName($table) . ' SET ';
		$values = array ();
		foreach ($set as $k => $v) {
			$query .= $k . ' = ?, ';

			// No array? Then it's a simple string.
			if (is_array ($v)) {
				$values[] = $v;
			} else {
				$values[] = array($v);
			}
		}

		$query = substr($query, 0, -2);

		$query = new self($query);
		$query->bindValues($values);

		return $query;
	}
779241
public static function query($table)
    {
        $query = new Builder(
            $connection = static::user()->getConnection(),
            $connection->getQueryGrammar(),
            $connection->getPostProcessor()
        );

        return $query->from(static::table($table));
    }
1194233
public function insert($table, $ignore = false)
	{
		$this->syntax->setInsert($table, $ignore);
		$this->type = 'insert';
		return $this;
	}
1282944
public function into(string $table)
    {
        parent::into($table);
        $compiler = $this->connection->getCompiler();
        return $this->connection->command($compiler->insert($this->sql), $compiler->getParams());
    }
837827
public function addTable($table)
    {
        if (!in_array($table, $this->tables))
        {
            $this->tables[] = $table;
        }

        return $this;
    }
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();
	}
448960
public function insertPDO($table, array $data = array())
    {
        if (count($data) === 0) {
            return false;
        }
        $q = "INSERT INTO `$table` ";
        $v = '';
        $n = '';

        foreach ($data as $key => $val) {
            $n .= "`$key`, ";
            if (strtolower($val) === 'now()') {
                $v .= 'NOW(), ';
                unset($data[$key]);
            } else {
                $v .= '?, ';
            }
        }
        $q .= '(' . rtrim($n, ', ') . ') VALUES (' . rtrim($v, ', ') . ');';
        try {
            $this->_queryId = self::$_linkId->prepare($q);

            $i = 1;
            foreach ($data as $key => $val) {
                $type = $this->getPDOConstantType($val);
                $this->_queryId->bindValue($i, $val, $type);
                ++$i;
            }
            $this->_queryId->execute();
            return self::$_linkId->lastInsertId();
        } catch (PDOException $e) {
            $this->_error = $e->getMessage();
            return false;
        }
    }