DataMapper::Transaction::DataObjectsAdapter

Public Instance Methods

close_connection(connection) click to toggle source

@api semipublic

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 73
def close_connection(connection)
  super unless current_connection.equal?(connection)
end
current_transaction() click to toggle source

Retrieve the current transaction for this Adapter.

Everything done by this Adapter is done within the context of this Transaction.

@return [Transaction]

the 'current' transaction for this Adapter.

@api private

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 60
def current_transaction
  transactions.last
end
open_connection() click to toggle source

@api semipublic

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 68
def open_connection
  current_connection || super
end
pop_transaction() click to toggle source

Pop the 'current' Transaction from the per thread Transaction stack so that everything done by this Adapter is no longer necessarily within the context of said Transaction.

@return [Transaction]

the former 'current' transaction.

@api private

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 47
def pop_transaction
  transactions.pop
end
push_transaction(transaction) click to toggle source

Pushes the given Transaction onto the per thread Transaction stack so that everything done by this Adapter is done within the context of said Transaction.

@param [Transaction] transaction

a Transaction to be the 'current' transaction until popped.

@return [Array(Transaction)]

the stack of active transactions for the current thread

@api private

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 35
def push_transaction(transaction)
  transactions << transaction
end
transaction_primitive() click to toggle source

Produces a fresh transaction primitive for this Adapter

Used by Transaction to perform its various tasks.

@return [Object]

a new Object that responds to :close, :begin, :commit,
and :rollback,

@api private

# File lib/dm-transactions/adapters/dm-do-adapter.rb, line 16
def transaction_primitive
  if current_transaction && supports_savepoints?
    DataObjects::SavePoint.create_for_uri(normalized_uri, current_connection)
  else
    DataObjects::Transaction.create_for_uri(normalized_uri)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.