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

Commit f292f17a by Sascha Depold

default options for sequelize.query is now { raw: true }.

this change enables the comfortable use of sequelize.query. it's now no longer necessary to define the second and third parameter but only the first one which represents the actual sql query :)
1 parent 40c205f5
Showing with 10 additions and 1 deletions
......@@ -117,7 +117,8 @@ module.exports = (function() {
}
Sequelize.prototype.query = function(sql, callee, options) {
options = Utils._.extend(Utils._.clone(this.options.query), options || {})
options = (arguments.length === 3) ? options : { raw: true }
options = Utils._.extend(Utils._.clone(this.options.query), options)
options = Utils._.extend(options, {
logging: this.options.hasOwnProperty('logging') ? this.options.logging : console.log
})
......
......@@ -42,5 +42,13 @@ describe('Sequelize', function() {
done()
})
})
it('executes a query if only the sql is passed', function(done) {
var sql = "INSERT INTO " + this.User.tableName + " (username) VALUES ('john')"
this.sequelize.query(sql).success(function(result) {
expect(result).toBeNull()
done()
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!