Module: ActiveRecord::Base::PostgresSQL2PCExtensions

Extended by:
ActiveSupport::Concern
Defined in:
lib/promiscuous/publisher/operation/active_record.rb

Instance Method Summary collapse

Instance Method Details

#commit_prepared_db_transaction(xid) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/promiscuous/publisher/operation/active_record.rb', line 9

def commit_prepared_db_transaction(xid)
  # We might always be racing with another instance, these sort of errors
  # are spurious.
  execute("COMMIT PREPARED '#{quote_string(xid)}'")
rescue Exception => e
  raise unless e.message =~ /^PG::UndefinedObject/
end

#prepare_db_transactionObject



5
6
7
# File 'lib/promiscuous/publisher/operation/active_record.rb', line 5

def prepare_db_transaction
  execute("PREPARE TRANSACTION '#{quote_string(@current_transaction_id)}'")
end

#rollback_prepared_db_transaction(xid, options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/promiscuous/publisher/operation/active_record.rb', line 17

def rollback_prepared_db_transaction(xid, options={})
  execute("ROLLBACK PREPARED '#{quote_string(xid)}'")
rescue Exception => e
  raise unless e.message =~ /^PG::UndefinedObject/
end