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

You need to sign in or sign up before continuing.
Commit 42706422 by Sascha Depold

Pass the uuid as a second parameter to the sql event

1 parent cfc66e9e
...@@ -24,7 +24,7 @@ module.exports = (function() { ...@@ -24,7 +24,7 @@ module.exports = (function() {
} }
this.client.query(this.sql, function(err, results, fields) { this.client.query(this.sql, function(err, results, fields) {
this.emit('sql', this.sql) this.emit('sql', this.sql, this.options.uuid)
if (err) { if (err) {
err.sql = sql err.sql = sql
...@@ -38,5 +38,3 @@ module.exports = (function() { ...@@ -38,5 +38,3 @@ module.exports = (function() {
return Query return Query
})() })()
...@@ -38,12 +38,12 @@ module.exports = (function() { ...@@ -38,12 +38,12 @@ module.exports = (function() {
query.on('error', function(err) { query.on('error', function(err) {
receivedError = true receivedError = true
err.sql = sql err.sql = sql
self.emit('sql', sql) self.emit('sql', sql, self.options.uuid)
self.emit('error', err, self.callee) self.emit('error', err, self.callee)
}) })
query.on('end', function(result) { query.on('end', function(result) {
self.emit('sql', self.sql) self.emit('sql', self.sql, self.options.uuid)
if (receivedError) { if (receivedError) {
return return
......
...@@ -36,13 +36,13 @@ module.exports = (function() { ...@@ -36,13 +36,13 @@ module.exports = (function() {
if (self.sql.indexOf('-- ') === 0) { if (self.sql.indexOf('-- ') === 0) {
// the sql query starts with a comment. don't bother the server with that ... // the sql query starts with a comment. don't bother the server with that ...
Utils.tick(function() { Utils.tick(function() {
self.emit('sql', self.sql) self.emit('sql', self.sql, self.options.uuid)
self.emit('success', null) self.emit('success', null)
}) })
} else { } else {
self.database[getDatabaseMethod.call(self)](self.sql, function(err, results) { self.database[getDatabaseMethod.call(self)](self.sql, function(err, results) {
// allow clients to listen to sql to do their own logging or whatnot // allow clients to listen to sql to do their own logging or whatnot
self.emit('sql', self.sql) self.emit('sql', self.sql, self.options.uuid)
if (err) { if (err) {
err.sql = self.sql err.sql = self.sql
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!