final class ColumnDefinition
    implements TableElement
    uses Snapshot
Public API: explicitly declared with @visibility public.

One column of a table definition: its name and its specification.

Rule: MYSQL-COLUMN-DEFINITION-001. MySQL 5.x lets a table and database qualify the name, which the server requires to name the table of the statement; the qualifier is kept as written. The expressions inside the specification are derived at the position of the table definition (MYSQL-DEFINITION-SCOPE-001). Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/refman/5.7/en/identifier-qualifiers.html. Status: Implemented.

Reading a column definitiondoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (id BIGINT UNSIGNED NOT NULL)');
    [$create->statement->elements[0]->name->column->value, $create->statement->elements[0]->specification->dataType()->name()] // => ['id', 'BIGINT']

Properties§

public ColumnName $name
public ColumnSpecification $specification

Methods§

public function __construct(public ColumnName $name, public ColumnSpecification $specification)

Parameters

$nameColumnNameThe column name, with the qualifier MySQL 5.x allows
$specificationColumnSpecificationThe type, attributes, generation expression and reference
public function deriveElement(Derivation $derivation, Environment $scope): void

Derives the expressions of the specification inside the table definition.

Parameters

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

Writes the name and the specification.

Parameters

$outOutput
Calls 1

Test cases 30§

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 29

Relations§

Instantiated in 3
Type checks 6
Type declarations 8