Class: Hyperion::Sql::Transaction
- Inherits:
-
Object
- Object
- Hyperion::Sql::Transaction
- Defined in:
- lib/hyperion/sql/transaction.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #begin ⇒ Object
- #begin_savepoint ⇒ Object
- #commit ⇒ Object
-
#initialize(connection) ⇒ Transaction
constructor
A new instance of Transaction.
- #release_savepoint(id) ⇒ Object
- #rollback ⇒ Object
- #rollback_to_savepoint(id) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Transaction
Returns a new instance of Transaction.
9 10 11 |
# File 'lib/hyperion/sql/transaction.rb', line 9 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/hyperion/sql/transaction.rb', line 7 def connection @connection end |
Instance Method Details
#begin ⇒ Object
13 14 15 |
# File 'lib/hyperion/sql/transaction.rb', line 13 def begin run "BEGIN" end |
#begin_savepoint ⇒ Object
25 26 27 28 29 |
# File 'lib/hyperion/sql/transaction.rb', line 25 def begin_savepoint id = new_savepoint_id run %{SAVEPOINT "#{id}"} id end |
#commit ⇒ Object
17 18 19 |
# File 'lib/hyperion/sql/transaction.rb', line 17 def commit run "COMMIT" end |
#release_savepoint(id) ⇒ Object
31 32 33 |
# File 'lib/hyperion/sql/transaction.rb', line 31 def release_savepoint(id) run %{RELEASE SAVEPOINT "#{id}"} end |
#rollback ⇒ Object
21 22 23 |
# File 'lib/hyperion/sql/transaction.rb', line 21 def rollback run "ROLLBACK" end |
#rollback_to_savepoint(id) ⇒ Object
35 36 37 |
# File 'lib/hyperion/sql/transaction.rb', line 35 def rollback_to_savepoint(id) run %{ROLLBACK TO SAVEPOINT "#{id}"} end |