Class: DB::Context::Transaction
- Defined in:
- lib/db/context/transaction.rb
Instance Attribute Summary
Attributes inherited from Session
Instance Method Summary collapse
-
#abort ⇒ Object
Abort the transaction and return the connection to the connection pool.
-
#commit ⇒ Object
Commit the transaction and return the connection to the connection pool.
-
#rollback(name) ⇒ Object
Return back to a previously registered savepoint.
-
#savepoint(name) ⇒ Object
Mark a savepoint in the transaction.
Methods inherited from Session
#call, #clause, #close, #flush, #initialize, #next_result, #query, #results, #send_query
Constructor Details
This class inherits a constructor from DB::Context::Session
Instance Method Details
#abort ⇒ Object
Abort the transaction and return the connection to the connection pool.
35 36 37 38 |
# File 'lib/db/context/transaction.rb', line 35 def abort self.call("ROLLBACK") self.close end |
#commit ⇒ Object
Commit the transaction and return the connection to the connection pool.
29 30 31 32 |
# File 'lib/db/context/transaction.rb', line 29 def commit self.call("COMMIT") self.close end |
#rollback(name) ⇒ Object
Return back to a previously registered savepoint.
46 47 48 |
# File 'lib/db/context/transaction.rb', line 46 def rollback(name) self.call("ROLLBACK #{name}") end |
#savepoint(name) ⇒ Object
Mark a savepoint in the transaction.
41 42 43 |
# File 'lib/db/context/transaction.rb', line 41 def savepoint(name) self.call("SAVEPOINT #{name}") end |