classCopyOption
final class CopyOption
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One option of the parenthesized COPY option list: a name and an optional argument.
Mirrors the DefElem of a COPY option. The argument is a word, a string, a number, a boolean, *, DEFAULT (PostgreSQL 17) or a parenthesized list. Source: https://www.postgresql.org/docs/17/sql-copy.html.
$copy = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("COPY t TO STDOUT (FORMAT csv, FORCE_QUOTE *, HEADER)");
[$copy->statement->options[0]->name->value, $copy->statement->options[2]->argument, $copy->toString()] // => ['format', null, 'COPY t TO STDOUT (format csv, force_quote *, header)']Properties§
public Name $namepublic OptionArgument|null $argument = nullMethods§
public function __construct(public Name $name, public OptionArgument|null $argument = null)Parameters
$name | Name | The option name |
$argument | OptionArgument|null | The argument: a boolean keyword, a word, a string, a number, DEFAULT, `*` or a list |
Throws
InvalidConstruction When the argument is of another kindCalls 1
- static-call Check::input() line 45
public function render(Output $out): voidWrites the name and the argument.
Parameters
$out | Output |
Calls 2
- method-call Output::name() line 57
- class-const NameUse::Label() line 57
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CopyOptionTestcalls
Relations§
Instantiated in 1
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyQuery::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Copy/CopyQuery.php:60
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyTable::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Copy/CopyTable.php:86