2018-12-14 23:00:44 +01:00
|
|
|
#include "lmdb-typed.hh"
|
2018-12-16 20:28:49 +01:00
|
|
|
|
2018-12-17 14:56:01 +01:00
|
|
|
unsigned int MDBGetMaxID(MDBRWTransaction& txn, MDBDbi& dbi)
|
2018-12-14 23:00:44 +01:00
|
|
|
{
|
2019-10-26 11:42:38 +02:00
|
|
|
auto cursor = txn->getRWCursor(dbi);
|
2018-12-14 23:00:44 +01:00
|
|
|
MDBOutVal maxidval, maxcontent;
|
|
|
|
unsigned int maxid{0};
|
|
|
|
if(!cursor.get(maxidval, maxcontent, MDB_LAST)) {
|
|
|
|
maxid = maxidval.get<unsigned int>();
|
|
|
|
}
|
|
|
|
return maxid;
|
|
|
|
}
|
|
|
|
|
|
|
|
|