提交 6e2357f0 编写于 作者: G Gannon McGibbon

Fix example for database-specific locking clause

[ci skip]
上级 b63701e2
......@@ -14,9 +14,9 @@ module Locking
# of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'. Example:
#
# Account.transaction do
# # select * from accounts where name = 'shugo' limit 1 for update
# shugo = Account.where("name = 'shugo'").lock(true).first
# yuko = Account.where("name = 'yuko'").lock(true).first
# # select * from accounts where name = 'shugo' limit 1 for update nowait
# shugo = Account.lock("FOR UPDATE NOWAIT").find_by(name: "shugo")
# yuko = Account.lock("FOR UPDATE NOWAIT").find_by(name: "yuko")
# shugo.balance -= 100
# shugo.save!
# yuko.balance += 100
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册