-
Notifications
You must be signed in to change notification settings - Fork 27
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
in functionality is buggy. #37
Comments
I've uncovered this bug as well - a workaround is to place the in/nin predicate first, i.e. like this: The bug is caused by the utils.quote function which doesn't take into account that previous outValues are "taken" by previous operators. By placing the in/nin predicate first, the outValues correspond to the values actually meant for that operator. This probably won't make sense unless you check the actual code - see statements.js:buildOperator and utils.js:quote :) |
Bug: When an IN/NOT IN predicate is not the first to be added, the statements.js:buildOperator function includes the whole outValues array as values. How to reproduce: See the tests added. These will fail before this fix. Fix: The utils.js:quote function now takes the value being added as third parameter. When quoting an IN/NOT IN operator, the valuePos array starts at the correct index (outValues.length - value.length + 1).
Fixed in #48 |
Example:
{ 'field1.equals' : val, 'field2.in: [val2, val3] } will produce 'SELECT * from table where field1 = $1 AND field2 IN ($1, $2, $3)
The text was updated successfully, but these errors were encountered: