classCopyForce
final class CopyForce
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.A FORCE option of the old COPY syntax: FORCE QUOTE, FORCE NOT NULL or FORCE NULL with a column list or *.
* stands for every column copied (FORCE NOT NULL * and FORCE NULL * from PostgreSQL 17). Source: https://www.postgresql.org/docs/17/sql-copy.html#id-1.9.3.55.10.
$copy = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('COPY t TO STDOUT CSV FORCE QUOTE a, b');
[count($copy->statement->legacy[1]->columns), $copy->statement->legacy[1]->option()] // => [2, 'force_quote']new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyForce(\SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyForceKind::Quote, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')], true) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public list<Name> $columnspublic CopyForceKind $kindpublic bool $all = falseMethods§
public function __construct(
public CopyForceKind $kind,
list<Name> $columns,
public bool $all = false,
)Parameters
$kind | CopyForceKind | The option set |
$columns | list<Name> | The columns named; empty with the star |
$all | bool | Whether `*` is written instead of columns |
Throws
InvalidConstruction When both or neither of columns and the star are writtenCalls 3
- static-call Check::listOf() line 47
- class-const Name::class() line 47
- static-call Check::input() line 48
public function option(): stringAnswers the name of the generic option the item sets.
Returns
stringCalls 3
- class-const CopyForceKind::Quote() line 57
- class-const CopyForceKind::NotNull() line 58
- class-const CopyForceKind::Null() line 59
public function render(Output $out): voidWrites FORCE, the option and the columns or the star.
Parameters
$out | Output |
Calls 7
- method-call Output::keyword() line 68
- class-const CopyForceKind::Quote() line 69
- class-const CopyForceKind::NotNull() line 70
- class-const CopyForceKind::Null() line 71
- method-call Output::symbol() line 74
- method-call Output::name() line 82
- class-const NameUse::Column() line 82
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CopyForceTestcalls
Other tests reaching this symbol 1
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:59
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyTable::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Copy/CopyTable.php:85