Module: Rake::DataTask::Db::StandardTransactions
- Defined in:
- lib/data_task/adapters/support/transactions.rb
Instance Method Summary collapse
- #with_transaction(do_commit, &block) ⇒ Object
- #with_transaction_commit(&block) ⇒ Object
- #with_transaction_rollback(&block) ⇒ Object
Instance Method Details
#with_transaction(do_commit, &block) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/data_task/adapters/support/transactions.rb', line 9 def with_transaction do_commit, &block execute "begin;" yield close_command = do_commit ? "commit;" : "rollback;" execute close_command end |
#with_transaction_commit(&block) ⇒ Object
16 17 18 |
# File 'lib/data_task/adapters/support/transactions.rb', line 16 def with_transaction_commit &block with_transaction true, &block end |
#with_transaction_rollback(&block) ⇒ Object
20 21 22 |
# File 'lib/data_task/adapters/support/transactions.rb', line 20 def with_transaction_rollback &block with_transaction false, &block end |