I am currently developing a Quote Generator for the office where I work using C++, QT and MYSQL. Ive mostly completed it, but I still consider myself a noob to C++ as I have not used it in years. Im using the QMYSQL driver and I have succesfully created this trigger in mysql database (CREATE TRIGGER new_quote_added
AFTER INSERT ON quotes
FOR EACH ROW INSERT INTO newquotes (quoteNUM, name) VALUES (NEW.quoteNUM, NEW.name)),
Im wondering if someone can give me some examples of how I can set up a listener to see this trigger and then publish a message to my systemtrayIcon that I have set up. My apologies if this is super basic but as I said Im new and havent found anyone else doing quite this. Thank you in advance for your help
MySQL has no Notify/Subscribe mechanism, unlike Postgres. So, you need to do polling on your desired table to keep track of inserts. You may also take a look at this implementation: https://github.com/Cyclonecode/mysql-notification It's creating an Http server and it sends notifications over a WebSocket connection. It would not fit into every use case because of lacking security considerations.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.