Module: Imparcial::Driver::AbstractExpression::Transaction

Included in:
Imparcial::Driver::AbstractExpression
Defined in:
lib/imparcial/driver/abstract/expression/transaction.rb

Instance Method Summary collapse

Instance Method Details

#create_savepoint(options = {}) ⇒ Object

Description

Stablish a savepoint in a given moment during transactions.

Usage

abstract_adapter.create_savepoint :savepoint_name => ‘here’

Options

  • :savepoint_name

Returning

nothing



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/imparcial/driver/abstract/expression/transaction.rb', line 28

def create_savepoint ( options = {} )
            
  check_options expected_options_for_saving_point, options
            
  query sql_for_saving_point( options )
  
rescue adapter_specific_exception => ex

  raise TransactionError.new(ex.message)
  
end

#initialize_transactionObject

Description

Initiate a transaction.

Usage

abstract_adapter.initialize_transaction

Options

no options

Returning

nothing



86
87
88
89
90
91
92
93
94
# File 'lib/imparcial/driver/abstract/expression/transaction.rb', line 86

def initialize_transaction
  
  query sql_for_initializing_a_transaction
  
rescue adapter_specific_exception => ex

  raise TransactionError.new(ex.message)
  
end

#restore_savepoint(options = {}) ⇒ Object

Description

Rollback to a given savepoint.

Usage

abstract_adapter.restore_savepoint :savepoint_name => ‘here’

Options

  • :savepoint_name

Returning

nothing



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/imparcial/driver/abstract/expression/transaction.rb', line 62

def restore_savepoint ( options = {} )
  
  check_options expected_options_for_restoring_point, options
            
  query sql_for_rolling_back( options )
  
rescue adapter_specific_exception => ex

  raise TransactionError.new(ex.message)
  
end

#rollback_transactionObject

Description

Rollback a transaction.

Usage

abstract_adapter.rollback_transaction

Options

no options

Returning

nothing



130
131
132
133
134
135
136
137
138
# File 'lib/imparcial/driver/abstract/expression/transaction.rb', line 130

def rollback_transaction
  
  query sql_for_rolling_back
  
rescue adapter_specific_exception => ex

  raise TransactionError.new(ex.message)
  
end

#terminate_transactionObject

Description

Terminate a transaction by commiting.

Usage

abstract_adapter.terminate_transaction

Options

no options

Returning

nothing



108
109
110
111
112
113
114
115
116
# File 'lib/imparcial/driver/abstract/expression/transaction.rb', line 108

def terminate_transaction
  
  query sql_for_terminating_a_transaction
  
rescue adapter_specific_exception => ex

  raise TransactionError.new(ex.message)
  
end