Skip to content

Fixed case where operators containing question mark were erroneously substituted by the parameter parser #40

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 3 commits into from
Jan 28, 2021

Conversation

Bilge
Copy link
Contributor

@Bilge Bilge commented Jan 20, 2021

Fixes #39.

'Bare' => ['SELECT ?', 'SELECT $1'],
'Parenthesized' => ['SELECT (?)', 'SELECT ($1)'],
'Row constructor' => ['SELECT (?, ?)', 'SELECT ($1, $2)'],
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint: Yield could be used here, but I think there's no need yet for readability.

*/
public function testParseJsonbOperator(): void
public function testParseProblematicOperators(string $sql): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test cases can be merged into one test method, as the problematic ones shouldn't be problematic after the fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what benefit? Two distinct sets is clearer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better overview, after all it's one test-set that needs to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot see the benefit of combining test cases that perform substitutions with test cases that do not. They are complete opposites. As such it would be unconscionable for me to make such a change, but obviously you can still make whatever changes you want after merging since it is your project.

@Bilge Bilge changed the title Added failing test case for JSONB operator parsed as parameter Fixed case where operators containing question mark were erroneously substituted by the parameter parser Jan 22, 2021
@trowski
Copy link
Member

trowski commented Jan 27, 2021

@Bilge I get several tests failing due to the regex not providing the matches expected.

Restored capturing groups in parameter parser regex.
@trowski trowski merged commit 6b1cea3 into amphp:master Jan 28, 2021
@Bilge Bilge deleted the jsonb-operator branch May 25, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Question mark operators interpreted as unnamed parameters
3 participants