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

Commit 74c6753e by Sascha Depold

Merge pull request #124 from megshark/master

Added sql event to sqlite for logging
2 parents 2d3cdc4d b0cfb408
Showing with 4 additions and 1 deletions
...@@ -25,6 +25,9 @@ module.exports = (function() { ...@@ -25,6 +25,9 @@ module.exports = (function() {
, isUpdateCommand = (self.sql.toLowerCase().indexOf('update') == 0) , isUpdateCommand = (self.sql.toLowerCase().indexOf('update') == 0)
, databaseMethod = (isInsertCommand || isUpdateCommand) ? 'run' : 'all' , databaseMethod = (isInsertCommand || isUpdateCommand) ? 'run' : 'all'
//allow clients to listen to sql to do their own logging or whatnot
self.emit('sql', self.sql)
self.database[databaseMethod](self.sql, function(err, results) { self.database[databaseMethod](self.sql, function(err, results) {
err ? onFailure.call(self, err) : onSuccess.call(self, results, this) err ? onFailure.call(self, err) : onSuccess.call(self, results, this)
}) })
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"author": "Sascha Depold <sascha@depold.com>", "author": "Sascha Depold <sascha@depold.com>",
"contributors": [ "contributors": [
{ "name": "Sascha Depold", "email": "sascha@depold.com" }, { "name": "Sascha Depold", "email": "sascha@depold.com" },
{ "name": "Meg Sharkey" } { "name": "Meg Sharkey", "email": "meg@metamarkets.com" }
], ],
"dependencies": { "dependencies": {
"mysql": "0.9.x", "mysql": "0.9.x",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!