Method: TableCopy::PG::Destination#transaction

Defined in:
lib/table_copy/pg/destination.rb

#transactionObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/table_copy/pg/destination.rb', line 17

def transaction
  with_conn do |conn|
    begin
      conn.exec('begin')
      yield
      conn.exec('commit')
    rescue Exception => e
      conn.exec('rollback')
      raise e
    end
  end
end