问题描述
我正在开发一个使用 mysql 作为数据库的 ROR 3 应用程序.现在我每次更新 table1
的 col1
时都需要一个触发器.但我还希望在触发器完成后,我的 rails 控制器中该行的 col1
和 col2
的值(以便更新动态进度条) ...我可以采用什么方法?
I'm working on a ROR 3 app which uses mysql as the database. Now I want a trigger every time col1
of table1
is updated. But I also want the values of both col1
and col2
of that row in my rails controllers after the trigger is completed ( so as to update an dynamic progress bar ) ... What approach can I follow for this??
推荐答案
请查看 此手动条目 用于在您的表上定义触发器.
Please check this manual entry to define a trigger on your table.
触发器将阻止触发操作,直到触发器完成.没什么可做的,就等你的主查询结束.
A trigger will block the trigggering operation until the trigger completes. There is nothing else to do, just wait until your main query ends.
触发器没有返回值.当您的更新完成时(这意味着您的触发器也完成了),发出一个单独的 SELECT
语句.
A trigger has no return value. When your update completes (which means your trigger completed too), issue a separate SELECT
statement.
这篇关于我们如何将 mysql 触发器与 Ruby on Rails 3 连接起来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!