问题
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??
回答1:
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.
来源:https://stackoverflow.com/questions/18655144/how-can-we-connect-mysql-trigger-with-ruby-on-rails-3