Ouzo\Db\Dialect\PostgresDialect::batchInsert PHP Méthode

batchInsert() public méthode

public batchInsert ( $table, $primaryKey, $columns, $batchSize )
    public function batchInsert($table, $primaryKey, $columns, $batchSize)
    {
        $valueClause = '(' . implode(', ', array_fill(0, count($columns), '?')) . ')';
        $valueClauses = implode(', ', array_fill(0, $batchSize, $valueClause));
        $joinedColumns = implode(', ', $columns);
        $sql = "INSERT INTO {$table} ({$joinedColumns}) VALUES {$valueClauses}";
        if ($primaryKey) {
            $sql .= ' RETURNING ' . $primaryKey;
        }
        return $sql;
    }