diff --git a/lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java b/lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java index 067edf5..5cd9756 100644 --- a/lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java +++ b/lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java @@ -320,6 +320,17 @@ public void delete() { cursor.delete(); } + + /** + *
+ * Delete key/data. Only for + * {@link org.fusesource.lmdbjni.Constants#DUPSORT}. + *
+ */ + public void deleteDup() { + cursor.deleteIncludingDups(); + } + /** * Close the cursor and the transaction. */ @@ -350,6 +361,29 @@ public boolean put() { } } + + /** + * general purpose put method, so client can have more control + * of the flag they need. + */ + public boolean put(int flag) { + DirectBuffer k = (keyWriteIndex != 0) ? + new DirectBuffer(key.addressOffset(), keyWriteIndex) : key; + DirectBuffer v = (valWriteIndex != 0) ? + new DirectBuffer(value.addressOffset(), valWriteIndex) : value; + keyWriteIndex = 0; + valWriteIndex = 0; + int rc = cursor.put(k, v, flag); + if (rc == 0) { + return true; + } else { + String msg = Util.string(mdb_strerror(rc)); + throw new LMDBException(msg, rc); + } + } + + + /** * Stores key/data pairs in the database replacing any * previously existing key. Also used for adding duplicates.