-
-
Notifications
You must be signed in to change notification settings - Fork 13
Update test according to main PR #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0082f4f
Update test according to main PR
Tigrov 4335211
Merge branch 'master' into fix-update-with-expressions
Tigrov 14010bc
Apply Rector changes (CI)
Tigrov d5d285e
Adapt SqlParser to the driver
Tigrov 71c4f28
Merge remote-tracking branch 'origin/fix-update-with-expressions' int…
Tigrov c5f2bda
Merge branch 'master' into fix-update-with-expressions
Tigrov c22daa0
Revert "Apply Rector changes (CI)"
Tigrov 1816199
Disable Rector for ./tests directory
Tigrov e60186c
Fix psalm issue
Tigrov 1ec1e06
Update according main PR
Tigrov d6f3939
Add line to CHANGELOG.md [skip ci]
Tigrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\Db\Oracle\Builder; | ||
|
|
||
| use Yiisoft\Db\Expression\AbstractExpressionBuilder; | ||
| use Yiisoft\Db\Oracle\SqlParser; | ||
|
|
||
| final class ExpressionBuilder extends AbstractExpressionBuilder | ||
| { | ||
| protected function createSqlParser(string $sql): SqlParser | ||
| { | ||
| return new SqlParser($sql); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\Db\Oracle; | ||
|
|
||
| use Yiisoft\Db\Syntax\AbstractSqlParser; | ||
|
|
||
| final class SqlParser extends AbstractSqlParser | ||
| { | ||
| public function getNextPlaceholder(int|null &$position = null): string|null | ||
| { | ||
| $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->skipToAfterChar('"'), | ||
| "'" => $this->skipQuotedWithoutEscape($this->sql[$pos]), | ||
| 'q', 'Q' => $this->sql[$this->position] === "'" | ||
| ? $this->skipQuotedWithQ() | ||
| : null, | ||
| '-' => $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; | ||
| } | ||
|
|
||
| /** | ||
| * Skips quoted string with Q-operator. | ||
| */ | ||
| private function skipQuotedWithQ(): void | ||
| { | ||
| $endChar = match ($this->sql[++$this->position]) { | ||
| '[' => ']', | ||
| '<' => '>', | ||
| '{' => '}', | ||
| '(' => ')', | ||
| default => $this->sql[$this->position], | ||
| }; | ||
|
|
||
| ++$this->position; | ||
|
|
||
| $this->skipToAfterString("$endChar'"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\Db\Oracle\Tests\Provider; | ||
|
|
||
| class SqlParserProvider extends \Yiisoft\Db\Tests\Provider\SqlParserProvider | ||
| { | ||
| public static function getNextPlaceholder(): array | ||
| { | ||
| return [ | ||
| ...parent::getNextPlaceholder(), | ||
| [ | ||
| "name = q'':name'' AND age = :age", | ||
| ':age', | ||
| 28, | ||
| ], | ||
| [ | ||
| "name = Q'':name'' AND age = :age", | ||
| ':age', | ||
| 28, | ||
| ], | ||
| [ | ||
| "name = Q'[:name]' AND age = :age", | ||
| ':age', | ||
| 28, | ||
| ], | ||
| [ | ||
| "name = Q'!':name'!' AND age = :age", | ||
| ':age', | ||
| 30, | ||
| ], | ||
| ]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Yiisoft\Db\Oracle\Tests; | ||
|
|
||
| use Yiisoft\Db\Oracle\SqlParser; | ||
| use Yiisoft\Db\Tests\AbstractSqlParserTest; | ||
|
|
||
| /** | ||
| * @group oracle | ||
| */ | ||
| final class SqlParserTest extends AbstractSqlParserTest | ||
| { | ||
| protected function createSqlParser(string $sql): SqlParser | ||
| { | ||
| return new SqlParser($sql); | ||
| } | ||
|
|
||
| /** @dataProvider \Yiisoft\Db\Oracle\Tests\Provider\SqlParserProvider::getNextPlaceholder */ | ||
| public function testGetNextPlaceholder(string $sql, string|null $expectedPlaceholder, int|null $expectedPosition): void | ||
| { | ||
| parent::testGetNextPlaceholder($sql, $expectedPlaceholder, $expectedPosition); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.