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
-
#current_transaction ⇒ Transaction
private
Retrieve the current transaction for this Adapter.
-
#pop_transaction ⇒ Transaction
private
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.
-
#push_transaction(transaction) ⇒ Array(Transaction)
private
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.
-
#transaction_primitive ⇒ Object
private
Produces a fresh transaction primitive for this Adapter.
Instance Method Details
#current_transaction ⇒ 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.
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_transaction ⇒ 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.
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_primitive ⇒ Object
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 |