Class: Bricolage::PostgresConnection::Transaction
- Inherits:
-
Object
- Object
- Bricolage::PostgresConnection::Transaction
- Defined in:
- lib/bricolage/postgresconnection.rb
Instance Method Summary collapse
- #abort ⇒ Object
- #commit ⇒ Object
- #committed? ⇒ Boolean
-
#initialize(conn) ⇒ Transaction
constructor
A new instance of Transaction.
- #truncate_and_commit(table) ⇒ Object
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
#abort ⇒ Object
193 194 195 196 |
# File 'lib/bricolage/postgresconnection.rb', line 193 def abort @conn.execute 'abort' @committed = true end |
#commit ⇒ Object
188 189 190 191 |
# File 'lib/bricolage/postgresconnection.rb', line 188 def commit @conn.execute 'commit' @committed = true end |
#committed? ⇒ 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 |