Skip to content

Nontemplate version of key-only dbi::get() #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
23 changes: 23 additions & 0 deletions lmdb++.h
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,19 @@ class lmdb::dbi {
return lmdb::dbi_get(txn, handle(), key, data);
}

/**
* Retrieves a key from this database.
*
* @param txn a transaction handle
* @param key
* @throws lmdb::error on failure
*/
bool get(MDB_txn* const txn,
const val& key) const {
lmdb::val v{};
return lmdb::dbi_get(txn, handle(), key, v);
}

/**
* Retrieves a key from this database.
*
Expand Down Expand Up @@ -1893,6 +1906,16 @@ class lmdb::cursor {
return found;
}

/**
* Removes current key/value pair from this database.
*
* @param flags Allows MDB_NODUPDATA if the database was opened with MDB_DUPSORT
* @throws lmdb::error on failure
*/
void del(const unsigned int flags = 0) {
lmdb::cursor_del(handle(), flags);
}

/**
* Positions this cursor at the given key.
*
Expand Down