classTargets
final class Targets
Resolves the existing table a DROP, RENAME, TRUNCATE or ALTER TABLE names, and answers its facts.
Rule: MYSQL-CHANGE-TARGET-001. The name resolves by CORE-TABLE-LOOKUP-001 in the current database or the database written; common table expressions are not visible to these statements. A declared table contributes one slot per declared column, in order, each referring to the declaration, and an open shape when its column list is incomplete; an undeclared or conditionally resolved name contributes an open shape that names the missing declaration; a missing or conflicting name contributes an empty complete shape and is a diagnostic, except that a missing name under IF EXISTS resolves to AbsentTable (the server only adds a note). Two names denote the same table when their databases (the current one when none is written) and their names are equal under the context's relation name comparison. Precision: every slot of a declared table is a known type. Terminates: one pass over the columns. Source: https://dev.mysql.com/doc/refman/8.4/en/drop-table.html, https://dev.mysql.com/doc/refman/8.4/en/identifier-qualifiers.html. Status: Implemented.
Methods§
public function target(Derivation $derivation, QualifiedName $name): RelationFactResolves a table name and answers its facts.
Parameters
$derivation | Derivation | |
$name | QualifiedName |
Returns
Called from 8
- method-call SqlSemantics\Platform\MySql\Rules\Server\TableNames::record() packages/sql-semantics-mysql/src/Rules/Server/TableNames.php:50
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::derive() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:59
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Targets::optional() packages/sql-semantics-mysql/src/Rules/TableChange/Targets.php:71
- method-call SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:87
- method-call SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:102
- method-call SqlSemantics\Platform\MySql\Statement\Alter\DropIndex::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropIndex.php:59
- method-call SqlSemantics\Platform\MySql\Statement\Alter\Partition\ExchangePartition::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Partition/ExchangePartition.php:50
- method-call SqlSemantics\Platform\MySql\Statement\Alter\TruncateTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/TruncateTable.php:51
Calls 7
- method-call Derivation::table() line 50
- method-call Derivation::environment() line 50
- new OutputSlot line 54
- new Known line 54
- new RelationFact line 57
- new RowShape line 57
- new IncompleteMembers line 57
public function optional(
Derivation $derivation,
QualifiedName $name,
bool $ifExists,
): RelationFactResolves a table name that IF EXISTS allows to be absent.
Parameters
$derivation | Derivation | |
$name | QualifiedName | |
$ifExists | bool |
Returns
Called from 1
Calls 4
- method-call Targets::target() line 71
- new RelationFact line 73
- new RowShape line 73
- new AbsentTable line 73
public function same(AnalysisContext $context, QualifiedName $left, QualifiedName $right): boolTells whether two written table names denote the same table.
Parameters
$context | AnalysisContext | |
$left | QualifiedName | |
$right | QualifiedName |
Returns
boolTest cases 1
Called from 5
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::derive() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:52
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::vacated() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:78
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::exists() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:95
- method-call SqlSemantics\Platform\MySql\Statement\Alter\Command\RenameTo::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Command/RenameTo.php:52
- method-call SqlSemantics\Platform\MySql\Statement\Alter\DropTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropTable.php:71
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 11
- new SqlSemantics\Platform\MySql\Rules\Server\TableNames::record() packages/sql-semantics-mysql/src/Rules/Server/TableNames.php:45
- new SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::derive() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:46
- new SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::vacated() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:78
- new SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::exists() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:95
- new SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:87
- new SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:102
- new SqlSemantics\Platform\MySql\Statement\Alter\Command\RenameTo::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Command/RenameTo.php:52
- new SqlSemantics\Platform\MySql\Statement\Alter\DropIndex::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropIndex.php:59
- new SqlSemantics\Platform\MySql\Statement\Alter\DropTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropTable.php:64
- new SqlSemantics\Platform\MySql\Statement\Alter\Partition\ExchangePartition::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Partition/ExchangePartition.php:50
- new SqlSemantics\Platform\MySql\Statement\Alter\TruncateTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/TruncateTable.php:51
Method calls 13
- method-call SqlSemantics\Platform\MySql\Rules\Server\TableNames::record() packages/sql-semantics-mysql/src/Rules/Server/TableNames.php:50
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::derive() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:52
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::derive() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:59
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::vacated() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:78
- method-call SqlSemantics\Platform\MySql\Rules\TableChange\Renamings::exists() packages/sql-semantics-mysql/src/Rules/TableChange/Renamings.php:95
- method-call SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:87
- method-call SqlSemantics\Platform\MySql\Statement\Alter\AlterTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Alter/AlterTable.php:102
- method-call SqlSemantics\Platform\MySql\Statement\Alter\Command\RenameTo::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Command/RenameTo.php:52
- method-call SqlSemantics\Platform\MySql\Statement\Alter\DropIndex::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropIndex.php:59
- method-call SqlSemantics\Platform\MySql\Statement\Alter\DropTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropTable.php:66
- method-call SqlSemantics\Platform\MySql\Statement\Alter\DropTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/DropTable.php:71
- method-call SqlSemantics\Platform\MySql\Statement\Alter\Partition\ExchangePartition::deriveCommand() packages/sql-semantics-mysql/src/Statement/Alter/Partition/ExchangePartition.php:50
- method-call SqlSemantics\Platform\MySql\Statement\Alter\TruncateTable::deriveStatement() packages/sql-semantics-mysql/src/Statement/Alter/TruncateTable.php:51