-
Notifications
You must be signed in to change notification settings - Fork 355
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: fixed lower case for "IN" operator in queryFilters [DHIS2-11770] #8724
Conversation
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.
Looks good @gnespolino 👍
Thanks
Kudos, SonarCloud Quality Gate passed! |
@@ -63,13 +65,16 @@ public InQueryFilter( String field, QueryFilter queryFilter ) | |||
* @param encodedFilter actual "in" parameters | |||
* @return a SQL condition representing this InQueryFilter | |||
*/ | |||
public String getSqlFilter( String encodedFilter ) | |||
public String getSqlFilter( String encodedFilter, boolean isText ) |
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.
Please add a description to explain the initial problem and why this fixes it :-) My understanding is we already quote event analytics query filters but I might be wrong.
Looks good @gnespolino ! Thanks for the explanation/description. |
I think we could have added a few unit tests here, especially |
When we introduced possibility to include null values in filters, we needed to threat "IN" operator in a different way. Infact the way the code is structured didn't allow to render SQL condition properly when IN included also a null value.
In cases such ";IN;Female:NV", SQL condition needs to be "field IN (female) or field is null".
In this case a proper InQueryFilter class was written to be able to render condition properly. However all the work to encode and quote parameters properly, which came out of the box for other operators, need to be handled inside InQueryFilter to be effective. This PR addresses a missing quoting and escaping which was introduced when InQueryFilter was written.
This should go into 2.37.
Adding @Philip-Larsen-Donnelly for approval.