enum ParameterSyntax
Public API: explicitly declared with @visibility public.

Which parameter markers a lexer reads as bound parameters.

A server has its own markers, such as ? or $1. A named placeholder, :name, is the other common way to bind a parameter in an application, and a server that has no such marker rejects it. The named syntax reads :name as a parameter where the server itself would not; a server that reads it already is unaffected.

Measuring a named placeholderdoctest
\SqlParser\Lexer\ParameterSyntax::Named->namedLength('WHERE id = :id', 11) // => 3
Reading nothing but the server's own markersdoctest
\SqlParser\Lexer\ParameterSyntax::Native->namedLength(':id', 0) // => 0

Cases§

case Native

Only the markers the server itself reads.

case Named

The server's markers and the named placeholder :name.

Methods§

public function namedLength(string $source, int $offset): int

Reports whether the text at an offset spells a named placeholder.

A name is : followed by letters, digits and underscores; :: and := are not names.

Parameters

$sourcestringThe SQL text
$offsetintWhere the colon is

Returns

int The length of the marker, or 0 when none starts there
Calls 3

Test cases 7§

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 4

Relations§

Constant reads 10
Type declarations 6