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

Commit f81baf52 by reedog117

resolved error trying to retrieve insertId

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