Class: DataObjects::SavePoint

### Home Classes Methods

### In Files

- lib/data_objects/transaction.rb

### Parent

DataObjects::Transaction

### Methods

- ::create_for_uri
- #begin
- #close
- #commit
- #rollback

### Class/Module Index

Quicksearch

- DataObjects
- DataObjects::Command
- DataObjects::Connection
- DataObjects::ConnectionError
- DataObjects::DataError
- DataObjects::Error
- DataObjects::Extension
- DataObjects::IntegrityError
- DataObjects::Logger
- DataObjects::Logging
- DataObjects::Pooling
- DataObjects::Pooling::InvalidResourceError
- DataObjects::Pooling::Pool
- DataObjects::Quoting
- DataObjects::Reader
- DataObjects::Result
- DataObjects::SQLError
- DataObjects::SavePoint
- DataObjects::Spec
- DataObjects::Spec::PendingHelpers
- DataObjects::SyntaxError
- DataObjects::Transaction
- DataObjects::TransactionError
- DataObjects::URI
- Extlib
- Extlib::ByteArray
- CustomTextType
- MyString
- Object
- SSLHelpers

No matching classes.

# DataObjects::SavePoint

### Public Class Methods

create_for_uri(uri, connection) click to toggle source

We don't bounce through DO::<Adapter/scheme>::SavePoint because there doesn't appear to be any custom SQL to support this.

    # File lib/data_objects/transaction.rb, line 70
    def self.create_for_uri(uri, connection)
      uri = uri.is_a?(String) ? URI::parse(uri) : uri
      DataObjects::SavePoint.new(uri, connection)
    end

### Public Instance Methods

begin() click to toggle source

    # File lib/data_objects/transaction.rb, line 84
    def begin
      run %{SAVEPOINT "#{@id}"}
    end

close() click to toggle source

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).

    # File lib/data_objects/transaction.rb, line 80
    def close
        # no-op
    end

commit() click to toggle source

    # File lib/data_objects/transaction.rb, line 88
    def commit
      run %{RELEASE SAVEPOINT "#{@id}"}
    end

rollback() click to toggle source

    # File lib/data_objects/transaction.rb, line 92
    def rollback
      run %{ROLLBACK TO SAVEPOINT "#{@id}"}
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.