How add trigger to mysql Through Schema API

我们两清 提交于 2019-12-23 05:36:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!