开发者

rails pessimistic lock not working

开发者 https://www.devze.com 2023-03-21 23:19 出处:网络
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... :(

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 "C开发者_开发百科HECKOUTS"."SEQ_COD" = 562
SELECT "CHECKOUTS".* FROM "CHECKOUTS" WHERE "CHECKOUTS"."SEQ_COD" = 562

Anybody know what I am missing?

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消