class SQLite3::Database
def transaction(mode = nil)
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
passed to #initialize, is used.
If `nil` is specified, the default transaction mode, which was
:immediate, or :exclusive.
The +mode+ parameter may be either :deferred,
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 = nil) mode = @default_transaction_mode if mode.nil? execute "begin #{mode} transaction" if block_given? abort = false begin yield self rescue abort = true raise ensure abort and rollback or commit end else true end end