0 follower

Final Class Yiisoft\Db\Pgsql\SqlParser

InheritanceYiisoft\Db\Pgsql\SqlParser » Yiisoft\Db\Syntax\AbstractSqlParser

Public Methods

Hide inherited methods

Method Description Defined By
getNextPlaceholder() Yiisoft\Db\Pgsql\SqlParser

Constants

Hide inherited constants

Constant Value Description Defined By
IDENTIFIER_CHARS '$' . self::WORD_CHARS Yiisoft\Db\Pgsql\SqlParser

Method Details

Hide inherited methods

getNextPlaceholder() public method

public getNextPlaceholder( integer|null &$position null ): string|null
$position integer|null

                public function getNextPlaceholder(?int &$position = null): ?string
{
    $result = null;
    $length = $this->length - 1;
    while ($this->position < $length) {
        $pos = $this->position++;
        match ($this->sql[$pos]) {
            ':' => ($word = $this->parseWord()) === ''
                ? $this->skipChars(':')
                : $result = ':' . $word,
            '"', "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]),
            'e', 'E' => $this->sql[$this->position] === "'"
                ? ++$this->position && $this->skipQuotedWithEscape("'")
                : $this->skipIdentifier(),
            '$' => $this->skipQuotedWithDollar(),
            '-' => $this->sql[$this->position] === '-'
                ? ++$this->position && $this->skipToAfterChar("\n")
                : null,
            '/' => $this->sql[$this->position] === '*'
                ? ++$this->position && $this->skipToAfterString('*/')
                : null,
            // Identifiers can contain dollar sign which can be used for quoting. Skip them.
            '_','a', 'b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
            'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
            'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' => $this->skipIdentifier(),
            default => null,
        };
        if ($result !== null) {
            $position = $pos;
            return $result;
        }
    }
    return null;
}