classCreateVirtualTable
final class CreateVirtualTable
implements Statement
uses Snapshot
@visibility public.A request to create a virtual table: a table whose rows and columns a module provides.
Rule: SQLITE-CREATE-VIRTUAL-TABLE-001. The module is named and receives the arguments as text (SQLITE-MODULE-ARGUMENT-001). The columns of the table, its hidden columns and whether it has a rowid are decided by the module when it is created, not by the statement: the statement provides a declaration of the table name without columns that is marked incomplete, so a use of the table depends on its missing member list. A module name that is not registered on the connection is not a fact of the model. A definition with empty parentheses and one without parentheses are the same request to SQLite; the model keeps which was written. Source: https://sqlite.org/lang_createvtab.html, https://sqlite.org/vtab.html. Status: Implemented.
$create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE VIRTUAL TABLE docs USING fts5(title, body)');
[$create->statement->module->value, count($create->statement->arguments), $create->declarations()[0]->complete] // => ['fts5', 2, false]Properties§
public list<ModuleArgument>|null $argumentspublic QualifiedName $namepublic Name $modulepublic bool $ifNotExists = falseMethods§
public function __construct(
public QualifiedName $name,
public Name $module,
list<ModuleArgument>|null $arguments = null,
public bool $ifNotExists = false,
)Parameters
$name | QualifiedName | The table name |
$module | Name | The module that implements the table |
$arguments | list<ModuleArgument>|null | The module arguments in order; null when no parentheses are written, otherwise at least one, possibly empty, argument |
$ifNotExists | bool | Whether IF NOT EXISTS is written |
Calls 3
- static-call Check::input() line 55
- static-call Check::listOf() line 56
- class-const ModuleArgument::class() line 56
public function deriveStatement(Derivation $derivation): voidProvides the declaration of the table name with an unknown column list.
Parameters
$derivation | Derivation |
Calls 2
- method-call Derivation::declare() line 64
- new Table line 64
public function render(Output $out): voidWrites the definition.
Parameters
$out | Output |
Calls 5
- method-call Output::keyword() line 72
- method-call ObjectNames::write() line 76
- new ObjectNames line 76
- class-const NameUse::Routine() line 77
- method-call Output::symbol() line 79
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.