Insert şlemlerinde kullanılır

@param string $table
@param callable $callable
@return mixed
164671
public function insert($table, callable $callable = null)
    {

        $this->connect($table);
        $insert = new Insert($this);

        return $callable($insert);
    }
479943
public static function create($table, $callback)
	{
		$table = new Table($table);

		// To indicate that the table is new and needs to be created, we'll run
		// the "create" command on the table instance. This tells schema it is
		// not simply a column modification operation.
		$table->create();

		call_user_func($callback, $table);

		return static::execute($table);
	}
418534
private function createResponseObject(callable $callable)
    {
        try {
            $response = new JsonResponse($callable());
        } catch (EntityNotFoundException $notFoundException) {
            $response = new JsonResponse(
                $notFoundException->getMessage(),
                404
            );
        } catch (Exception $e) {
            $response = new JsonResponse(
                'API exception. Please contact your webmaster',
                500
            );
        }

        return $response;
    }
102419
public function insert(string $table): Query\Insert
    {
        $query = new Query\Insert();
        $query->insert($table);
        return $query;
    }
1243417
public function upsert($table, $insertColumns, $updateColumns, &$params)
    {
        /**
 * @var Constraint[] $constraints 
*/
        list($uniqueNames, $insertNames, $updateNames) = $this->prepareUpsertColumns($table, $insertColumns, $updateColumns, $constraints);
        if (empty($uniqueNames)) {
            return $this->insert($table, $insertColumns, $params);
        }

        list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params);
        $insertSql = 'INSERT OR IGNORE INTO ' . $this->db->quoteTableName($table)
            . (!empty($insertNames) ? ' (' . implode(', ', $insertNames) . ')' : '')
            . (!empty($placeholders) ? ' VALUES (' . implode(', ', $placeholders) . ')' : $values);
        if ($updateColumns === false) {
            return $insertSql;
        }

        $updateCondition = ['or'];
        $quotedTableName = $this->db->quoteTableName($table);
        foreach ($constraints as $constraint) {
            $constraintCondition = ['and'];
            foreach ($constraint->columnNames as $name) {
                $quotedName = $this->db->quoteColumnName($name);
                $constraintCondition[] = "$quotedTableName.$quotedName=(SELECT $quotedName FROM `EXCLUDED`)";
            }
            $updateCondition[] = $constraintCondition;
        }
        if ($updateColumns === true) {
            $updateColumns = [];
            foreach ($updateNames as $name) {
                $quotedName = $this->db->quoteColumnName($name);
                if (strrpos($quotedName, '.') === false) {
                    $quotedName = "(SELECT $quotedName FROM `EXCLUDED`)";
                }
                $updateColumns[$name] = new Expression($quotedName);
            }
        }
        $updateSql = 'WITH "EXCLUDED" (' . implode(', ', $insertNames)
            . ') AS (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') '
            . $this->update($table, $updateColumns, $updateCondition, $params);
        return "$updateSql; $insertSql;";
    }
161961
public static function createTable($table, callable $callback) {
        $table = new Table($table);
        call_user_func($callback, $table);
        return $table->create();
    }
142358
private static void doInsert(CallInfo callInfo, Table table, DataSet data) {
    StringBuilder sql = new StringBuilder("INSERT INTO ");
    List<String> tableColumns = table.getColumns();
    int columnCount = tableColumns.size();
    int[] paramIdx = new int[columnCount];
    int param = 0;
    Iterator<String> itr = tableColumns.iterator();
    String col = itr.next();
    
    paramIdx[param] = ++param;
    sql.append(table.getName())
       .append('(')
       .append(col);
    
    while (itr.hasNext()) {
      paramIdx[param] = ++param;
      col = itr.next();
      sql.append(',')
         .append(col);
    }
    sql.append(") VALUES (?");
    for (int i=1; i < columnCount; i++) {
      sql.append(",?");
    }
    sql.append(')');

    dataSetOperation(callInfo, table, data, sql.toString(), paramIdx);
  }
416039
public function alter(\Closure $callable)
    {
        $schema = new Schema\AlterSchema($this->table);
        $callable = $callable->bindTo($schema);

        $callable($this->database);

        return $this->execSchema($schema);
    }
188198
public function add($key, $callable)
    {
        $menu = new AdminMenu($callable);

        $this->adminMenu->put($key, $menu);

        return $this;
    }
1292548
public function insert($table, $data) {
        if (!is_array($data)) {
            return false;
        }

        $fragment_sql = $this->prepareBinding($data, ', ');
        $bind_values = array_values($data);
        $query = 'INSERT `'. $table.'` SET ' . $fragment_sql;

        return $this->run($query, $bind_values);
    }
808195
public function call($key, $callable)
    {
        if (!is_callable($callable)) {
            throw new \InvalidArgumentException('Not a valid callable.');
        }

        if ($this->exists($key)) {
            return $this->get($key);
        }

        $args = func_get_args();
        array_shift($args);
        array_shift($args);

        $value = call_user_func_array($callable, $args);

        $this->set($key, $value);

        return $value;
    }
489335
public function dynamic($callable)
    {
        return $this->attributes[$this->attribute] = new self::$classMap['dynamic']($this->attribute, $this->entity, $callable);
    }
944371
public function map(callable $callable)
    {
        $keys = $this->keys();
        $items = array_map($callable, $this->attributes, $keys);

        return new static(array_combine($keys, $items));
    }
449541
public function create($table, Closure $callback)
    {
        $table = $this->schema->createTable($table);

        $callback($this->build($table));

        return $table;
    }
1149840
public function addTrigger($type, $table, callable $trigger)
    {
        if (!array_key_exists($type, $this->triggers)) {
            throw new \Exception("Invalid trigger type specified");
        }

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

        return $this;
    }
685889
public function setCallable($callable)
    {
        $matches = array();
        if (is_string($callable) && preg_match('!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!', $callable, $matches)) {
            $class = $matches[1];
            $method = $matches[2];
            $callable = function() use ($class, $method) {
                static $obj = null;
                if ($obj === null) {
                    $obj = new $class;
                }
                return call_user_func_array(array($obj, $method), func_get_args());
            };
        }

        if (!is_callable($callable)) {
            throw new \InvalidArgumentException('Route callable must be callable');
        }

        $this->callable = $callable;
    }