Class: DataObjects::SavePoint
- Inherits:
-
Transaction
- Object
- Transaction
- DataObjects::SavePoint
- Defined in:
- lib/data_objects/transaction.rb
Constant Summary
Constants inherited from Transaction
Instance Attribute Summary
Attributes inherited from Transaction
Class Method Summary collapse
-
.create_for_uri(uri, connection) ⇒ Object
We don’t bounce through DO::<Adapter/scheme>::SavePoint because there doesn’t appear to be any custom SQL to support this.
Instance Method Summary collapse
- #begin ⇒ Object
-
#close ⇒ Object
SavePoints can only occur in the context of a Transaction, thus they re-use TXN’s connection (which was acquired from the connection pool legitimately via DO::Connection.new).
- #commit ⇒ Object
- #rollback ⇒ Object
Methods inherited from Transaction
#begin_prepared, #commit_prepared, #initialize, #prepare, #rollback_prepared
Constructor Details
This class inherits a constructor from DataObjects::Transaction
Class Method Details
.create_for_uri(uri, connection) ⇒ Object
We don’t bounce through DO::<Adapter/scheme>::SavePoint because there doesn’t appear to be any custom SQL to support this.
85 86 87 88 |
# File 'lib/data_objects/transaction.rb', line 85 def self.create_for_uri(uri, connection) uri = URI.parse(uri) if uri.is_a?(String) DataObjects::SavePoint.new(uri, connection) end |
Instance Method Details
#begin ⇒ Object
99 100 101 |
# File 'lib/data_objects/transaction.rb', line 99 def begin run %(SAVEPOINT "#{@id}") end |
#close ⇒ Object
SavePoints can only occur in the context of a Transaction, thus they re-use TXN’s connection (which was acquired from the connection pool legitimately via DO::Connection.new). We no-op #close in SP because calling DO::Connection#close will release the connection back into the pool (before the top-level Transaction might be done with it).
95 96 97 |
# File 'lib/data_objects/transaction.rb', line 95 def close # no-op end |
#commit ⇒ Object
103 104 105 |
# File 'lib/data_objects/transaction.rb', line 103 def commit run %(RELEASE SAVEPOINT "#{@id}") end |
#rollback ⇒ Object
107 108 109 |
# File 'lib/data_objects/transaction.rb', line 107 def rollback run %(ROLLBACK TO SAVEPOINT "#{@id}") end |