Method: LMDB::Transaction#commit

Defined in:
ext/lmdb_ext/lmdb_ext.c

#commitObject

Note:

After committing a transaction, no further database operations should be done in the block. Any cursors created in the context of the transaction will no longer be valid.

Commit a transaction in process. Any subtransactions of this transaction will be committed as well.

One does not normally need to call commit explicitly; a commit is performed automatically when the block supplied to Environment#transaction exits normally.

Examples:

Single transaction

env.transaction do |txn|
  # ... modify the databases ...
  txn.commit
end

Child transactions

env.transaction do |txn1|
  env.transaction.do |txn2|
     txn1.commit      # txn1 and txn2 are both committed
  end
end


83
84
85
86
# File 'ext/lmdb_ext/lmdb_ext.c', line 83

static VALUE transaction_commit(VALUE self) {
        transaction_finish(self, 1);
        return Qnil;
}