final class ViewRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Lowers CREATE VIEW, ALTER VIEW and DROP VIEW.

Rule: MYSQL-VIEW-LOWERING-001. Scope: view_replace_or_algorithm, view_replace, view_algorithm, view_suid, view_tail, view_list_opt, view_list, view_select, view_query_block, view_check_option, alter_view_stmt, drop_view_stmt, and the alter and drop alternatives of views (5.x). The definer comes from the leaf rules, the query from the query family. Constructs: CreateView, AlterView, DropView, ViewDefinition. Terminates: every child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/create-view.html, https://dev.mysql.com/doc/refman/8.4/en/alter-view.html, https://dev.mysql.com/doc/refman/8.4/en/drop-view.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function create(Node $tail, ?Node $prefix, ?Account $definer): CreateView

Lowers CREATE VIEW: a node of view_tail, the node of view_replace_or_algorithm when one is written, and the definer.

Parameters

$tailNode
$prefix?Node
$definer?Account

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 3
public function prefix(Node $prefix): array{bool, ViewAlgorithm|null}

Lowers the OR REPLACE and ALGORITHM prefix: a node of view_replace_or_algorithm.

Parameters

$prefixNode

Returns

array{bool, ViewAlgorithm|null}

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 3
public function columns(Node $list): list<Name>|null

Lowers a 5.x column list: a node of view_list_opt; none is null.

Parameters

$listNode

Returns

list<Name>|null

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 3

Private surface 5§

Implementation details, listed for orientation only.

private const ALGORITHMS = ['view_algorithm: ALGORITHM_SYM EQ UNDEFINED_SYM' => \SqlSemantics\Platform\MyS…
private const CHECKS = ['view_check_option:' => null, 'view_check_option: WITH CHECK_SYM OPTION' => \S…
private const SECURITY = ['view_suid:' => null, 'view_suid: SQL_SYM SECURITY_SYM DEFINER_SYM' => \SqlSem…
private const ALTERS = ['alter: ALTER view_algorithm definer_opt view_tail' => [1, 2, 3], 'alter: ALTE…
private Lowering $lowering

Test cases 9§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 9

Relations§

Instantiated in 4
Method calls 5