classTextFileFormat
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.
$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> $fieldspublic list<LineOption> $linespublic CharsetName|null $charset = nullMethods§
public function __construct(
public CharsetName|null $charset = null,
list<FieldOption> $fields = [],
list<LineOption> $lines = [],
)Parameters
$charset | CharsetName|null | The character set of the file |
$fields | list<FieldOption> | The FIELDS options |
$lines | list<LineOption> | The LINES options |
Calls 3
- static-call Check::listOf() line 48
- class-const FieldOption::class() line 48
- class-const LineOption::class() line 49
public function render(Output $out): voidWrites the character set, the FIELDS options and the LINES options.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 58
- method-call Output::node() line 63
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TextFileFormatTestcalls