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

Commit 7ec28db2 by Sascha Depold

some formatting

1 parent 33ff3eb2
Showing with 7 additions and 5 deletions
...@@ -65,8 +65,9 @@ module.exports = (function() { ...@@ -65,8 +65,9 @@ module.exports = (function() {
, self = this , self = this
// add the inserted row id to the instance // add the inserted row id to the instance
if (this.callee && (this.sql.indexOf('INSERT INTO') == 0) && (results.hasOwnProperty('insertId'))) if (this.callee && (this.sql.indexOf('INSERT INTO') == 0) && (results.hasOwnProperty('insertId'))) {
this.callee[this.callee.__factory.autoIncrementField] = results.insertId this.callee[this.callee.__factory.autoIncrementField] = results.insertId
}
if (this.sql.indexOf('SELECT') == 0) { if (this.sql.indexOf('SELECT') == 0) {
// transform results into real model instances // transform results into real model instances
...@@ -79,13 +80,14 @@ module.exports = (function() { ...@@ -79,13 +80,14 @@ module.exports = (function() {
}) })
} }
if(this.options.plain) if(this.options.plain) {
result = (result.length == 0) ? null : result[0] result = (result.length === 0) ? null : result[0]
} else if(this.sql.indexOf('SHOW TABLES') == 0) { }
} else if(this.sql.indexOf('SHOW TABLES') === 0) {
result = Utils._.flatten(results.map(function(resultSet) { result = Utils._.flatten(results.map(function(resultSet) {
return Utils._.values(resultSet) return Utils._.values(resultSet)
})) }))
} else if((this.sql.indexOf('SHOW') == 0) || (this.sql.indexOf('DESCRIBE') == 0)) { } else if((this.sql.indexOf('SHOW') === 0) || (this.sql.indexOf('DESCRIBE') === 0)) {
result = results result = results
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!