node-mariasql icon indicating copy to clipboard operation
node-mariasql copied to clipboard

How to listen database table insert, update and delete event.

Open manojsharma20 opened this issue 9 years ago • 2 comments

Hi,

I am having a requirement that whenever a record inserted into table a notification should go to the client that there is a new entry in the table with record. just like trigger work. I want it to be in nodejs.

Record can be inserted from backend and the notification should go to the client.

manojsharma20 avatar Nov 24 '16 06:11 manojsharma20

I don't think such an automatic option exists in Maria/MySQL. Your options would be

  • To fire the notification yourself if your code is doing the insert
  • Poll the table for new entries
  • Use something other then MariaDB - I think RethinkDB supports this

avnersorek avatar Nov 24 '16 09:11 avnersorek

For MySQL/MariaDB about your only option would be to have a binlog "tailer"/parser. See for example mysql-live-select/zongji.

mscdex avatar Nov 24 '16 11:11 mscdex