Subject: | MySQL Delimiter statement not recognized |
I'm using DBIx::MultiStatementDo which utilizes the subject module to
split the SQL statements.
Consider this MySQL:
DROP TRIGGER IF EXISTS user_change_password;
delimiter //
CREATE TRIGGER user_change_password AFTER UPDATE ON user
FOR EACH ROW my_block: BEGIN
IF NEW.password != OLD.password THEN
UPDATE user_authentication_results AS uar
SET password_changed = 1
WHERE uar.user_id = NEW.user_id;
END IF;
END my_block; //
delimiter ;
The "delimiter" statement is used to allow redefining the usual
delimiter (;) temporarily while defining stored procedures and triggers.
Unfortunately, the module does not recognize this statement, giving this
error:
DBD::mysql::db do failed: 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' at line 1 [for Statement "delimiter"] at
/usr/local/share/perl/5.8.8/DBIx/MultiStatementDo.pm line 91, <$fh> line 1.