final class DropTable
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

DROP [TEMPORARY] TABLE [IF EXISTS] t, … [RESTRICT | CASCADE]: a request to remove tables.

Mirrors PT_drop_table_stmt. Rule: MYSQL-DROP-TABLE-001. Each table name resolves by MYSQL-CHANGE-TARGET-001 and its resolution is the relation fact of its TargetTable; under IF EXISTS a name a complete context does not declare resolves to AbsentTable. A table named twice is the diagnostic RepeatedTable. A declared view is not a table DROP TABLE finds: without IF EXISTS it is refused (MYSQL-RELATION-KIND-001). TEMPORARY restricts the request to temporary tables, which a declaration context does not distinguish. RESTRICT and CASCADE have no effect and are kept as written. The statement removes no declaration and provides none. TABLE and TABLES are synonyms. Source: https://dev.mysql.com/doc/refman/8.4/en/drop-table.html. Status: Implemented.

Resolving the dropped table to its declarationdoctest
$semantics = new \SqlSemantics\Platform\MySql\Semantics();
    $drop = $semantics->analyze('drop tables if exists t, u cascade', []);
    [$drop->toString(), $drop->statement->behavior] // => ['DROP TABLE IF EXISTS t, u CASCADE', \SqlSemantics\Platform\MySql\Statement\Alter\DropBehavior::Cascade]

Properties§

public list<TargetTable> $tables
public bool $temporary
public bool $ifExists
public DropBehavior|null $behavior = null

Methods§

public function __construct(
    public bool $temporary,
    public bool $ifExists,
    list<TargetTable> $tables,
    public DropBehavior|null $behavior = null,
)

Parameters

$temporaryboolWhether TEMPORARY is written
$ifExistsboolWhether IF EXISTS is written
$tableslist<TargetTable>The tables in order; at least one
$behaviorDropBehavior|nullRESTRICT or CASCADE, when written
Calls 3
public function deriveStatement(Derivation $derivation): void

Records the resolution of each table and reports a table named twice.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 2

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 1
Type declarations 1