Skip to content
Browse files

Fix regression preventing params from being an array. Closes #127

  • Loading branch information...
1 parent 0c42e8d commit 80ac7c912fa6b4cbbd6a7b643a848cfecc267155 @kunklejr kunklejr committed
Showing with 10 additions and 1 deletion.
  1. +4 −0 lib/driver/mysql.js
  2. +6 −1 test/driver/mysql_test.js
View
4 lib/driver/mysql.js
@@ -251,6 +251,10 @@ var MysqlDriver = Base.extend({
var sql = params.shift();
var callback = params.pop();
+ if (params.length > 0 && Array.isArray(params[0])) {
+ params = params[0];
+ }
+
return [sql, params, callback];
},
View
7 test/driver/mysql_test.js
@@ -354,10 +354,15 @@ driver.connect({ driver: 'mysql', database: 'db_migrate_test', user:'root' }, fu
}
}).addBatch({
'runSql': {
- 'accepts vararg parameters': function() {
+ 'accepts vararg parameters': function() {
db.runSql("SELECT 1 = ?, 2 = ?", 1, 2, function(err, data) {
assert.equal(data.length, 1);
});
+ },
+ 'accepts array parameters': function() {
+ db.runSql("SELECT 1 = ?, 2 = ?", [1, 2], function(err, data) {
+ assert.equal(data.length, 1);
+ });
}
}
}).addBatch({

1 comment on commit 80ac7c9

@kunklejr

Also closes #128

Please sign in to comment.
Something went wrong with that request. Please try again.