How to perform actions in C++ when you change data in a MySQL table?

There is a "smart house" project on the Raspberry Pi, for him, a program was written in Java under Android, it by pressing the button sends a query to MySQL table and changes her and Damon in C++ (that will stand for Raspberry pi) needs to poll the table for changes, and when detected, should give signals to the GPIO (pins of the Raspberry pi) how to apply the signals on the GPIO (which will drive relays, etc) I figured out, but how to get them to go only if you change the table I found ( they searched everywhere, StackOverflow, etc.)
March 19th 20 at 08:39
3 answers
March 19th 20 at 08:41
Use MySQL Connector/C++ to connect to mysql and send queries based on the answers, do what you need.
> but how to get them to go only if you change the table I have not found
how does your response answer this question?) - Fredy.Kertzma commented on March 19th 20 at 08:44
March 19th 20 at 08:43
If the Java program is not available to change, then you can try to hit with a trigger in MySQL that will write to an additional table logs changes then you will be able to deduct.
No, I have a project in Android studio and I can change the code of the program - Constantin commented on March 19th 20 at 08:46
@Constantin , then it would be good to connect directly to the daemon in C++ that it wrote to the table. - Fredy.Kertzma commented on March 19th 20 at 08:49
March 19th 20 at 08:45
Not quite the answer to the question, but here it seems that the more appropriate solution using MQTT. Everyone who is subscribed to a particular topic will be instantly informed of the change. For Android already have customers in the market. For raspberyy is full of examples in any language to implement.

Find more questions by tags Smart homeC++MySQL