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

A request to create a view: a named query.

Rule: SQLITE-CREATE-VIEW-001. The query is derived as a root query. The statement provides one view declaration whose columns come from the output fields of the query, named by the column list when one is written (SQLITE-QUERY-COLUMNS-001). A view has no row identifier. A column list of another length than the query result is a diagnostic and leaves the declaration incomplete and its columns without types, as an open query shape without a column list leaves it incomplete; a name of the column list written with a collation or a sort order is a diagnostic. A TEMP view belongs to the temp schema. The statement returns no rows. Source: https://sqlite.org/lang_createview.html. Status: Implemented.

Declaring a view with a column listdoctest
$view = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE VIEW v (one, two) AS SELECT 1, 2');
    [$view->declarations()[0]->columns[1]->name->value, $view->declarations()[0]->implicit] // => ['two', []]

Properties§

public list<ListedColumn>|null $columns
public Query $query
public bool $temporary = false
public bool $ifNotExists = false

Methods§

public function __construct(
    public QualifiedName $name,
    public Query $query,
    list<ListedColumn>|null $columns = null,
    public bool $temporary = false,
    public bool $ifNotExists = false,
)

Parameters

$nameQualifiedNameThe view name
$queryQueryThe query the view stands for
$columnslist<ListedColumn>|nullThe column list; null when none is written, otherwise at least one
$temporaryboolWhether TEMP or TEMPORARY is written
$ifNotExistsboolWhether IF NOT EXISTS is written
Calls 3
public function deriveStatement(Derivation $derivation): void
public function render(Output $out): void

Writes the definition.

Parameters

$outOutput
Calls 4

Test cases 5§

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 4

Relations§

Instantiated in 1
Type declarations 1