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

Commit f13e4e97 by Sascha Depold

fixed logic of #467 and added tests

1 parent 5992de73
Showing with 9 additions and 3 deletions
......@@ -140,10 +140,9 @@ module.exports = (function() {
this.getMigrator().migrate(options)
}
Sequelize.prototype.query = function(sql, callee, options) {
Sequelize.prototype.query = function(sql, callee, options, replacements) {
if (arguments.length === 4) {
values.unshift(sql)
sql = Utils.format(values)
sql = Utils.format([sql].concat(replacements))
} else if (arguments.length === 3) {
options = options
} else if (arguments.length === 2) {
......
......@@ -144,6 +144,13 @@ describe(Helpers.getTestDialectTeaser("Sequelize"), function() {
done()
})
})
it('replaces token with the passed array', function(done) {
this.sequelize.query('select ? as foo, ? as bar', null, { raw: true }, [ 1, 2 ]).success(function(result) {
expect(result).toEqual([{ foo: 1, bar: 2 }])
done()
})
})
})
describe('define', function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!