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
permalink #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
permalink #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
permalink #begin ⇒ Object
[View source]
13 14 15 |
# File 'lib/hyperion/sql/transaction.rb', line 13 def begin run "BEGIN" end |
permalink #begin_savepoint ⇒ Object
[View source]
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 |
permalink #commit ⇒ Object
[View source]
17 18 19 |
# File 'lib/hyperion/sql/transaction.rb', line 17 def commit run "COMMIT" end |
permalink #release_savepoint(id) ⇒ Object
[View source]
31 32 33 |
# File 'lib/hyperion/sql/transaction.rb', line 31 def release_savepoint(id) run %{RELEASE SAVEPOINT "#{id}"} end |
permalink #rollback ⇒ Object
[View source]
21 22 23 |
# File 'lib/hyperion/sql/transaction.rb', line 21 def rollback run "ROLLBACK" end |
permalink #rollback_to_savepoint(id) ⇒ Object
[View source]
35 36 37 |
# File 'lib/hyperion/sql/transaction.rb', line 35 def rollback_to_savepoint(id) run %{ROLLBACK TO SAVEPOINT "#{id}"} end |