I need to call an external script from a trigger to intercept every insert in the DB. This because I can't poll for that value, I'm coding for an embedded system with ARM architecture and only 250MB of RAM. Trigger is the right options, and the code of the trigger works well, I get:
FUNCTION mydb.sys_exec does not exist (MySQL error code: 1305, SQLState: 42000 )
so I tried to install this: https://github.com/mysqludf/lib_mysqludf_sys
but it gets me:
ERROR: You need libmysqlclient development software installed to be able to compile this UDF, on Debian/Ubuntu just run: apt-get install libmysqlclient15-dev
so if I type
sudo apt-get install libmysqlclient15-dev
I get: Note, selecting 'libmysqlclient-dev' instead of 'libmysqlclient15-dev'
and of course it is not the right package because it doesn't work. The .so file contained in the git is compiled for intelx86.
Anyone has an idea? Compiling the .c in the git it's quite impossible due the lot of missing dependencies.
Or.. how can I execute an external script from a trigger without sys_exec?
PS: for completeness, this is the trigger script:
DELIMITER @@
CREATE TRIGGER command_controller AFTER INSERT ON myDB.foo FOR EACH ROW BEGIN DECLARE cmd CHAR(255); DECLARE result int(10); SET cmd='./foo '; SET result = sys_eval(cmd); END; @@ DELIMITER ;