Answers for "make a socket server to detect changes in mysql"

SQL
0

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) {
     //row inserted 
    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 
    }

    //detailed event information 
    //console.log(event) 
  }, 
  'match this string or regex'
);
Posted by: Guest on April-15-2021

Code answers related to "make a socket server to detect changes in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language