Skip to content
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

fix: EXPOSED-257 Upsert incorrectly parameterizes non-literal WHERE arguments #1965

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

bog-walk
Copy link
Member

Currently when using upsert() with a where argument, only column expressions and literal values are being handled correctly in the PreparedStatement SQL.

Attempting to use a value that should be parameterized (by using param() functions or primitive types) results in an exception stating that the provided parameter count is incorrect.
This occurs because the where arguments are not correctly added to the list of statement arguments in the super class InsertStatement.

An arguments() override that includes these where arguments has now been added to the UpsertStatement class.

…guments

Currently when using upsert() with a where argument, only literal values generate
valid SQL. Attempting to use a value with a param() wrapper or the plain native
type results in an exception that the parameter count is incorrect.

This occurs because the where arguments were not correctly added to the list of
statement arguments in the super class, so an override has now been included in
UpsertStatement directly.
@bog-walk bog-walk requested review from e5l and joc-a January 12, 2024 00:52
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

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

lgtm

…rguments

Replace the not-null assertion operator in sub and super classes with Elvis operator.
@bog-walk bog-walk merged commit 29203d6 into main Jan 12, 2024
5 checks passed
@bog-walk bog-walk deleted the bog-walk/fix-upsert-where branch January 12, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants