Skip to content

Commit f3e77c1

Browse files
committed
Delay implied connect until after .query argument validation
1 parent 32c0c78 commit f3e77c1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Changes.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This file is a manually maintained list of changes for each release. Feel free
44
to add your changes here when sending pull requests. Also send corrections if
55
you spot any mistakes.
66

7+
## HEAD
8+
9+
* Delay implied connect until after `.query` argument validation
10+
711
## v2.6.2 (2015-04-14)
812

913
* Fix `Connection.createQuery` for no SQL #1058

lib/Connection.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ Connection.prototype.rollback = function rollback(options, callback) {
180180
return this.query(options, callback);
181181
};
182182

183-
Connection.prototype.query = function(sql, values, cb) {
184-
this._implyConnect();
185-
183+
Connection.prototype.query = function query(sql, values, cb) {
186184
var query = Connection.createQuery(sql, values, cb);
187185
query._connection = this;
188186

@@ -194,6 +192,8 @@ Connection.prototype.query = function(sql, values, cb) {
194192
query.sql = this.format(query.sql, query.values);
195193
}
196194

195+
this._implyConnect();
196+
197197
return this._protocol._enqueue(query);
198198
};
199199

0 commit comments

Comments
 (0)