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

Commit f81baf52 by reedog117

resolved error trying to retrieve insertId

1 parent 1cd73a5e
......@@ -37,8 +37,6 @@ module.exports = (function() {
//console.log('error in result-loop for: ' + self.sql)
errorDetected = true
self.emit('sql', this.sql)
console.log('Failed query : ' + this.sql)
console.log(err)
self.emit('error', err, this.callee)
}.bind(this))
.on('end', function(info) {
......@@ -48,21 +46,20 @@ module.exports = (function() {
return
}
self.emit('sql', this.sql)
console.log('Successful query : ' + this.sql)
// we need to figure out whether to send the result set
// or info depending upon the type of query
if( /^show/.test(this.sql.toLowerCase()) ||
/^select/.test(this.sql.toLowerCase()) ||
/^describe/.test(this.sql.toLowerCase()) ) {
console.log('results : ')
console.log(resultSet)
//console.log('formatted resultset: ' + JSON.stringify(this.formatResults(resultSet)))
// console.log('results : ')
// console.log(resultSet)
// console.log('formatted resultset: ' + JSON.stringify(this.formatResults(resultSet)))
self.emit('success', this.formatResults(resultSet))
} else {
console.log('results : ')
// console.log('results : ')
info = JSON.parse(JSON.stringify(info))
console.log(info)
// console.log(info)
//console.log('formatted resultset: ' + JSON.stringify(this.formatResults(info)))
self.emit('success', this.formatResults(info))
}
......@@ -80,8 +77,8 @@ module.exports = (function() {
self.emit('error', err, this.callee)
console.log('query error')
}.bind(this))
.on('end', function(info) {
// nothing here yet
.on('end', function() {
// nothing here (query info is returned during the 'result' event)
}.bind(this)).setMaxListeners(100)
return this
......
......@@ -29,9 +29,6 @@ module.exports = (function() {
if (err) {
this.emit('error', err, this.callee)
} else {
console.log('sql : ' + this.sql)
console.log('resultset : ' + JSON.stringify(results))
console.log('formatted resultset: ' + JSON.stringify(this.formatResults(results)))
this.emit('success', this.formatResults(results))
}
}.bind(this)).setMaxListeners(100)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!