Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
f24d7d2c
Commit
f24d7d2c
authored
Jan 07, 2016
by
Howard Chu
Committed by
Hallvard Furuseth
Dec 15, 2016
Browse files
Add MDB_PREV_MULTIPLE (collected mdb.master changes)
Logical counterpart to GET_MULTIPLE, NEXT_MULTIPLE
parent
fe2b1cd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/lmdb.h
View file @
f24d7d2c
...
...
@@ -388,7 +388,9 @@ typedef enum MDB_cursor_op {
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. */
MDB_SET_RANGE
,
/**< Position at first key greater than or equal to specified key. */
MDB_PREV_MULTIPLE
/**< Position at previous page and return key and up to
a page of duplicate data items. Only for #MDB_DUPFIXED */
}
MDB_cursor_op
;
/** @defgroup errors Return Codes
...
...
@@ -1095,8 +1097,9 @@ int mdb_txn_renew(MDB_txn *txn);
* This flag may only be used in combination with #MDB_DUPSORT. This option
* tells the library that the data items for this database are all the same
* size, which allows further optimizations in storage and retrieval. When
* all data items are the same size, the #MDB_GET_MULTIPLE and #MDB_NEXT_MULTIPLE
* cursor operations may be used to retrieve multiple items at once.
* all data items are the same size, the #MDB_GET_MULTIPLE, #MDB_NEXT_MULTIPLE
* and #MDB_PREV_MULTIPLE cursor operations may be used to retrieve multiple
* items at once.
* <li>#MDB_INTEGERDUP
* This option specifies that duplicate data items are binary integers,
* similar to #MDB_INTEGERKEY keys.
...
...
libraries/liblmdb/mdb.c
View file @
f24d7d2c
...
...
@@ -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
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment