-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
SqlBuilder OR clause #573
Comments
This does seem to be an issue prevalent within the code base. See line 146 of SqlBuilder.cs:
|
Fix #573 - OrWhere yielding AndWhere statement
I would disagree that it was really a bug - with the previous code, if you call both Where and OrWhere multiple times, the final result was like this: |
I'm inclined to disagree, the function is literally called 'OrWhere', not 'AndWhere'. Pretty sure you can still use the regular .Where function to achieve what you wanted. |
It doesn't really matter if I can achieve the same effect using the regular .Where(). |
I guess no one bothered to check the original test case. It is still not "fixed":
@rafakwolf expected:
However both the previous and fixed SqlBuilder produces the following:
This is because only the first call to one of Consider this: with the "fix" we get the following behavior (imagine these are in separate functions that don't know about each other):
result:
But switch the order of the calls:
result:
And that is what I would call a bug. As a side comment, with the previous code it was at least consistent in that it always produced the first result irrespective of order. |
The SqlBuilder seems to be adding "OR" clause the wrong way...
are adding "AND" instead of "OR".
results this statement:
WHERE MyField = @Nome AND MyField2 = @Param2
Thanks
The text was updated successfully, but these errors were encountered: