I know this question has been asked many times, but the commonly-accepted answers didn\'t help me. But quite by accident I stumbled on an answer.
Here\'s the setup: I h
Trigger can be created via PDO::exec() even when PDO::ATTR_EMULATE_PREPARES = false:
setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute (PDO::ATTR_EMULATE_PREPARES, false);
$db->setAttribute (PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$db->exec("CREATE TRIGGER `CirclesClosureSync` AFTER INSERT ON Circles
FOR EACH ROW BEGIN
INSERT INTO CirclesClosure (ancestor, descendant)
SELECT ancestor, NEW.ID from CirclesClosure WHERE descendant=NEW.Parent;
INSERT INTO CirclesClosure (ancestor, descendant) values (NEW.ID, NEW.ID);
END;");