Skip to content

Implement Callback for In and NotIn Conditions When the Value List is Empty #241

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 9 commits into from
Aug 27, 2020

Conversation

jeffgbutler
Copy link
Member

For the "In" and "NotIn" conditions, when the value list is empty the library will drop the condition from the rendered SQL. This keeps the library from rendering invalid SQL.

This PS implements a new callback that provides an extension point where a user could take an action - such as throwing an exception - if the list is empty.

This PR also removes the option that would force the library to render invalid SQL introduced with #228

The case insensitive in conditions are actually
specializations of the regular in conditions and not
intended to be extended.
# Conflicts:
#	src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java
#	src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java
#	src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java
#	src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java
@jeffgbutler jeffgbutler added this to the 1.2.1 milestone Aug 27, 2020
@coveralls
Copy link

coveralls commented Aug 27, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling fb27186 on jeffgbutler:implement-empty-callback into 66cda22 on mybatis:master.

@jeffgbutler jeffgbutler merged commit 5afc029 into mybatis:master Aug 27, 2020
@jeffgbutler jeffgbutler deleted the implement-empty-callback branch August 27, 2020 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants