Method: LMDB::Cursor#delete

Defined in:
ext/lmdb_ext/lmdb_ext.c

#delete(options) ⇒ Object

Delete current key/data pair. This function deletes the key/data pair to which the cursor refers.

Options Hash (options):

  • :nodupdata (Boolean)

    Delete all of the data items for the current key. This flag may only be specified if the database was opened with :dupsort.



1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
# File 'ext/lmdb_ext/lmdb_ext.c', line 1507

static VALUE cursor_delete(int argc, VALUE *argv, VALUE self) {
    CURSOR(self, cursor);

    VALUE option_hash;
#ifdef RB_SCAN_ARGS_KEYWORDS
    rb_scan_args_kw(RB_SCAN_ARGS_LAST_HASH_KEYWORDS,
                    argc, argv, ":", &option_hash);
#else
    rb_scan_args(argc, argv, ":", &option_hash);
#endif

    int flags = 0;
    if (!NIL_P(option_hash))
        rb_hash_foreach(option_hash, (int (*)(ANYARGS))cursor_delete_flags,
                        (VALUE)&flags);

    check(mdb_cursor_del(cursor->cur, flags));
    return Qnil;
}