Constant lmdb_zero::del::NODUPDATA
[−]
pub const NODUPDATA: Flags=
Flags{bits: ffi::MDB_NODUPDATA,}
Delete all of the data items for the current key instead of
just the current item. This flag may only be specified if the
database was opened with DUPSORT
.
Example
let db = lmdb::Database::open( &env, Some("reversed"), &lmdb::DatabaseOptions::create_multimap_unsized::<str,str>()) .unwrap(); let txn = lmdb::WriteTransaction::new(&env).unwrap(); { let mut access = txn.access(); let f = lmdb::put::Flags::empty(); access.put(&db, "Fruit", "Apple", f).unwrap(); access.put(&db, "Fruit", "Orange", f).unwrap(); access.put(&db, "Fruit", "Durian", f).unwrap(); let mut cursor = txn.cursor(&db).unwrap(); cursor.seek_kv("Fruit", "Durian").unwrap(); // By default, only the current item is deleted. cursor.del(&mut access, lmdb::del::Flags::empty()).unwrap(); cursor.seek_k::<str,str>(&access, "Fruit").unwrap(); assert_eq!(2, cursor.count().unwrap()); // But with `NODUPDATA`, they will all go away cursor.del(&mut access, lmdb::del::NODUPDATA).unwrap(); assert!(cursor.seek_k::<str,str>(&access, "Fruit").is_err()); } txn.commit().unwrap();