Class: ActiveRecord::ConnectionAdapters::RealTransaction
- Inherits:
-
Transaction
- Object
- Transaction
- ActiveRecord::ConnectionAdapters::RealTransaction
show all
- Defined in:
- lib/active_record/connection_adapters/abstract/transaction.rb
Overview
Active Record Real Transaction
Instance Attribute Summary
Attributes inherited from Transaction
#connection, #isolation_level, #savepoint_name, #state, #user_transaction, #written
Instance Method Summary
collapse
Methods inherited from Transaction
#add_record, #after_commit, #after_rollback, #before_commit, #before_commit_records, #closed?, #commit_records, #dirty!, #dirty?, #full_rollback?, #incomplete!, #initialize, #joinable?, #materialized?, #open?, #records, #restartable?, #restore!, #rollback_records
Instance Method Details
#commit ⇒ Object
487
488
489
490
491
492
493
494
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 487
def commit
if materialized?
connection.commit_db_transaction
connection.reset_isolation_level if isolation_level
end
@state.full_commit!
@instrumenter.finish(:commit) if materialized?
end
|
#materialize! ⇒ Object
450
451
452
453
454
455
456
457
458
459
460
461
462
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 450
def materialize!
if joinable?
if isolation_level
connection.begin_isolated_db_transaction(isolation_level)
else
connection.begin_db_transaction
end
else
connection.begin_deferred_transaction(isolation_level)
end
super
end
|
#restart ⇒ Object
464
465
466
467
468
469
470
471
472
473
474
475
476
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 464
def restart
return unless materialized?
@instrumenter.finish(:restart)
if connection.supports_restart_db_transaction?
@instrumenter.start
connection.restart_db_transaction
else
connection.rollback_db_transaction
materialize!
end
end
|
#rollback ⇒ Object
478
479
480
481
482
483
484
485
|
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 478
def rollback
if materialized?
connection.rollback_db_transaction
connection.reset_isolation_level if isolation_level
end
@state.full_rollback!
@instrumenter.finish(:rollback) if materialized?
end
|