问题
Through Schema API (file mymodule.install in Folder sites\all\modules\mymodule). trigger in mysql:
delimiter |
CREATE TRIGGER testref AFTER INSERT ON users
FOR EACH ROW BEGIN
INSERT INTO beep SET uid = NEW.uid;
END;
|
delimiter ;
回答1:
There is no specific API for that.
Try http://api.drupal.org/api/drupal/includes--database.pgsql.inc/function/db_query/6
Also remember that triggers are not standardised across different databases. It would be a better idea (or maybe as a fallback) to do that with hook_user().
来源:https://stackoverflow.com/questions/5301129/how-add-trigger-to-mysql-through-schema-api