Tuesday, October 14, 2014

Problem with creating triggers using query() and rawQuery()

Hi,

I am writing a installer for an application which will setup the
database using query() or rawQuery() methods.

I am not able to execute the following SQL statements using query() or
rawQuery().

DROP TRIGGER IF EXISTS `check_sometable`;
DELIMITER //
CREATE TRIGGER `check_sometable` BEFORE INSERT ON `sometable`
FOR EACH ROW BEGIN
......
END IF;
END
//
DELIMITER ;

It throws an exception stating '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

Regards.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: