Merge pull request #335 from wbyoung/debug-flag

Allow debug flag to be a function.
This commit is contained in:
Tim Griesser 2014-06-22 14:50:52 -04:00
commit 712786bf95

View File

@ -28,12 +28,17 @@ Runner.prototype.run = Promise.method(function() {
.then(this.ensureConnection)
.then(function(connection) {
this.connection = connection;
this.client.emit('start', this.builder);
this.builder.emit('start');
var sql = this.builder.toSQL();
if (_.isArray(sql)) {
return this.queryArray(sql);
}
return this.query(sql);
})
.tap(function() {
this.builder.emit('end');
})
.finally(this.cleanupConnection);
});