Skip to content

Commit 12e3433

Browse files
committed
squash
1 parent 68cdb82 commit 12e3433

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

lib/Connection.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,22 @@ Connection.createQuery = function createQuery(sql, values, callback) {
3232

3333
if (typeof sql === 'function') {
3434
cb = wrapCallbackInDomain(null, sql);
35-
return new Query(options, cb);
36-
}
37-
38-
if (typeof sql === 'object') {
39-
options = sql;
35+
} else if (typeof sql === 'object') {
36+
options = Object.create(sql);
4037

4138
if (typeof values === 'function') {
4239
cb = wrapCallbackInDomain(null, values);
4340
} else if (values !== undefined) {
44-
options = Object.create(sql, {
45-
values: {
46-
value: values
47-
}
48-
});
41+
Object.defineProperty(options, 'values', { value: values });
4942
}
43+
} else {
44+
options.sql = sql;
5045

51-
return new Query(options, cb);
52-
}
53-
54-
options.sql = sql;
55-
options.values = values;
56-
57-
if (typeof values === 'function') {
58-
cb = wrapCallbackInDomain(null, values);
59-
options.values = undefined;
46+
if (typeof values === 'function') {
47+
cb = wrapCallbackInDomain(null, values);
48+
} else if (values !== undefined) {
49+
options.values = values;
50+
}
6051
}
6152

6253
if (cb === undefined && callback !== undefined) {

0 commit comments

Comments
 (0)