gpt4 book ai didi

mysql - 如何检查ActiveRecord中的 "autocommit"值

转载 作者:行者123 更新时间:2023-11-29 10:11:45 24 4
gpt4 key购买 nike

我的应用程序是基于 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com