Answer the question
In order to leave comments, you need to log in
How to implement actions in C++ when changing data in a MySQL table?
There is a smart home project on the Raspberry Pi, a Java program for Android was written for it, it sends a request to the MySQL table at the touch of a button and changes it, and the C ++ daemon (which will be installed on the Raspberry pi) must poll the table for changes, and when they are detected, it should send signals to the GPIO (Raspberry pi pins), I figured out how to send signals to the GPIO (which will control the relay, etc.), but I did not find information on how to make them send only when the table changes (I was looking for everywhere: StackOverflow and the like)
Answer the question
In order to leave comments, you need to log in
Use MySQL Connector/C++ to connect to mysql and send queries, do whatever you want based on the responses.
If the Java program is not available for change, then you can try to cheat with a trigger in MySQL, which will write to the add. change log table, which you can then read.
Not exactly an answer to the question, but it seems that a solution through MQTT is more suitable. Everyone who subscribes to a particular topic will be instantly informed about the change. For android, there are already ready-made clients in the market. There are plenty of examples for raspberry - you can implement it in any language.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question