Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems impossible to pass a variable from trigger to cmd #31

Open
Sarge2013 opened this issue May 20, 2020 · 0 comments
Open

Seems impossible to pass a variable from trigger to cmd #31

Sarge2013 opened this issue May 20, 2020 · 0 comments

Comments

@Sarge2013
Copy link

Sarge2013 commented May 20, 2020

Thanks for you plugin set, first of all.
My environment CentOS 7, MySQL 5.5, plugin lib_mysqludf_sys has installed and works properly.
But I can't pass a variable from trigger to cmd - may be a specific wrapper is needed ?
Please, see the trigger below
AFTER INSERT ON trig_test
FOR EACH ROW
BEGIN
DECLARE cmd CHAR(255);
DECLARE result CHAR(255);
DECLARE var INT;
SET @var = (SELECT MAX(ID) FROM trig_test) ;
-- // this line does not work, tested echo @var, echo "@var" etc - or empty or 0
SET cmd = CONCAT('echo "@var" >> /test/mysqltrigger.txt');
SET result = sys_exec(cmd);
-- // this line work OK
SET cmd = CONCAT('echo "test" >> /test/mysqltrigger.txt');
SET result = sys_exec(cmd);
-- // this line also work OK
INSERT INTO test (column1,column2) VALUES (@var,'test') ;
END;

Please, hint a solution if available,
Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant