Module: DataMapper::Transaction::DataObjectsAdapter

Extended by:
Chainable
Included in:
MysqlAdapter, OracleAdapter, PostgresAdapter, SqliteAdapter, SqlserverAdapter
Defined in:
lib/dm-transactions/adapters/dm-do-adapter.rb

Instance Method Summary collapse

Instance Method Details

#current_transactionTransaction

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieve the current transaction for this Adapter.

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



60
61
62
# File 'lib/dm-transactions/adapters/dm-do-adapter.rb', line 60

def current_transaction
  transactions.last
end

#pop_transactionTransaction

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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.



47
48
49
# File 'lib/dm-transactions/adapters/dm-do-adapter.rb', line 47

def pop_transaction
  transactions.pop
end

#push_transaction(transaction) ⇒ Array(Transaction)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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.



35
36
37
# File 'lib/dm-transactions/adapters/dm-do-adapter.rb', line 35

def push_transaction(transaction)
  transactions << transaction
end

#transaction_primitiveObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Produces a fresh transaction primitive for this Adapter

Used by Transaction to perform its various tasks.



16
17
18
19
20
21
22
# 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