Displaying 2 results from an estimated 2 matches for "start_db_transaction".
2006 Jun 15
4
testing with transactions
...g to make a custom patch for AR to create savepoints for inner
transactions. Can somebody help me with achieving this (esp. with
connection_adapters and wrapping this all up as a plugin perhaps).
Something in the way of:
# Wrap a block in a transaction. Returns result of block.
def transaction(start_db_transaction = true)
transaction_open = false
savepoint_open = false
savepoint_name = nil
begin
if block_given?
if start_db_transaction
begin_db_transaction
transaction_open = true
else
savepoint_name = create_savepoint
savepoint_open = true
end...
2008 Apr 04
2
TransactionError
...e_record/transactions.rb:
module ClassMethods
def transaction(&block)
previous_handler = trap(''TERM'') { raise TransactionError, "Transaction aborted" }
increment_open_transactions
begin
connection.transaction(Thread.current[''start_db_transaction''], &block)
ensure
decrement_open_transactions
trap(''TERM'', previous_handler)
end
end
[...]
Above this, there''s
"Both Base#save and Base#destroy come wrapped in a transaction [...]"
and
"Also have in mind that...