]> git.sur5r.net Git - openldap/commitdiff
ITS#7598 Tweak MDB_<NEXT/PREV>_NODUP,fix mdb_stat.
authorHallvard Furuseth <hallvard@openldap.org>
Tue, 21 May 2013 20:44:51 +0000 (22:44 +0200)
committerHallvard Furuseth <hallvard@openldap.org>
Tue, 21 May 2013 20:44:51 +0000 (22:44 +0200)
MDB_NEXT_NODUP, MDB_PREV_NODUP: Allow for non-MDB_DUPSORT databases.
No mdb.c code changes needed.

mdb_stat.c: Use MDB_NEXT_NODUP, to avoid a crash with a DUPSORT mainDB.

libraries/liblmdb/lmdb.h
libraries/liblmdb/mdb_stat.c

index 954ffde1cb2715a3288617331066f3a86be47807..53dab204614631953f47954398d70f44ea8a8642 100644 (file)
@@ -325,13 +325,11 @@ typedef enum MDB_cursor_op {
                                                                Only for #MDB_DUPSORT */
        MDB_NEXT_MULTIPLE,              /**< Return all duplicate data items at the next
                                                                cursor position. Only for #MDB_DUPFIXED */
-       MDB_NEXT_NODUP,                 /**< Position at first data item of next key.
-                                                               Only for #MDB_DUPSORT */
+       MDB_NEXT_NODUP,                 /**< Position at first data item of next key */
        MDB_PREV,                               /**< Position at previous data item */
        MDB_PREV_DUP,                   /**< Position at previous data item of current key.
                                                                Only for #MDB_DUPSORT */
-       MDB_PREV_NODUP,                 /**< Position at last data item of previous key.
-                                                               Only for #MDB_DUPSORT */
+       MDB_PREV_NODUP,                 /**< Position at last data item of previous key */
        MDB_SET,                                /**< Position at specified key */
        MDB_SET_KEY,                    /**< Position at specified key, return key + data */
        MDB_SET_RANGE                   /**< Position at first key greater than or equal to specified key. */
index dd0735f24265588c729d8296b5360199cb5e6387..ca6ad63955e9e7d024ca7d731622cdbd920d1f22 100644 (file)
@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
                        printf("mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
                        goto txn_abort;
                }
-               while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT)) == 0) {
+               while ((rc = mdb_cursor_get(cursor, &key, NULL, MDB_NEXT_NODUP)) == 0) {
                        char *str = malloc(key.mv_size+1);
                        MDB_dbi db2;
                        memcpy(str, key.mv_data, key.mv_size);