Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result sets no longer update #26

Open
CiscoKidxx opened this issue Aug 6, 2016 · 0 comments
Open

Result sets no longer update #26

CiscoKidxx opened this issue Aug 6, 2016 · 0 comments

Comments

@CiscoKidxx
Copy link

CiscoKidxx commented Aug 6, 2016

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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant