不要怂,就是干,撸起袖子干!

You need to sign in or sign up before continuing.
Commit a42b38b7 by Jan Aagaard Meier

bug(getwherecond) Fix a bug where passing null as the second parameter to would fail Closes #4334

1 parent fd426d7c
# Next
- [FIXED] Fall back to a default version when parsing the DB version fails [#4368](https://github.com/sequelize/sequelize/issues/4368)
- [FIXED] Fix a bug where passing null as the second parameter to `sequelize.where` would fail [#4334](https://github.com/sequelize/sequelize/issues/4334)
# 3.6.0
- [ADDED] Model.findCreateFind: A more performant findOrCreate that will not work under a transaction (atleast not in postgres)
......
......@@ -1708,7 +1708,7 @@ var QueryGenerator = {
key = this.quoteTable(smth.attribute.Model.name) + '.' + this.quoteIdentifier(smth.attribute.field || smth.attribute.fieldName);
}
if (value._isSequelizeMethod) {
if (value && value._isSequelizeMethod) {
value = this.getWhereConditions(value, tableName, factory, options, prepend);
result = (value === 'NULL') ? key + ' IS NULL' : [key, value].join(smth.comparator);
......
......@@ -682,4 +682,18 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
});
});
});
suite('getWhereConditions', function () {
var testsql = function (value, expectation) {
var User = current.define('user', {});
test(util.inspect(value, {depth: 10}), function () {
return expectsql(sql.getWhereConditions(value, User.tableName, User), expectation);
});
};
testsql(current.where(current.fn('lower', current.col('name')), null), {
default: "lower([name]) IS NULL"
});
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!