-
Notifications
You must be signed in to change notification settings - Fork 137
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
"table.column in Nil" causes MySQLSyntaxErrorException with MySQL #16
Comments
Dave, what behavior would you suggest for an in () ? Should the "in ()" be replace with an expression that evaluates to false ?, ex.: 1=2 ? |
Why not just omit the expression node? (The inhibition mechanism might be reusable) |
"in(Nil)" always evaluates to false (it is logically false), omitting the node would evaluate to true, woudln't that be problematic ? |
Well, there could be typed inhibitions, so that when "inhibit = Omissive" (bad naming, I know), the node is simply treated as if it would't change the query, and when "inhibit = Destructive", it is treated as if it would make the query not match. ("bar = 1 or foo in ()" should result in "bar = 1" using such transformations, since "or" can have one destructive operand) Using Kiama (http://code.google.com/p/kiama/) would also be an alternative, especially for query optimizations and clean-ups in general, but maybe a little overkill? |
Fixed as of : in () ---> always false (results in this condition being written : "(1 = 0)") notIn () ---> always true (inhibits the condition) |
This only works if its actually a list, if its an Iterable it appears to bypass this check and blows up. An example with Map.keys follows but it seems to happen with any iterable. Workaround is to call .toList on iterable before passing it to squeryl but I dont think it should compile with an iterable if its going to have a runtime fault like this.
Full Test Code at https://gist.github.com/795508 Tested against 0.9.4-RC2 and RC3 with mysql adapter. |
The "in" operator assumes that it will not receive an empty list as its argument, and fails when it does.
The text was updated successfully, but these errors were encountered: