It would be nice if the SQL parser would recognize
"CREATE TRIGGER" sql statements and just change
DELIMITER for this single statement to something not
used in the statement, i.e. "//".
Example query:
CREATE TRIGGER trigger_documents_forum_delete AFTER
DELETE ON documents
FOR EACH ROW
BEGIN
IF OLD.document_category_id=2 THEN
UPDATE forum_postings SET last_update=NOW() WHERE
node_id=OLD.foreign_id;
END IF;
END;
phpMyAdmin should execute automatically before a
"CREATE TRIGGER" statement:
DELIMITER //
and after the "CREATE TRIGGER" statement:
//
DELIMITER ;
Conclusion: Each single "CREATE TRIGGER" statement
should be surrounded automatically by two DELIMITER
statements.
The working example from the MySQL 5.0.11 command line is:
DELIMITER //
CREATE TRIGGER trigger_documents_forum_delete AFTER
DELETE ON documents
FOR EACH ROW
BEGIN
IF OLD.document_category_id=2 THEN
UPDATE forum_postings SET last_update=NOW() WHERE
node_id=OLD.foreign_id;
END IF;
END;//
DELIMITER ;
GUI support for triggers could be added later of course ;)
Best regards,
René Leonhardt
Logged In: YES
user_id=210714
Originator: NO
This was implemented some time ago.