final class SqlDelimitedReader

Reads what a pair of delimiters closes: strings and quoted identifiers.

Which byte opens a run, which one closes it, and whether a backslash escapes inside it are all the dialect's business, so they are asked of the profile. A dollar-quoted string is closed by the same tag that opened it and nothing inside it escapes, so it is read on its own terms.

Methods§

public function endOfDelimited(
    string $sql,
    int $offset,
    string $opening,
    string $closing,
    bool $backslashEscapes,
): int

Answers where a run closed by a delimiter ends.

A doubled closing delimiter is how SQL writes the delimiter itself, so it does not close the run. A run left unclosed at the end of the statement ends there, because there is nothing further to read.

Parameters

$sqlstringThe statement, as written
$offsetintWhere the opening delimiter is
$openingstringThe delimiter that opened the run
$closingstringThe delimiter that will close it
$backslashEscapesboolWhether a backslash escapes the byte after it

Returns

int The offset just past the closing delimiter
Test cases 6
Called from 2
Calls 2

Test cases 13§

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 4

Relations§

Instantiated in 1
Method calls 1
Type declarations 1