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

Listens to multiple changes? #33

Open
jyzhao opened this issue Jul 19, 2017 · 3 comments
Open

Listens to multiple changes? #33

jyzhao opened this issue Jul 19, 2017 · 3 comments

Comments

@jyzhao
Copy link

jyzhao commented Jul 19, 2017

I just want to double check if mysql-events supports monitoring multiple changes? For example, what happens if I do bulk insert/delete/update to the tables?

@spencerlambert
Copy link
Owner

It should work. I haven't done extensive testing with that use case. Please test it out and report back. Thanks!

@anusha9213
Copy link

Hi, I am writing a script to update a table.

Eg : I run a script to update 2 rows in a table

In node.js, my code is in the following way :

var dsn = {
  host:     'hostname',
  user:     'user',
  password: 'password',
  port     : '8080',
};
var mysqlEventWatcher = MySQLEvents(dsn);
var watcher =mysqlEventWatcher.add(
  'databse.table',
  function (oldRow, newRow, event) {
     //row inserted
console.log("Inside watcher");
//console.log(event);
console.log(event);
    if (oldRow === null) {
      //insert code goes here
    }
     //row deleted
    if (newRow === null) {
      //delete code goes here
    }
     //row updated
    if (oldRow !== null && newRow !== null) {
      //update code goes here
    }
	}
  }
);

The watcher is called two times .. and in both watchers the updated rows are shown. Please help !

@rodrigogs
Copy link

https://github.com/rodrigogs/mysql-events

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

4 participants