classCommonTable
final class CommonTable
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One common table expression: a named query, optionally with column names and a materialization hint.
Source: https://sqlite.org/lang_with.html.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('WITH c(x) AS (SELECT 1) SELECT x FROM c');
[$query->statement->with->tables[0]->name->value, $query->statement->with->tables[0]->columns[0]->name->value] // => ['c', 'x']Properties§
public list<ListedColumn> $columnspublic Name $namepublic Query $querypublic Materialization|null $materialization = nullMethods§
public function __construct(
public Name $name,
public Query $query,
list<ListedColumn> $columns = [],
public Materialization|null $materialization = null,
)Parameters
$name | Name | The table name |
$query | Query | The query |
$columns | list<ListedColumn> | The column names; none when the list is absent |
$materialization | Materialization|null | The written hint |
Calls 2
- static-call Check::listOf() line 43
- class-const ListedColumn::class() line 43
public function render(Output $out): voidWrites the definition.
Parameters
$out | Output |
Calls 5
- method-call Output::name() line 51
- class-const NameUse::Relation() line 51
- method-call Output::symbol() line 53
- method-call Output::keyword() line 55
- function-call
explodeline 57
Test cases 6§
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 5
WithRuleTest::testClauseKeepsTheCommonTablesInWrittenOrdercallsWithRuleTest::testTableLowersTheNameTheColumnsTheQueryAndTheMaterializationHintcallsListedColumnTest::testRenderWritesANewlyBuiltNamecallsWithQueryTest::testRenderWritesANewlyBuiltQuerycallsCreateTriggerTest::testRejectsAStepWithAWithClausecalls
Relations§
Instantiated in 1
Constant reads 1
Type checks 2
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::computing() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:171
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::rebound() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:178
Type declarations 4
- type SqlSemantics\Platform\Sqlite\Lowering\Query\WithRule packages/sql-semantics-sqlite/src/Lowering/Query/WithRule.php:75
- type SqlSemantics\Platform\Sqlite\Rules\Query\CommonTables packages/sql-semantics-sqlite/src/Rules/Query/CommonTables.php:100
- type SqlSemantics\Platform\Sqlite\Rules\Query\CommonTables packages/sql-semantics-sqlite/src/Rules/Query/CommonTables.php:115
- type SqlSemantics\Platform\Sqlite\Rules\Query\CommonTables packages/sql-semantics-sqlite/src/Rules/Query/CommonTables.php:128