开发者

how to create database trigger on insert, update and delete operation in mysql with coldfusion?

开发者 https://www.devze.com 2023-02-10 19:11 出处:网络
how to create trigger in mysql in coldfusion at the time of insert, update and delete operation. Tha开发者_开发问答nks

how to create trigger in mysql in coldfusion at the time of insert, update and delete operation.

Tha开发者_开发问答nks

Yugal


I don't really get the point of this because the whole idea of using triggers is to automatically have the database do something without the need to do it from your server-side language on every insert/update or delete.

So basically it's code you only execute once to create the trigger.

I suppose it's just creating a trigger between your <CFQUERY> tags similar to how you do an insert, update or delete operation

Before the insert

CREATE TRIGGER triggerName BEFORE INSERT ON tableName FOR EACH ROW what_ever_you_want_your_trigger_todo;

After the insert

CREATE TRIGGER triggerName AFTER INSERT ON tableName FOR EACH ROW what_ever_you_want_your_trigger_todo;

http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html

But really I would do this using a mysql-client, set and forget it. Depending on the use of BEFORE or AFTER it will be executed either before or after your insert/update/delete statement on that table.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号