This code does not work and I can’t figure out why.
I use it with OCS Inventory agent and it creates a 500 error on the agent inventory which means there is clearly a defect inside but there are no errors neither in mariadb.log neither in httpd logs
delimiter |
CREATE TRIGGER AUTO_UPSERT_MIDDLEWAREV2 AFTER INSERT ON `MIDDLEWAREV2`
FOR EACH ROW
BEGIN
INSERT INTO MIDDLEWAREV2_CDC (ID, HARDWARE_ID, NAME, TYPE, SERVER_NAME, SERVER_BINARY_PATH, PORT, STATE, SERVER_VERSION) VALUES (NEW.ID, NEW.HARDWARE_ID, NEW.NAME, NEW.TYPE, NEW.SERVER_NAME, NEW.SERVER_BINARY_PATH, NEW.PORT, NEW.STATE, NEW.SERVER_VERSION) ON DUPLICATE KEY UPDATE ID = NEW.ID, TYPE = NEW.TYPE, SERVER_NAME = NEW.SERVER_NAME, PORT = NEW.PORT, STATE = NEW.STATE, SERVER_VERSION = NEW.SERVER_VERSION;
END;
|
CREATE TRIGGER AUTO_DELETE_MIDDLEWAREV2 AFTER DELETE ON `MIDDLEWAREV2`
FOR EACH ROW
BEGIN
DELETE FROM MIDDLEWAREV2_CDC WHERE ID NOT IN (select ID from MIDDLEWAREV2) AND HARDWARE_ID = OLD.HARDWARE_ID;
END;
|
delimiter ;
Please help !
I’ve tried with “ and without also tried to add spaces and lot of other syntax stuff but it did not change anything, Error 500 on the inventory and empty table.
I also made a lot of searches but did not find anything that helps
1