abstract class DB::Transaction

Overview

Transactions should be started from DB#transaction, Connection#transaction or Connection#begin_transaction.

Use Transaction#connection to submit statements to the database.

Use Transaction#commit or Transaction#rollback to close the ongoing transaction explicitly. Or refer to BeginTransaction#transaction for documentation on how to use #transaction(&block) methods in DB and Connection.

Nested transactions are supported by using sql SAVEPOINT. To start a nested transaction use Transaction#transaction or Transaction#begin_transaction.

Included Modules

Direct Known Subclasses

Defined in:

db/transaction.cr

Instance Method Summary

Instance methods inherited from module DB::BeginTransaction

begin_transaction : Transaction begin_transaction, transaction(&block) transaction

Instance methods inherited from module DB::Disposable

close close, closed? closed?

Instance Method Detail

def commit #

commits the current transaction


[View source]
abstract def connection : Connection #

[View source]
abstract def release_from_nested_transaction #

[View source]
def rollback #

rollbacks the current transaction


[View source]