Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/main/java/org/lmdbjava/Cursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,37 @@ public boolean first() {
return seek(MDB_FIRST);
}

/**
* Reposition the key/value buffers based on the passed key and operation.
*
* @param key to search for
* @param data to search for
* @param op options for this operation
* @return false if key not found
*/
public boolean get(final T key, final T data, final SeekOp op) {
if (SHOULD_CHECK) {
requireNonNull(key);
requireNonNull(op);
checkNotClosed();
txn.checkReady();
}
kv.keyIn(key);
kv.valIn(data);

final int rc = LIB.mdb_cursor_get(ptrCursor, kv.pointerKey(), kv
.pointerVal(), op.getCode());

if (rc == MDB_NOTFOUND) {
return false;
}

checkRc(rc);
kv.keyOut();
kv.valOut();
return true;
}

/**
* Reposition the key/value buffers based on the passed key and operation.
*
Expand Down