can we use triggers in Node.js and MySQL ? for example I have in my database a table A. And when a user edit a record a message appear : " the table is modified"
any suggestion !? and thank you
can we use triggers in Node.js and MySQL ? for example I have in my database a table A. And when a user edit a record a message appear : " the table is modified"
any suggestion !? and thank you
It's technically possible to have a MySQL trigger call a user-defined function (UDF) that can contain a system call using sys_exec()
, for example. However this solution would be complicated and you would still need to have the client poll the server for changes if you want to display a message in near real-time.
Personally I wouldn't bother with using triggers and just have another process monitor for changes which I would then poll periodically. You could possibly check the table's last update time. The exact implementation would depend on the details of your database structure and how much traffic you need to handle.
Here is a similar question that has more discussion: Invoking a PHP script from a MySQL trigger