Class | DataMapper::Transaction |
In: |
lib/dm-core/transaction.rb
|
Parent: | Object |
MysqlAdapter | = | PostgresAdapter = Sqlite3Adapter = OracleAdapter = Adapter | alias the MySQL, PostgreSQL, Sqlite3 and Oracle adapters to use transactions |
Create a new Transaction
@see Transaction#link
In fact, it just calls link with the given arguments at the end of the constructor.
@api public
Begin the transaction
Before begin is called, the transaction is not valid and can not be used.
@api private
Commit the transaction
If no block is given, it will simply commit any changes made since the Transaction did #begin.
@param block<Block> a block (taking the one argument, the Transaction) to
execute within this transaction. The transaction will begin and commit around the block, and roll back if an exception is raised.
@api private
Associate this Transaction with some things.
@param [Object] things
the things you want this Transaction associated with: Adapters::AbstractAdapter subclasses will be added as adapters as is. Arrays will have their elements added. Repository will have it's own @adapters added. Resource subclasses will have all the repositories of all their properties added. Resource instances will have all repositories of all their properties added.
@param [Proc] block
a block (taking one argument, the Transaction) to execute within this transaction. The transaction will begin and commit around the block, and rollback if an exception is raised.
@api private
Execute a block within this Transaction.
No begin, commit or rollback is performed in within, but this Transaction will pushed on the per thread stack of transactions for each adapter it is associated with, and it will ensures that it will pop the Transaction away again after the block is finished.
@param block<Block> the block of code to execute.
@api private