Skip to content

Commit 4f19b0f

Browse files
committed
Allows db.query({ sql: "..." }, [ val1, ... ], cb); (#390)
When sql was an object, the second argument was assumed as being callback instead of checking if it could be the values.
1 parent b32e21d commit 4f19b0f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Connection.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ Connection.createQuery = function(sql, values, cb) {
2929
if (typeof sql === 'object') {
3030
// query(options, cb)
3131
options = sql;
32-
cb = values;
32+
if (typeof values === 'function') {
33+
cb = values;
34+
} else {
35+
options.values = values;
36+
}
3337
} else if (typeof values === 'function') {
3438
// query(sql, cb)
3539
cb = values;

0 commit comments

Comments
 (0)