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

A request to drop views.

Rule: MYSQL-DROP-VIEW-001. Each name resolves by CORE-TABLE-LOOKUP-001 in the current database or the database written. A name a complete context does not declare, or that conflicts, is a diagnostic, except that IF EXISTS allows an absent view (the server only adds a note). A declared base table is refused by MYSQL-RELATION-KIND-001: always in 8.1, 8.2, 8.3, 9.0 and 9.1, and in the other releases only without IF EXISTS. The statement changes no context. RESTRICT and CASCADE are parsed and ignored by the server; they are kept as written. Source: https://dev.mysql.com/doc/refman/8.4/en/drop-view.html. Status: Implemented.

Reading the views to dropdoctest
$drop = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('DROP VIEW IF EXISTS v, shop.w');
    [count($drop->statement->views), $drop->statement->ifExists] // => [2, true]

Properties§

public non-empty-list<QualifiedName> $views
public bool $ifExists = false
public DropBehavior|null $behavior = null

Methods§

public function __construct(
    list<QualifiedName> $views,
    public bool $ifExists = false,
    public DropBehavior|null $behavior = null,
)

Parameters

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

Resolves the views and reports the names the server refuses.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 5

Test cases 2§

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 1

Relations§

Instantiated in 1
Type declarations 1