2018-12-14 23:00:44 +01:00
|
|
|
#include "lmdb-typed.hh"
|
2018-12-16 20:28:49 +01:00
|
|
|
|
2022-01-18 22:08:36 +01:00
|
|
|
namespace LMDBSafe {
|
|
|
|
|
2022-01-30 21:14:43 +01:00
|
|
|
unsigned int MDBGetMaxID(MDBRWTransaction &txn, MDBDbi &dbi)
|
2018-12-14 23:00:44 +01:00
|
|
|
{
|
2022-01-30 21:14:43 +01:00
|
|
|
auto cursor = txn->getRWCursor(dbi);
|
|
|
|
MDBOutVal maxidval, maxcontent;
|
|
|
|
unsigned int maxid{ 0 };
|
|
|
|
if (!cursor.get(maxidval, maxcontent, MDB_LAST)) {
|
|
|
|
maxid = maxidval.get<unsigned int>();
|
|
|
|
}
|
|
|
|
return maxid;
|
2018-12-14 23:00:44 +01:00
|
|
|
}
|
|
|
|
|
2022-01-30 21:14:43 +01:00
|
|
|
} // namespace LMDBSafe
|