Rails 悲观锁不起作用
我试图在我的应用程序中使用悲观锁,但它不起作用...... 我正在使用 Rails 3 (3.0.9) 和 activerecord-oracle_enhanced-adapter (1.3.2),并且锁定选项现在对我有用...:(
该应用程序只是不使用 se“更新”子句执行sql...
所以我制作了这个脚本来演示生成的查询...(是的,我也查看了development.log)...
Checkout.transaction do
puts Checkout.where(:seq_cod=>562).lock(true).to_sql
puts Checkout.where(:seq_cod=>562).lock('for update').to_sql
end
结果:
SELECT "CHECKOUTS".* FROM "CHECKOUTS" WHERE "CHECKOUTS"."SEQ_COD" = 562
SELECT "CHECKOUTS".* FROM "CHECKOUTS" WHERE "CHECKOUTS"."SEQ_COD" = 562
有人知道我缺少什么吗?
谢谢!
I´m trying to use a pessimistic lock in my app but it just not work...
I´m using rails 3 (3.0.9), with activerecord-oracle_enhanced-adapter (1.3.2) and the lock option is now working for me... :(
The app just dont use se "for update" clause in the executed sqls...
So I´ve made this script to demonstrate the queries generated... (and yes, I´ve also looked at development.log)...
Checkout.transaction do
puts Checkout.where(:seq_cod=>562).lock(true).to_sql
puts Checkout.where(:seq_cod=>562).lock('for update').to_sql
end
results in:
SELECT "CHECKOUTS".* FROM "CHECKOUTS" WHERE "CHECKOUTS"."SEQ_COD" = 562
SELECT "CHECKOUTS".* FROM "CHECKOUTS" WHERE "CHECKOUTS"."SEQ_COD" = 562
Anybody know what I am missing?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论