classDropView
final class DropView
implements Statement
uses Snapshot
@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.
$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> $viewspublic bool $ifExists = falsepublic DropBehavior|null $behavior = nullMethods§
public function __construct(
list<QualifiedName> $views,
public bool $ifExists = false,
public DropBehavior|null $behavior = null,
)Parameters
$views | list<QualifiedName> | The views in order; at least one |
$ifExists | bool | Whether IF EXISTS is written |
$behavior | DropBehavior|null | RESTRICT or CASCADE, when written |
Calls 3
- static-call Check::listOf() line 55
- class-const QualifiedName::class() line 55
- static-call Check::input() line 57
public function deriveStatement(Derivation $derivation): voidResolves the views and reports the names the server refuses.
Parameters
$derivation | Derivation |
Calls 11
- new RelationKinds line 66
- function-call
in_arrayline 67 - class-const GrammarRelease::MySql5651() line 67
- class-const GrammarRelease::MySql5744() line 67
- class-const GrammarRelease::MySql8044() line 67
- class-const GrammarRelease::MySql847() line 67
- method-call Derivation::table() line 69
- method-call Derivation::environment() line 69
- method-call Derivation::report() line 71
- method-call RelationKinds::require() line 74
- class-const RelationKind::View() line 74
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 5
- method-call Output::keyword() line 84
- method-call Output::symbol() line 90
- method-call Output::name() line 93
- class-const NameUse::Qualifier() line 93
- class-const NameUse::Relation() line 95
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.