Active Record 保存点事务
方法
- C
- F
- M
- N
- R
类公共方法
new(connection, savepoint_name, parent_transaction, **options) 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 405 def initialize(connection, savepoint_name, parent_transaction, **options) super(connection, **options) parent_transaction.state.add_child(@state) if isolation_level raise ActiveRecord::TransactionIsolationError, "cannot set transaction isolation in a nested transaction" end @savepoint_name = savepoint_name end
实例公共方法
commit() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 439 def commit connection.release_savepoint(savepoint_name) if materialized? @state.commit! @instrumenter.finish(:commit) if materialized? end
full_rollback?() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 445 def full_rollback?; false; end
materialize!() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 417 def materialize! connection.create_savepoint(savepoint_name) super end
restart() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 422 def restart return unless materialized? @instrumenter.finish(:restart) @instrumenter.start connection.rollback_to_savepoint(savepoint_name) end
rollback() 链接
源代码: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 431 def rollback unless @state.invalidated? connection.rollback_to_savepoint(savepoint_name) if materialized? && connection.active? end @state.rollback! @instrumenter.finish(:rollback) if materialized? end