mysql-live-select
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -31,3 +31,3 @@ /* mysql-live-select, MIT License ben@latenightsketches.com | ||
if(self._select.length === 0) return; | ||
// Cache query results within this update event | ||
@@ -59,3 +59,3 @@ var eventResults = {}; | ||
_nextSelect(0); | ||
}); | ||
@@ -98,3 +98,5 @@ | ||
// Expose child constructor for prototype enhancements | ||
LiveMysql.LiveMysqlSelect = LiveMysqlSelect; | ||
module.exports = LiveMysql; |
{ | ||
"name": "mysql-live-select", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Live updating MySQL SELECT statements", | ||
@@ -5,0 +5,0 @@ "main": "lib/LiveMysql.js", |
@@ -1,2 +0,2 @@ | ||
# mysql-live-select | ||
# mysql-live-select [![Build Status](https://travis-ci.org/numtel/mysql-live-select.svg)](https://travis-ci.org/numtel/mysql-live-select) | ||
@@ -3,0 +3,0 @@ NPM Package to provide events when a MySQL select statement result set changes. |
@@ -15,2 +15,3 @@ /* mysql-live-select, MIT License ben@latenightsketches.com | ||
self.ready = false; | ||
self.testCount = 0; | ||
@@ -49,2 +50,12 @@ // Log all queries | ||
Connector.prototype.closeIfInactive = function(interval){ | ||
var self = this; | ||
var startCount = self.testCount; | ||
setTimeout(function(){ | ||
if(startCount === self.testCount){ | ||
self.conn.end(); | ||
} | ||
}, interval); | ||
}; | ||
module.exports = Connector; |
@@ -0,1 +1,3 @@ | ||
var callbackDelay = process.env.QUERY_DELAY || 800; | ||
// Execute a sequence of queries on a node-mysql database connection | ||
@@ -22,3 +24,5 @@ // @param {object} connection - Node-Mysql Connection, Connected | ||
}else{ | ||
callback(results); | ||
setTimeout(function(){ | ||
callback(results); | ||
}, callbackDelay); | ||
} | ||
@@ -25,0 +29,0 @@ }); |
@@ -10,2 +10,10 @@ /* mysql-live-select, MIT License ben@latenightsketches.com | ||
module.exports = { | ||
setUp: function(done){ | ||
server.testCount++; | ||
done(); | ||
}, | ||
tearDown: function(done){ | ||
server.closeIfInactive(1000); | ||
done(); | ||
}, | ||
basic: function(test){ | ||
@@ -12,0 +20,0 @@ var table = 'basic'; |
@@ -9,1 +9,9 @@ module.exports = { | ||
}; | ||
if(process.env.TRAVIS){ | ||
// Travis CI database root user does not have a password | ||
module.exports.password = ''; | ||
// Port to use is passed as variable | ||
module.exports.port = process.env.TEST_MYSQL_PORT; | ||
} | ||
89203
35
2038