lmdb++
|
Resource class for MDB_dbi
handles.
More...
#include <lmdb++.h>
Public Member Functions | |
dbi (const MDB_dbi handle) noexcept | |
Constructor. More... | |
dbi (dbi &&other) noexcept | |
Move constructor. More... | |
dbi & | operator= (dbi &&other) noexcept |
Move assignment operator. More... | |
~dbi () noexcept | |
Destructor. More... | |
operator MDB_dbi () const noexcept | |
Returns the underlying MDB_dbi handle. More... | |
MDB_dbi | handle () const noexcept |
Returns the underlying MDB_dbi handle. More... | |
MDB_stat | stat (MDB_txn *const txn) const |
Returns statistics for this database. More... | |
unsigned int | flags (MDB_txn *const txn) const |
Retrieves the flags for this database handle. More... | |
std::size_t | size (MDB_txn *const txn) const |
Returns the number of records in this database. More... | |
void | drop (MDB_txn *const txn, const bool del=false) |
dbi & | set_compare (MDB_txn *const txn, MDB_cmp_func *const cmp=nullptr) |
Sets a custom key comparison function for this database. More... | |
template<typename K > | |
bool | get (MDB_txn *const txn, const K &key) const |
Retrieves a key from this database. More... | |
template<typename K , typename V > | |
bool | get (MDB_txn *const txn, const K &key, V &val) const |
Retrieves a key/value pair from this database. More... | |
template<typename V > | |
bool | get (MDB_txn *const txn, const char *const key, V &val) const |
Retrieves a key/value pair from this database. More... | |
template<typename K > | |
bool | put (MDB_txn *const txn, const K &key, const unsigned int flags=default_put_flags) |
Stores a key into this database. More... | |
template<typename K , typename V > | |
bool | put (MDB_txn *const txn, const K &key, const V &val, const unsigned int flags=default_put_flags) |
Stores a key/value pair into this database. More... | |
template<typename V > | |
bool | put (MDB_txn *const txn, const char *const key, const V &val, const unsigned int flags=default_put_flags) |
Stores a key/value pair into this database. More... | |
bool | put (MDB_txn *const txn, const char *const key, const char *const val, const unsigned int flags=default_put_flags) |
Stores a key/value pair into this database. More... | |
template<typename K > | |
bool | del (MDB_txn *const txn, const K &key) |
Removes a key/value pair from this database. More... | |
Static Public Member Functions | |
static dbi | open (MDB_txn *const txn, const char *const name=nullptr, const unsigned int flags=default_flags) |
Opens a database handle. More... | |
Static Public Attributes | |
static constexpr unsigned int | default_flags = 0 |
static constexpr unsigned int | default_put_flags = 0 |
Protected Attributes | |
MDB_dbi | _handle {0} |
Resource class for MDB_dbi
handles.
|
inlinenoexcept |
Constructor.
handle | a valid MDB_dbi handle |
|
inlinenoexcept |
Move constructor.
|
inlinenoexcept |
Destructor.
|
inline |
Removes a key/value pair from this database.
txn | a transaction handle |
key |
lmdb::error | on failure |
|
inline |
txn | a transaction handle |
del |
lmdb::error | on failure |
|
inline |
Retrieves the flags for this database handle.
txn | a transaction handle |
lmdb::error | on failure |
|
inline |
Retrieves a key from this database.
txn | a transaction handle |
key |
lmdb::error | on failure |
|
inline |
Retrieves a key/value pair from this database.
txn | a transaction handle |
key | |
val |
lmdb::error | on failure |
|
inline |
Retrieves a key/value pair from this database.
txn | a transaction handle |
key | a NUL-terminated string key |
val |
lmdb::error | on failure |
|
inlinenoexcept |
Returns the underlying MDB_dbi
handle.
|
inlinestatic |
Opens a database handle.
txn | the transaction handle |
name | |
flags |
lmdb::error | on failure |
|
inlinenoexcept |
Returns the underlying MDB_dbi
handle.
|
inline |
Stores a key into this database.
txn | a transaction handle |
key | |
flags |
lmdb::error | on failure |
|
inline |
Stores a key/value pair into this database.
txn | a transaction handle |
key | |
val | |
flags |
lmdb::error | on failure |
|
inline |
Stores a key/value pair into this database.
txn | a transaction handle |
key | a NUL-terminated string key |
val | |
flags |
lmdb::error | on failure |
|
inline |
Stores a key/value pair into this database.
txn | a transaction handle |
key | a NUL-terminated string key |
val | a NUL-terminated string key |
flags |
lmdb::error | on failure |
|
inline |
Sets a custom key comparison function for this database.
txn | a transaction handle |
cmp | the comparison function |
lmdb::error | on failure |
|
inline |
Returns the number of records in this database.
txn | a transaction handle |
lmdb::error | on failure |
|
inline |
Returns statistics for this database.
txn | a transaction handle |
lmdb::error | on failure |
|
protected |
|
static |
|
static |