Skip to content
Open
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
34 changes: 34 additions & 0 deletions lmdbjni/src/main/java/org/fusesource/lmdbjni/BufferCursor.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,17 @@ public void delete() {
cursor.delete();
}


/**
* <p>
* Delete key/data. Only for
* {@link org.fusesource.lmdbjni.Constants#DUPSORT}.
* </p>
*/
public void deleteDup() {
cursor.deleteIncludingDups();
}

/**
* Close the cursor and the transaction.
*/
Expand Down Expand Up @@ -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.
Expand Down