classAlterView
final class AlterView
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to change the definition of an existing view.
Rule: MYSQL-ALTER-VIEW-001. The view name is a table use: the statement node records its resolution as a target; a declared base table is refused (MYSQL-RELATION-KIND-001). The new query is derived and checked as for CREATE VIEW (MYSQL-VIEW-FACTS-001), but an ALTER provides no declaration: it requests a change and does not change a context. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-view.html. Status: Implemented.
$view = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER VIEW v AS SELECT 1 AS a');
[$view->statement->definition->name->name->value, $view->declarations()] // => ['v', []]Properties§
public ViewDefinition $definitionMethods§
public function __construct(public ViewDefinition $definition)Parameters
$definition | ViewDefinition | The new view definition |
public function deriveStatement(Derivation $derivation): voidResolves the view and derives its new query.
Parameters
$derivation | Derivation |
Calls 8
- method-call Derivation::target() line 47
- method-call TableTargets::existing() line 47
- new TableTargets line 47
- method-call RelationKinds::require() line 48
- new RelationKinds line 48
- class-const RelationKind::View() line 48
- method-call ViewFacts::derive() line 49
- new ViewFacts line 49
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 57
- method-call ViewDefinition::renderHead() line 58
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
AlterViewTestcalls