]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9011 LMDB: add mdb_txn_flags()
authorChristopher Zimmermann <madroach@gmerlin.de>
Sat, 20 Apr 2019 21:06:51 +0000 (23:06 +0200)
committerHoward Chu <hyc@openldap.org>
Mon, 4 May 2026 13:48:56 +0000 (14:48 +0100)
libraries/liblmdb/lmdb.h
libraries/liblmdb/mdb.c

index 7d0d7e1023b3cb02bc0b227c1e95ee3e8032efb4..2653e5885f185621892b7ded19a15635aec1ca47 100644 (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
index 80654cd672c28a8ea43009155488770f3958e5dc..3424f15039cad2077ef9a5c4eec66b0bda427d69 100644 (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)