From: Salvador Ortiz Date: Fri, 9 Aug 2013 16:03:28 +0000 (-0500) Subject: ITS#7660 Add mdb_txn_env to API X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~7^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=86551828abbafc90f52fc17ba095f48e28edab3b;p=openldap ITS#7660 Add mdb_txn_env to API --- diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 8bd341cca1..b18c099433 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -762,6 +762,12 @@ int mdb_env_get_maxkeysize(MDB_env *env); */ int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn); + /** @brief Returns the transaction's #MDB_env + * + * @param[in] txn A transaction handle returned by #mdb_txn_begin() + */ +MDB_env *mdb_txn_env(MDB_txn *txn); + /** @brief Commit all the operations of a transaction into the database. * * The transaction handle is freed. It and its cursors must not be used diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 02c7f067e3..e0916a1bf0 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2307,6 +2307,13 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) return rc; } +MDB_env * +mdb_txn_env(MDB_txn *txn) +{ + if(!txn) return NULL; + return txn->mt_env; +} + /** Export or close DBI handles opened in this txn. */ static void mdb_dbis_update(MDB_txn *txn, int keep)