开发者

About MySQL's trigger

I know it's available since version 5.1,but :

  1. Is it stable?
  2. Is it开发者_运维知识库 possible to trigger event when there is insert/update operation on specific columns instead of the whole table?


  1. To my experience, yes, totally
  2. Not exclusively, but you can add a check in the body of the trigger: IF(OLD.col <> NEW.col, ...)


  1. To my experience, yes.
  2. Trigger functionality is very limited. You have FOR EACH ROW option but no WHEN. It is also very limited what you can do inside the trigger. If you expect the requirements to change later (i.e. the project will go on), I would not opt to do business logic in mysql triggers. If it contains some simple check or consistency update it can do a good job.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜