我的应用程序是基于 RoR 和 MySQL 的。我想将自动提交从打开变为关闭,并且我知道如何在 MySQL 中执行此操作。但是我是否需要停止并重新启动 Rails 服务器以确保此更改在我的应用程序中生效?
我想知道ActiveRecord是否有办法检查MySQL数据库中“autocommit”的值?
谢谢。
最佳答案
But do I need to stop and restart my Rails server to make sure this change takes effect in my application?
不,你不必这样做,因为那是一个 MySQL 变量。
I would like to know if there is a way in ActiveRecord to check the value of "autocommit" in the MySQL database?
你可以这样做:
ActiveRecord::Base.connection.exec_query('SELECT @@autocommit')
关于mysql - 如何检查ActiveRecord中的 "autocommit"值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50847972/