lmdb-safe/lmdb-typed.cc

17 lines
369 B
C++
Raw Normal View History

#include "lmdb-typed.hh"
2018-12-16 20:28:49 +01:00
2022-01-18 22:08:36 +01:00
namespace LMDBSafe {
unsigned int MDBGetMaxID(MDBRWTransaction &txn, MDBDbi &dbi)
{
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;
}
} // namespace LMDBSafe