final class OrdinaryColumn
    implements ColumnSpecification
    uses Snapshot
Public API: explicitly declared with @visibility public.

The specification of a column that stores the values written to it: data type, attributes and an inline reference.

Rule: MYSQL-ORDINARY-COLUMN-001. The attributes are kept in written order, because the server applies them in that order (a later NULL cancels an earlier NOT NULL). An inline REFERENCES clause is parsed and ignored by the server; it is kept as a request. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/refman/8.4/en/ansi-diff-foreign-keys.html. Status: Implemented.

Reading the attributes of a columndoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (a INT NOT NULL DEFAULT 0)');
    count($create->statement->elements[0]->specification->attributes) // => 2

Properties§

public list<ColumnAttribute> $attributes
public TypeName $type
public References|null $references = null

Methods§

public function __construct(
    public TypeName $type,
    list<ColumnAttribute> $attributes = [],
    public References|null $references = null,
)

Parameters

$typeTypeNameThe data type
$attributeslist<ColumnAttribute>The attributes in written order
$referencesReferences|nullThe inline reference, when written
Calls 2
public function dataType(): TypeName

Answers the data type.

Returns

Test cases 1
public function columnAttributes(): list<ColumnAttribute>

Answers the attributes in written order.

Returns

Test cases 1
public function deriveSpecification(Derivation $derivation, Environment $scope): void

Derives the expressions of the attributes inside the table definition.

Parameters

$derivationDerivation
$scopeEnvironment
Test cases 1
public function render(Output $out): void

Writes the type, the attributes and the reference.

Parameters

$outOutput
Calls 1

Test cases 8§

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 7

Relations§

Instantiated in 2
Type checks 1