classPosition
final class Position
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A call of POSITION(substring IN string): the position of the first occurrence, 0 when there is none.
Rule: MYSQL-POSITION-CALL-001. The server builds LOCATE(substring, string): an integer that is NULL when an argument is. The substring is an arithmetic operand (bit_expr) that ends before IN; an operand that would absorb IN needs a grouping and is refused. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_position. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT POSITION('b' IN 'abc')");
$query->field(0)->type->descriptor->name() // => 'BIGINT'Properties§
public Scalar $substringpublic Scalar $stringMethods§
public function __construct(public Scalar $substring, public Scalar $string)Parameters
$substring | Scalar | The string to find; an arithmetic operand |
$string | Scalar | The string to search |
Calls 6
- new Precedence line 44
- static-call Check::input() line 45
- method-call Precedence::admits() line 45
- class-const Precedence::BIT_EXPR() line 45
- method-call Precedence::absorbs() line 45
- class-const Precedence::PREDICATE() line 45
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operands; the result is an integer.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call ResultTyping::fact() line 53
- new ResultTyping line 53
- method-call Arguments::one() line 53
- new Arguments line 53
public function render(Output $out): voidTest cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.