mini\Database\PartialQuery::wrapInSelect()
Method
private
Signature
private function wrapInSelect(mini\Parsing\SQL\AST\ASTNode $node): mini\Parsing\SQL\AST\SelectStatement|mini\Parsing\SQL\AST\WithStatement
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$node |
mini\Parsing\SQL\AST\ASTNode |
required | Documentation missing |
Returns
mini\Parsing\SQL\AST\SelectStatement|mini\Parsing\SQL\AST\WithStatement
Documentation
Wrap an AST node in a SELECT * FROM (...) AS alias
Uses the source table name as alias if the inner query is a simple single-table SELECT, otherwise falls back to '_q'.
CTEs are "bubbled up" - if the inner node is a WithStatement, the CTEs are extracted and wrapped around the outer SELECT, since WITH clauses cannot appear inside subqueries in SQL.