I have the following piece of code in Rails 3.2 + mySQL application:
ActiveRecord::Base.connection.execute("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED")
ActiveRecord::Base.transaction do
@book = ActiveRecord::Base.connection.execute("select * from books limit 1")
end
As far as I understand the first statement will result in the next ONE transaction within same session to be in "READ UNCOMMITTED" isolation and then isolation will return to default.
My questions are: Can I be sure that the transaction block will always be executed in the same session? Also, can I be sure that no other transaction will take place in the same session between the first and the second statement?
I tried to Google for this topic, but as I am new to Rails I couldn't find any explanation that would make this clear to me. Any help would be appreciated!
Thank you!