classViewDefinition
final class ViewDefinition
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The part a CREATE VIEW and an ALTER VIEW share: algorithm, definer, security, name, column list, query and check option.
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.
$view = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE ALGORITHM = MERGE SQL SECURITY INVOKER VIEW v (x) AS SELECT 1 WITH LOCAL CHECK OPTION');
[$view->statement->definition->algorithm, $view->statement->definition->security, $view->statement->definition->check] // => [\SqlSemantics\Platform\MySql\Statement\View\ViewAlgorithm::Merge, \SqlSemantics\Platform\MySql\Statement\View\ViewSecurity::Invoker, \SqlSemantics\Platform\MySql\Statement\View\ViewCheckOption::Local]Properties§
public non-empty-list<Name>|null $columnspublic QualifiedName $namepublic Query $querypublic ViewAlgorithm|null $algorithm = nullpublic Account|null $definer = nullpublic ViewSecurity|null $security = nullpublic ViewCheckOption|null $check = nullpublic bool $ifNotExists = falseMethods§
public function __construct(
public QualifiedName $name,
public Query $query,
list<Name>|null $columns = null,
public ViewAlgorithm|null $algorithm = null,
public Account|null $definer = null,
public ViewSecurity|null $security = null,
public ViewCheckOption|null $check = null,
public bool $ifNotExists = false,
)Parameters
$name | QualifiedName | The view name |
$query | Query | The query the view stands for |
$columns | list<Name>|null | The column list; null when none is written, otherwise at least one |
$algorithm | ViewAlgorithm|null | The ALGORITHM clause, when written |
$definer | Account|null | The DEFINER clause, when written |
$security | ViewSecurity|null | The SQL SECURITY clause, when written |
$check | ViewCheckOption|null | The WITH CHECK OPTION clause, when written |
$ifNotExists | bool | Whether IF NOT EXISTS is written (MySQL 9.1 and later) |
Calls 3
- static-call Check::input() line 57
- static-call Check::listOf() line 58
- class-const Name::class() line 58
public function renderHead(Output $out): voidWrites the clauses before VIEW: the algorithm, the definer and the security.
Parameters
$out | Output |
Called from 2
Calls 1
- method-call Output::keyword() line 67
public function render(Output $out): voidWrites the clauses after VIEW: IF NOT EXISTS, the name, the column list, the query and the check option.
Parameters
$out | Output |
Calls 7
- method-call Output::keyword() line 83
- method-call Output::name() line 86
- class-const NameUse::Qualifier() line 86
- class-const NameUse::Relation() line 88
- method-call Output::symbol() line 90
- class-const NameUse::Column() line 95
- class-const ViewCheckOption::Unqualified() line 102
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ViewDefinitionTestcalls
Relations§
Instantiated in 1
Method calls 2
Type declarations 4
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\View\ViewRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/View/ViewRule.php:137
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\ViewFacts packages/sql-semantics-mysql/src/Rules/TableDefinition/ViewFacts.php:33
- type SqlSemantics\Platform\MySql\Statement\View\AlterView packages/sql-semantics-mysql/src/Statement/View/AlterView.php:38
- type SqlSemantics\Platform\MySql\Statement\View\CreateView packages/sql-semantics-mysql/src/Statement/View/CreateView.php:40