prepare for DUP cursors

without.crypto
Niko 2 years ago
parent 60d8c0e0ea
commit 7062768d11
  1. 2
      lmdb-sys/lmdb
  2. 5
      src/cursor.rs

@ -1 +1 @@
Subproject commit aeb6b34ea0c89cbd70caffa0d647079fd831c208 Subproject commit 4d66bccd20aad277044ed35dbae7e6b732a65b58

@ -134,7 +134,7 @@ pub trait Cursor<'txn> {
Ok(_) | Err(Error::NotFound) => (), Ok(_) | Err(Error::NotFound) => (),
Err(error) => return IterPrevDup::Err(error), Err(error) => return IterPrevDup::Err(error),
}; };
IterPrevDup::new(self.cursor(), ffi::MDB_PREV) IterPrevDup::new(self.cursor(), ffi::MDB_PREV_NODUP)
} }
/// Iterate over the duplicates of the item in the database with the given key. /// Iterate over the duplicates of the item in the database with the given key.
@ -221,7 +221,7 @@ impl<'txn> Drop for RwCursor<'txn> {
} }
impl<'txn> RwCursor<'txn> { impl<'txn> RwCursor<'txn> {
/// Creates a new read-only cursor in the given database and transaction. /// Creates a new read-write cursor in the given database and transaction.
/// Prefer using `RwTransaction::open_rw_cursor`. /// Prefer using `RwTransaction::open_rw_cursor`.
pub(crate) fn new<T>(txn: &'txn T, db: Database) -> Result<RwCursor<'txn>> pub(crate) fn new<T>(txn: &'txn T, db: Database) -> Result<RwCursor<'txn>>
where where
@ -508,7 +508,6 @@ impl<'txn> Iterator for IterPrevDup<'txn> {
}; };
let op = mem::replace(op, ffi::MDB_PREV_NODUP); let op = mem::replace(op, ffi::MDB_PREV_NODUP);
let err_code = unsafe { ffi::mdb_cursor_get(cursor, &mut key, &mut data, op) }; let err_code = unsafe { ffi::mdb_cursor_get(cursor, &mut key, &mut data, op) };
if err_code == ffi::MDB_SUCCESS { if err_code == ffi::MDB_SUCCESS {
Some(Iter::new(cursor, ffi::MDB_GET_CURRENT, ffi::MDB_PREV_DUP)) Some(Iter::new(cursor, ffi::MDB_GET_CURRENT, ffi::MDB_PREV_DUP))
} else { } else {

Loading…
Cancel
Save