Skip to content
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

Where with bool or bool? is compiled as "true" or "false" rather than "0" or "1" #396

Closed
benmccallum opened this issue Jun 25, 2020 · 5 comments

Comments

@benmccallum
Copy link

Repro
Go here: https://sqlkata.com/playground/sqlserver
Paste this:

bool? lol = true;
bool lol2 = true;
var query = new Query("Users").Where("lol", lol).Where("lol2", lol2);

SQL Server doesn't support true/false, only 0 or 1

@benmccallum
Copy link
Author

Hmm, I believe maybe we're suppose to use WhereTrue or WhereFalse... Not 100% clear though. Could do with an example on the Where page of docs.

@benmccallum
Copy link
Author

I swear I've had this working before though... Could you confirm if it's a bug or not?

@benmccallum benmccallum reopened this Jun 25, 2020
@benmccallum
Copy link
Author

A workaround is to do a sneaky Convert.ToInt16(lol) in there, but this is a bit of a nasty regression if that's what it is. Could bite a lot of people.

@benmccallum
Copy link
Author

Maybe there could be a .WhereBooleanIs(true/false) extension method?

@ahmad-moussawi
Copy link
Contributor

I think this was solved by #510
check https://sqlkata.com/release/v2.3.8#whereboolean-is-now-identical-to-wheretrue-and-wherefalse
So it can be closed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants