classColumnPart
final class ColumnPart
implements KeyPart
uses Snapshot
Public API: explicitly declared with
@visibility public.A key part that names a column, with an optional prefix length and sort direction.
Whether the column exists is checked against the table being defined or indexed (MYSQL-TABLE-PROBLEMS-001). The direction is kept as written; an index is ascending without one. Source: https://dev.mysql.com/doc/refman/8.4/en/create-index.html#create-index-column-prefixes, https://dev.mysql.com/doc/refman/8.4/en/descending-indexes.html.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t (a TEXT, KEY (a(10) DESC))');
[$create->statement->elements[1]->parts[0]->column->value, $create->statement->elements[1]->parts[0]->length->text] // => ['a', '10']Properties§
public Name $columnpublic Numeral|null $length = nullpublic Direction|null $direction = nullMethods§
public function deriveKeyPart(Derivation $derivation, Environment $scope): voidDerives nothing: a column name is not an expression; the table checks it.
Parameters
$derivation | Derivation | |
$scope | Environment |
public function render(Output $out): voidWrites the column, the length and the direction.
Parameters
$out | Output |
Calls 4
- method-call Output::name() line 54
- class-const NameUse::Column() line 54
- method-call Output::glue() line 56
- method-call Output::keyword() line 59
Test cases 3§
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 2
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyPartRule::part() packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyPartRule.php:108
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyPartRule::part() packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyPartRule.php:109
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyPartRule::part() packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyPartRule.php:110
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyPartRule::part() packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyPartRule.php:111
Constant reads 1
Type checks 4
- instanceof SqlSemantics\Platform\MySql\Lowering\TableDefinition\Key\KeyPartRule::columns() packages/sql-semantics-mysql/src/Lowering/TableDefinition/Key/KeyPartRule.php:87
- instanceof SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration::primaryColumns() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:90
- instanceof SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems::keyColumns() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:140
- instanceof SqlSemantics\Platform\MySql\Statement\Table\CreateIndex::deriveStatement() packages/sql-semantics-mysql/src/Statement/Table/CreateIndex.php:107