Class: Bricolage::PostgresConnection::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/bricolage/postgresconnection.rb

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ Transaction

Returns a new instance of Transaction.



179
180
181
182
# File 'lib/bricolage/postgresconnection.rb', line 179

def initialize(conn)
  @conn = conn
  @committed = false
end

Instance Method Details

#abortObject



193
194
195
196
# File 'lib/bricolage/postgresconnection.rb', line 193

def abort
  @conn.execute 'abort'
  @committed = true
end

#commitObject



188
189
190
191
# File 'lib/bricolage/postgresconnection.rb', line 188

def commit
  @conn.execute 'commit'
  @committed = true
end

#committed?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/bricolage/postgresconnection.rb', line 184

def committed?
  @committed
end

#truncate_and_commit(table) ⇒ Object



198
199
200
201
# File 'lib/bricolage/postgresconnection.rb', line 198

def truncate_and_commit(table)
  @conn.execute "truncate #{table}"
  @committed = true
end