How can i notify my C or C++ application program when an update or changes happens in mysql database. Are there any special libraries serving this purpose?
There isn't one out-of-the-box feature in MySQL to do this. But it is definitely possible. The following is not a step-by-step instruction, but rather the route to take.
Create a UDF (user-defined function) for MySQL that does something that you can catch with your application, e.g. send a message over network. Here is an example of an UDF that can send STOMP messages. I'm sure you can adapt that to meet your needs.
Implement the corresponding "receive messages" functionality into your application. For example, if your UDF sends messages over a socket, make your application listen to that socket.
Create a trigger that fires on the events that you're trying to catch (e.g. certain UPDATEs). This trigger can call your UDF from step 1 to send messages to your application (which you'll receive thanks to step 2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With