不要怂,就是干,撸起袖子干!

Commit 66ccb75e by Sascha Depold

use nested tables for mysql queries + throw additional data away if there was on…

…ly one selected table
1 parent ea694812
Showing with 5 additions and 1 deletions
...@@ -37,12 +37,16 @@ module.exports = (function() { ...@@ -37,12 +37,16 @@ module.exports = (function() {
this.options.logging('Executing: ' + this.sql) this.options.logging('Executing: ' + this.sql)
} }
this.client.query(this.sql, function(err, results, fields) { this.client.query({ sql: this.sql, nestTables: true }, function(err, results, fields) {
self.emit('sql', self.sql) self.emit('sql', self.sql)
if (err) { if (err) {
onFailure.call(self, err) onFailure.call(self, err)
} else { } else {
if (Array.isArray(results) && !!results[0] && Utils._.keys(results[0]).length === 1) {
results = results.map(function(result){ return Utils._.values(result)[0] })
}
onSuccess.call(self, results, fields) onSuccess.call(self, results, fields)
} }
}).setMaxListeners(100) }).setMaxListeners(100)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!