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

Commit 7ec28db2 by Sascha Depold

some formatting

1 parent 33ff3eb2
Showing with 7 additions and 5 deletions
......@@ -65,8 +65,9 @@ module.exports = (function() {
, self = this
// 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
}
if (this.sql.indexOf('SELECT') == 0) {
// transform results into real model instances
......@@ -79,13 +80,14 @@ module.exports = (function() {
})
}
if(this.options.plain)
result = (result.length == 0) ? null : result[0]
} else if(this.sql.indexOf('SHOW TABLES') == 0) {
if(this.options.plain) {
result = (result.length === 0) ? null : result[0]
}
} else if(this.sql.indexOf('SHOW TABLES') === 0) {
result = Utils._.flatten(results.map(function(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
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!