Resource class for MDB_dbi
handles.
More...
#include <lmdb++.h>
|
| dbi () noexcept |
| Constructor. More...
|
|
| dbi (const MDB_dbi handle) noexcept |
| Constructor. 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...
|
|
bool | get (MDB_txn *const txn, const std::string_view key, std::string_view &data) |
| Retrieves a key/value pair from this database. More...
|
|
bool | put (MDB_txn *const txn, const std::string_view key, std::string_view data, const unsigned int flags=default_put_flags) |
| Stores a key/value pair into this database. More...
|
|
bool | del (MDB_txn *const txn, const std::string_view key) |
| Removes a key from this database. More...
|
|
bool | del (MDB_txn *const txn, const std::string_view key, const std::string_view val) |
| Removes a key/value pair from this database. More...
|
|
|
MDB_dbi | _handle {(std::numeric_limits<MDB_dbi>::max)()} |
|
◆ dbi() [1/2]
Constructor.
- Note
- Creates an uninitialized dbi instance. You must move or move-assign a valid dbi instance onto it before you can use it.
◆ dbi() [2/2]
lmdb::dbi::dbi |
( |
const MDB_dbi |
handle | ) |
|
|
inlinenoexcept |
Constructor.
- Parameters
-
handle | a valid MDB_dbi handle |
◆ ~dbi()
◆ del() [1/2]
bool lmdb::dbi::del |
( |
MDB_txn *const |
txn, |
|
|
const std::string_view |
key |
|
) |
| |
|
inline |
Removes a key from this database.
- Parameters
-
txn | a transaction handle |
key | |
- Exceptions
-
◆ del() [2/2]
bool lmdb::dbi::del |
( |
MDB_txn *const |
txn, |
|
|
const std::string_view |
key, |
|
|
const std::string_view |
val |
|
) |
| |
|
inline |
Removes a key/value pair from this database.
- Parameters
-
txn | a transaction handle |
key | |
val | |
- Exceptions
-
◆ drop()
void lmdb::dbi::drop |
( |
MDB_txn *const |
txn, |
|
|
const bool |
del = false |
|
) |
| |
|
inline |
- Parameters
-
txn | a transaction handle |
del | |
- Exceptions
-
◆ flags()
unsigned int lmdb::dbi::flags |
( |
MDB_txn *const |
txn | ) |
const |
|
inline |
Retrieves the flags for this database handle.
- Parameters
-
- Exceptions
-
◆ get()
bool lmdb::dbi::get |
( |
MDB_txn *const |
txn, |
|
|
const std::string_view |
key, |
|
|
std::string_view & |
data |
|
) |
| |
|
inline |
Retrieves a key/value pair from this database.
- Parameters
-
txn | a transaction handle |
key | |
data | |
- Exceptions
-
◆ handle()
MDB_dbi lmdb::dbi::handle |
( |
| ) |
const |
|
inlinenoexcept |
Returns the underlying MDB_dbi
handle.
◆ open()
static dbi lmdb::dbi::open |
( |
MDB_txn *const |
txn, |
|
|
const char *const |
name = nullptr , |
|
|
const unsigned int |
flags = default_flags |
|
) |
| |
|
inlinestatic |
Opens a database handle.
- Parameters
-
txn | the transaction handle |
name | |
flags | |
- Exceptions
-
◆ operator MDB_dbi()
lmdb::dbi::operator MDB_dbi |
( |
| ) |
const |
|
inlinenoexcept |
Returns the underlying MDB_dbi
handle.
◆ put()
bool lmdb::dbi::put |
( |
MDB_txn *const |
txn, |
|
|
const std::string_view |
key, |
|
|
std::string_view |
data, |
|
|
const unsigned int |
flags = default_put_flags |
|
) |
| |
|
inline |
Stores a key/value pair into this database.
- Parameters
-
txn | a transaction handle |
key | |
data | |
flags | |
- Exceptions
-
◆ set_compare()
dbi & lmdb::dbi::set_compare |
( |
MDB_txn *const |
txn, |
|
|
MDB_cmp_func *const |
cmp = nullptr |
|
) |
| |
|
inline |
Sets a custom key comparison function for this database.
- Parameters
-
txn | a transaction handle |
cmp | the comparison function |
- Exceptions
-
◆ size()
std::size_t lmdb::dbi::size |
( |
MDB_txn *const |
txn | ) |
const |
|
inline |
Returns the number of records in this database.
- Parameters
-
- Exceptions
-
◆ stat()
MDB_stat lmdb::dbi::stat |
( |
MDB_txn *const |
txn | ) |
const |
|
inline |
Returns statistics for this database.
- Parameters
-
- Exceptions
-
◆ _handle
MDB_dbi lmdb::dbi::_handle {(std::numeric_limits<MDB_dbi>::max)()} |
|
protected |
◆ default_flags
constexpr unsigned int lmdb::dbi::default_flags = 0 |
|
staticconstexpr |
◆ default_put_flags
constexpr unsigned int lmdb::dbi::default_put_flags = 0 |
|
staticconstexpr |
The documentation for this class was generated from the following file: