0 follower

Final Class Yiisoft\Db\Sqlite\SqlParser

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

Public Methods

Hide inherited methods

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

Method Details

Hide inherited methods

getNextPlaceholder() public method

public string|null getNextPlaceholder ( integer|null &$position 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]),
            '[' => $this->sql[$this->position] === '['
                ? $this->skipToAfterString(']]')
                : $this->skipQuotedWithoutEscape(']'),
            '-' => $this->sql[$this->position] === '-'
                ? ++$this->position && $this->skipToAfterChar("\n")
                : null,
            '/' => $this->sql[$this->position] === '*'
                ? ++$this->position && $this->skipToAfterString('*/')
                : null,
            default => null,
        };
        if ($result !== null) {
            $position = $pos;
            return $result;
        }
    }
    return null;
}