Thursday, October 16, 2014

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

Please verify that your code will work directly in a console against the database.

For examply by using phpMyAdmin and run the code in there.

Kindly inform us of the result

Enjoy, John

On Tuesday, 14 October 2014 13:57:28 UTC+3, Prashant wrote:
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: