mysql-live-select
mysql-live-select copied to clipboard
Result sets no longer update
node -v: 4.4.7 mysql-live-select: 1.1.9
Result sets do not update to console. Here is code to reproduce:
var LiveMysql = require('mysql-live-select');
var settings = {
host : 'localhost',
user : 'xxxxx',
password : 'xxxxx',
database : 'shoreware',
minInterval : 200,
port : 4308
};
var liveConnection = new LiveMysql(settings);
liveConnection.select(function(){
return (
'SELECT u.UserDN, u.GuiLoginName, u.LDAPGuid, u.LDAPDomainName, s.FirstName, t.EmailAddress, u.LastUpdateUTCTime, s.LastName, s.WorkPhone, s.CellPhone, s.FaxPhone, s.SiteName, d.Digits, CONCAT(SUBSTR(BasePhoneNumber,3,10 - CHAR_LENGTH(d.Digits)),d.Digits) AS DID FROM shoreware.users AS u JOIN shoreware.diddigitmap AS d ON u.UserDN = d.DN JOIN systemdirectorydisplay AS s ON u.UserDN = s.dn JOIN tabaddresses AS t ON u.AddressID = t.AddressID WHERE description IS NULL'
);
}, [ {
condition: function(row, newRow){
// Only refresh the results when the row matching the specified id is
// changed.
return row.id === id
// On UPDATE queries, newRow must be checked as well
|| (newRow && newRow.id === id);
}
} ]).on('update', function(diff, data){
// diff contains an object describing the difference since the previous update
// data contains an array of rows of the new result set
console.log(diff);
});