node-mariasql
node-mariasql copied to clipboard
How to listen database table insert, update and delete event.
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.
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
For MySQL/MariaDB about your only option would be to have a binlog "tailer"/parser. See for example mysql-live-select/zongji.