-
Notifications
You must be signed in to change notification settings - Fork 128
Ignore empty values and expressions to prevent syntax error #190
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
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.
Sorry, totally missed this PR in in my notification. Really appreciate your effort to jump on this and fix it in a way that's cleaner than my approach was.
Not 100% sure that silently ignoring these conditions with no values is right approach. For NOT IN
I think that's fine, and yields the expected result, but for IN/ANY/SOME/ALL
, this may do the opposite of what a user expected.
sqlbuilder.List好像没有同步修改 |
@Sora233 嗯,下个版本补一下 |
Hello. I want to share my thoughts on suggestion made by @ErikBooijMB earlier. I fully agree that silent drop of Also its probably more predictable for user that almost same operators behave in the almost same way. if something is always What do you think about it? |
@rodionovv Sorry for late response. I missed your comment. If you have any feedback on a closed issue, you can either re-open it or create a new issue so that I can track it better.
Agree. I should fix it as a bug.
You're right. Let me know if you find more bad cases other than |
This PR is to address the issue that builders will generate bad SQL statements if empty values and/or expressions are provided.
For instance, if we build SQL like following, we will get a SQL statement with syntax error.
In this PR, if there is no values or expressions provided in
Cond.IN
/Cond.NotIn
/Cond.Some
/Cond.All
/Cond.Any
/Cond.And
/Cond.Or
, the condition will be ignored completely. Thus, the case above will printSELECT c FROM t
with this PR.It's a better solution to address the same issue mentioned in PR #188. cc @ErikBooijMB