简体   繁体   English

我们如何将mysql触发器与Ruby on Rails 3连接起来?

[英]How can we connect mysql trigger with Ruby on Rails 3?

I'm working on a ROR 3 app which uses mysql as the database. 我正在使用MySQL作为数据库的ROR 3应用程序上工作。 Now I want a trigger every time col1 of table1 is updated. 现在,我希望每次更新table1 col1时都触发一个触发器。 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?? 但是我还希望在触发器完成后(以便更新动态进度条)在我的rails控制器中该行的col1col2的值……对此我可以采取什么方法?

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. 无需执行其他操作,只需等到主查询结束即可。

A trigger has no return value. 触发器没有返回值。 When your update completes (which means your trigger completed too), issue a separate SELECT statement. 更新完成时(这意味着触发器也完成了),请发出单独的SELECT语句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM