mysql-events
mysql-events copied to clipboard
Listens to multiple changes?
trafficstars
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?
It should work. I haven't done extensive testing with that use case. Please test it out and report back. Thanks!
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 !
https://github.com/rodrigogs/mysql-events