ITS#9011 LMDB: add mdb_txn_flags()

This commit is contained in:
Christopher Zimmermann 2019-04-20 23:06:51 +02:00 committed by Howard Chu
parent f8ec414d7d
commit 11ebc033d2
2 changed files with 15 additions and 0 deletions

View file

@ -1177,6 +1177,14 @@ MDB_env *mdb_txn_env(MDB_txn *txn);
*/
mdb_size_t mdb_txn_id(MDB_txn *txn);
/** @brief Retrieve the transaction's flags
*
* @param[in] txn A transaction handle returned by #mdb_txn_begin()
* @param[out] flags Address where the flags will be returned.
* @return A non-zero error value on failure and 0 on success.
*/
int mdb_txn_flags(MDB_txn *txn, unsigned int *flags);
/** @brief Commit all the operations of a transaction into the database.
*
* The transaction handle is freed. It and its cursors must not be used

View file

@ -3642,6 +3642,13 @@ mdb_txn_id(MDB_txn *txn)
return txn->mt_txnid;
}
int mdb_txn_flags(MDB_txn *txn, unsigned int *flags)
{
if(!txn) return EINVAL;
*flags = txn->mt_flags & MDB_RDONLY;
return MDB_SUCCESS;
}
/** Export or close DBI handles opened in this txn. */
static void
mdb_dbis_update(MDB_txn *txn, int keep)