class SQLite3::Database
def transaction( mode = :deferred )
transaction explicitly, either by calling #commit, or by calling
If a block is not given, it is the caller's responsibility to end the
explicitly or you'll get an error when the block terminates.
a block is given, #commit and #rollback should never be called
raises an exception, a rollback will be performed instead. Note that if
transaction is committed when the block terminates. If the block
If a block is given, the database instance is yielded to it, and the
:immediate, or :exclusive.
The +mode+ parameter may be either :deferred (the default),
exception.
by SQLite, so attempting to nest a transaction will result in a runtime
Begins a new transaction. Note that nested transactions are not allowed
def transaction( mode = :deferred ) execute "begin #{mode.to_s} transaction" if block_given? abort = false begin yield self rescue abort = true raise ensure abort and rollback or commit end end true end