classTableProblems
final class TableProblems
Reports the problems of a table definition that the server rejects.
Rule: MYSQL-TABLE-PROBLEMS-001. Diagnostics: two columns of the declared table with one name (ER_DUP_FIELDNAME); more than one primary key, counting each column with a PRIMARY KEY attribute and each PRIMARY KEY element (ER_MULTIPLE_PRI_KEY); from MySQL 5.7 on, a primary key column whose NULL attribute is still in force (ER_PRIMARY_CANT_HAVE_NULL; 5.6 makes it NOT NULL silently); a key part or foreign key column that names no column of the table, when its column list is complete (ER_KEY_COLUMN_DOES_NOT_EXITS); a table without columns and without a query (ER_TABLE_MUST_HAVE_COLUMNS); a column name that is not valid, among them the name a selected column gets after its text (ER_WRONG_COLUMN_NAME, MYSQL-COLUMN-NAME-001); a generated column of the CREATE TABLE part that a column of the SELECT part names, so that the query would fill it (ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN; sql/sql_insert.cc Query_result_create::create_table_for_query_block). Terminates: one pass over the elements and the key parts. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/mysql-errors/8.4/en/server-error-reference.html. Status: Implemented.
Methods§
public function report(CreateTable $definition, Table $table, Derivation $derivation): voidReports the problems of a definition against the declaration it provides.
Parameters
$definition | CreateTable | |
$table | Table | |
$derivation | Derivation |
Called from 1
Calls 14
- method-call TableProblems::duplicates() line 56
- method-call TableProblems::names() line 57
- new TableDeclaration line 58
- method-call TableDeclaration::primaryColumns() line 59
- method-call ColumnFlags::flags() line 65
- new ColumnFlags line 65
- method-call TableDeclaration::named() line 67
- class-const GrammarRelease::MySql5651() line 68
- method-call Derivation::report() line 69
- new NullablePrimaryKey line 69
- class-const IndexKind::Primary() line 72
- method-call TableProblems::keyColumns() line 73
- new MultiplePrimaryKeys line 76
- new NoColumns line 79
public function names(Table $table, Derivation $derivation): voidReports each column name that is not a valid column name (MYSQL-COLUMN-NAME-001).
Parameters
$table | Table | |
$derivation | Derivation |
Called from 1
Calls 5
- new ColumnNameRule line 88
- function-call
array_mapline 89 - method-call ColumnNameRule::valid() line 90
- method-call Derivation::report() line 91
- new IncorrectColumnName line 91
public function duplicates(Table $table, Derivation $derivation): voidReports each column name the declaration repeats.
Parameters
$table | Table | |
$derivation | Derivation |
Called from 2
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems::report() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:56
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\ViewFacts::derive() packages/sql-semantics-mysql/src/Rules/TableDefinition/ViewFacts.php:49
Calls 4
- method-call TableDeclaration::named() line 107
- new TableDeclaration line 107
- method-call Derivation::report() line 108
- new DuplicateColumn line 108
public function selected(
CreateTable $definition,
QueryFact $output,
Derivation $derivation,
): voidReports each generated column of the CREATE TABLE part that a column of the SELECT part would fill (MYSQL-GENERATED-WRITE-001).
Parameters
$definition | CreateTable | |
$output | QueryFact | |
$derivation | Derivation |
Called from 1
Calls 4
- method-call TableDeclaration::settled() line 120
- new TableDeclaration line 120
- method-call Derivation::report() line 123
- new GeneratedColumnWrite line 123
public function keyColumns(list<object> $parts, Table $table, Derivation $derivation): voidReports the key parts that name no column of a complete table.
Parameters
$parts | list<object> | The key parts |
$table | Table | |
$derivation | Derivation |
Called from 1
Calls 3
- method-call Table::matchingColumns() line 140
- method-call Derivation::report() line 141
- new UnknownKeyColumn line 141
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TableProblemsTestcalls
Relations§
Instantiated in 2
Method calls 3
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\ViewFacts::derive() packages/sql-semantics-mysql/src/Rules/TableDefinition/ViewFacts.php:49
- method-call SqlSemantics\Platform\MySql\Statement\Table\CreateTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Table/CreateTable.php:134
- method-call SqlSemantics\Platform\MySql\Statement\Table\CreateTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Table/CreateTable.php:136