Skip to content

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

Open
@Sarge2013

Description

@Sarge2013

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions