final class TextFileFormat
    implements FileFormat
    uses Snapshot
Public API: explicitly declared with @visibility public.

The text file format of SELECT ... INTO OUTFILE: character set, FIELDS options and LINES options.

Mirrors the server's sql_exchange with its field and line separators. The options are kept in written order; an option written twice is kept twice, and the server uses the last one. Source: https://dev.mysql.com/doc/refman/8.4/en/select-into.html, https://dev.mysql.com/doc/refman/8.4/en/load-data.html.

Reading the format of INTO OUTFILEdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT 1 INTO OUTFILE 'f' CHARACTER SET utf8mb4 FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY ';'");
    [$query->statement->into->format->charset->name->value, count($query->statement->into->format->fields), count($query->statement->into->format->lines)] // => ['utf8mb4', 2, 1]

Properties§

public list<FieldOption> $fields
public list<LineOption> $lines
public CharsetName|null $charset = null

Methods§

public function __construct(
    public CharsetName|null $charset = null,
    list<FieldOption> $fields = [],
    list<LineOption> $lines = [],
)

Parameters

$charsetCharsetName|nullThe character set of the file
$fieldslist<FieldOption>The FIELDS options
$lineslist<LineOption>The LINES options
Calls 3
public function render(Output $out): void

Writes the character set, the FIELDS options and the LINES options.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1