-
Notifications
You must be signed in to change notification settings - Fork 10
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: simple quotes escape in queries #1227
Conversation
Test Results 62 files ±0 62 suites ±0 1m 29s ⏱️ +3s Results for commit 549e591. ± Comparison against base commit 7d9c62f. This pull request removes 217 and adds 67 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
|
I tried using |
Please give some details |
I used the method like this :
and still got the same error : |
Did you try passing the value as a named parameter in the jsonb path function? (Like is done for some other queries) |
I didn't understand your suggestion well |
instead of doing:
doing something like this (wondering if in this case the PG query parser will process the
|
I got the same error :
|
too bad. |
'{ "value": ${value.replace( | ||
"'", | ||
"''" | ||
)}}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- the indentation is weird
- there are already some extension functions used here (like
String.quote()
), cleaner to add a new one for this escaping
@thomasBousselin your review is missing |
@@ -176,18 +179,27 @@ private fun transformQQueryToSqlJsonPath( | |||
jsonb_path_exists(#{TARGET}#, | |||
'$."${mainAttributePath[0]}"."$NGSILD_PROPERTY_VALUE".$jsonTrailingPath.**{0 to 1}."$JSONLD_VALUE" ? | |||
(@ $operator ${'$'}value)', | |||
'{ "value": $value }') | |||
'{ "value": ${value.replace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use this in multiple places you may want to create an escapeQuote() function.
4e4a2ad
to
549e591
Compare
Quality Gate passedIssues Measures |
I based my branch on the refactoring branch