]> git.sur5r.net Git - openldap/blobdiff - libraries/liblmdb/mdb.c
Add MDB_PREV_MULTIPLE (collected mdb.master changes)
[openldap] / libraries / liblmdb / mdb.c
index 465cf0dc00adc04cc3ebf536752ecb5bd9ee6b49..7d34276566a27158c7b5632db72c36f83f104c98 100644 (file)
@@ -1437,7 +1437,7 @@ mdb_strerror(int err)
         *      and the actual use of the message uses more than 4K of stack.
         */
 #define MSGSIZE        1024
-#define PADSIZE 4096
+#define PADSIZE        4096
        char buf[MSGSIZE+PADSIZE], *ptr = buf;
 #endif
        int i;
@@ -6215,6 +6215,30 @@ fetchm:
                        }
                }
                break;
+       case MDB_PREV_MULTIPLE:
+               if (data == NULL) {
+                       rc = EINVAL;
+                       break;
+               }
+               if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) {
+                       rc = MDB_INCOMPATIBLE;
+                       break;
+               }
+               if (!(mc->mc_flags & C_INITIALIZED))
+                       rc = mdb_cursor_last(mc, key, data);
+               else
+                       rc = MDB_SUCCESS;
+               if (rc == MDB_SUCCESS) {
+                       MDB_cursor *mx = &mc->mc_xcursor->mx_cursor;
+                       if (mx->mc_flags & C_INITIALIZED) {
+                               rc = mdb_cursor_sibling(mx, 0);
+                               if (rc == MDB_SUCCESS)
+                                       goto fetchm;
+                       } else {
+                               rc = MDB_NOTFOUND;
+                       }
+               }
+               break;
        case MDB_NEXT:
        case MDB_NEXT_DUP:
        case MDB_NEXT_NODUP: