final class SqlLexer
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Splits SQL into tokens without committing to one dialect's grammar.

Only enough structure is recognised to tell keywords, string bodies, comments and bind parameters apart, which is what reading a statement's kind, its tables and its placeholders needs. Anything unrecognised becomes a symbol.

Methods§

public function readToken(string $sql, int $offset, int $depth): SqlToken

The token starting at the given offset.

Parameters

$sqlstring
$offsetint
$depthint

Returns

Test cases 1
Called from 1
Calls 12
public function readComment(string $sql, int $offset): ?string

The comment starting at the offset, or null when none starts there.

Parameters

$sqlstring
$offsetint

Returns

?string
Test cases 1
Called from 1
Calls 1
public function readQuoted(string $sql, int $offset): ?string

The quoted run starting at the offset, or null when none starts there.

Parameters

$sqlstring
$offsetint

Returns

?string
Test cases 2
Called from 1
Calls 3
public function readParameter(string $sql, int $offset): ?string

The bind parameter starting at the offset, or null when none starts there.

Parameters

$sqlstring
$offsetint

Returns

?string
Test cases 1
Called from 1
Calls 1

Private surface 1§

Implementation details, listed for orientation only.

private const QUOTES = ["'" => "'", '"' => '"', '`' => '`', '[' => ']']

Test cases 20§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 9
Other tests reaching this symbol 11

Relations§

Instantiated in 3
Method calls 3
Type declarations 6