Module: ActiveRecord::ConnectionAdapters::MysqlAdapterPatches

Defined in:
lib/transaction_isolation_level/adapter_patches.rb

Instance Method Summary collapse

Instance Method Details

#begin_db_transactionObject



102
103
104
105
# File 'lib/transaction_isolation_level/adapter_patches.rb', line 102

def begin_db_transaction
  execute "SET TRANSACTION #{transaction_isolation_level_sql(@transaction_isolation_level)}" if @transaction_isolation_level # applies only to the next transaction
  super
end

#configure_connectionObject



107
108
109
110
111
112
113
114
115
# File 'lib/transaction_isolation_level/adapter_patches.rb', line 107

def configure_connection
  super
  if @config[:transaction_isolation_level]
    @default_transaction_isolation_level = @config[:transaction_isolation_level].to_sym
    execute "SET SESSION TRANSACTION #{transaction_isolation_level_sql default_transaction_isolation_level}"
  else
    @default_transaction_isolation_level = transaction_isolation_level_from_sql(select_value("SELECT @@session.tx_isolation"))
  end
end