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.

Reading the columns of a FORCE optiondoctest
$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']
Refusing columns together with the stardoctest
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\InvalidConstruction

Properties§

public list<Name> $columns
public bool $all = false

Methods§

public function __construct(
    public CopyForceKind $kind,
    list<Name> $columns,
    public bool $all = false,
)

Parameters

$kindCopyForceKindThe option set
$columnslist<Name>The columns named; empty with the star
$allboolWhether `*` is written instead of columns

Throws

InvalidConstruction When both or neither of columns and the star are written
Calls 3
public function option(): string

Answers the name of the generic option the item sets.

Returns

string
Calls 3
public function render(Output $out): void

Writes FORCE, the option and the columns or the star.

Parameters

$outOutput
Calls 7

Test cases 2§

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

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Constant reads 2
Type checks 1
Type declarations 1