Hi there,
Using: SQLyog Ultimate v13.1.6 (64bit)
When backing up multiple triggers from one database, the file that is created looks like:
/* Trigger structure for table al_lead_trigger
*/
DELIMITER $$
DROP TRIGGER IF EXISTS al_lead_trigger_1_0
$$
CREATE TRIGGER al_lead_trigger_1_0
AFTER INSERT ON al_lead_trigger
FOR EACH ROW BEGIN
CALL copy_to_al_1_0(NEW.lead_id);
END $$
DELIMITER ;
/* Trigger structure for table al_leads
*/
DELIMITER $$
DROP TRIGGER IF EXISTS before_update_al_leads
$$
CREATE TRIGGER before_update_al_leads
BEFORE UPDATE ON al_leads
FOR EACH ROW BEGIN
CALL audit_al_leads_1_0(NEW.id,NEW.updated_by,now(),’user_id’,OLD.user_id,NEW.user_id);
END $$
DELIMITER ;
When restoring via the command line, the following loads successfully:
mysql < triggers.sql
However, if we want to preserve comments using:
mysql –comments < triggers.sql
We see the following error messages:
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DELIMITER $$
DROP TRIGGER IF EXISTS al_lead_trigger_1_0
$$
CREATE TRIGGER ‘ at line 3
The fix would be to add a semi-colon at the end of the comment added between triggers, i.e.,
/* Trigger structure for table al_leads
*/;
Please fix.
Thanks
Trevor