classSubscript
final class Subscript
implements IndirectionStep
uses Snapshot
Public API: explicitly declared with
@visibility public.The indirection step [ index ]: one element of an array, or of another subscriptable value.
Mirrors an A_Indices item with is_slice false. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-EXPRESSIONS-SUBSCRIPTS.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT $1[2]');
$query->field(0)->expression->steps[0]->index->value->digits // => '2'Properties§
public Scalar $indexMethods§
public function __construct(public Scalar $index)Parameters
$index | Scalar | The subscript |
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the subscript.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Calls 1
- method-call Derivation::scalar() line 50
public function render(Output $out): voidWrites the subscript in brackets.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::symbol() line 58
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 6
PrimaryRuleTest::testBoundOfAnOmittedBoundIsNullcallsSubscriptingTest::testApplyReadsTheElementOfAnArraycallsSubscriptingTest::testApplyReportsAStarBeforeAnotherStepcallsSubscriptingTest::testSubscriptKeepsTheArrayForASlicecallsIndirectionTest::testOutputNameIsTheLastSelectedFieldcallsIndirectionTest::testRenderWritesTheBaseAndTheStepscalls