Skip to content

"In" and "NotIn" Conditions Render Incorrectly in Some Circumstances #239

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

Closed
jeffgbutler opened this issue Aug 27, 2020 · 0 comments · Fixed by #240
Closed

"In" and "NotIn" Conditions Render Incorrectly in Some Circumstances #239

jeffgbutler opened this issue Aug 27, 2020 · 0 comments · Fixed by #240
Labels
Milestone

Comments

@jeffgbutler
Copy link
Member

Currently the decision about whether or not to render an "In" or "NotIn" condition is made before any filter or map is applied to the value list. Then can cause incorrect rendering in some cases. For example, if a filter removes all items from a value list the condition will still render - yielding invalid SQL. For example, the following will render incorrectly:

SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
        .from(animalData)
        .where(id, isIn(null, 22, null).then(s -> s.filter(Objects::nonNull).filter(i -> i != 22)))
        .build()
        .render(RenderingStrategies.MYBATIS3);
@jeffgbutler jeffgbutler added this to the 1.2.1 milestone Aug 27, 2020
jeffgbutler added a commit that referenced this issue Aug 27, 2020
Apply value transform immediately on construction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant