make a socket server to detect changes in mysql code example
Example: make a socket server to detect changes in mysql
var MySQLEvents = require('mysql-events');
var dsn = {
host: _dbhostname_,
user: _dbusername_,
password: _dbpassword_,
};
var mysqlEventWatcher = MySQLEvents(dsn);
var watcher =mysqlEventWatcher.add(
'myDB.table.field.value',
function (oldRow, newRow, event) {
if (oldRow === null) {
}
if (newRow === null) {
}
if (oldRow !== null && newRow !== null) {
}
},
'match this string or regex'
);