mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-21 14:25:24 -05:00
Merge remote-tracking branch 'origin/mdb.master'
This commit is contained in:
commit
79ac4cb361
5 changed files with 584 additions and 172 deletions
|
|
@ -309,7 +309,7 @@ typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *rel
|
|||
#define MDB_APPEND 0x20000
|
||||
/** Duplicate data is being appended, don't split full pages. */
|
||||
#define MDB_APPENDDUP 0x40000
|
||||
/** Store multiple data items in one call. */
|
||||
/** Store multiple data items in one call. Only for #MDB_DUPFIXED. */
|
||||
#define MDB_MULTIPLE 0x80000
|
||||
/* @} */
|
||||
|
||||
|
|
@ -1210,6 +1210,16 @@ int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data,
|
|||
* correct order. Loading unsorted keys with this flag will cause
|
||||
* data corruption.
|
||||
* <li>#MDB_APPENDDUP - as above, but for sorted dup data.
|
||||
* <li>#MDB_MULTIPLE - store multiple contiguous data elements in a
|
||||
* single request. This flag may only be specified if the database
|
||||
* was opened with #MDB_DUPFIXED. The \b data argument must be an
|
||||
* array of two MDB_vals. The mv_size of the first MDB_val must be
|
||||
* the size of a single data element. The mv_data of the first MDB_val
|
||||
* must point to the beginning of the array of contiguous data elements.
|
||||
* The mv_size of the second MDB_val must be the count of the number
|
||||
* of data elements to store. On return this field will be set to
|
||||
* the count of the number of elements actually written. The mv_data
|
||||
* of the second MDB_val is unused.
|
||||
* </ul>
|
||||
* @return A non-zero error value on failure and 0 on success. Some possible
|
||||
* errors are:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -31,8 +31,7 @@
|
|||
*/
|
||||
#define CMP(x,y) ( (x) < (y) ? -1 : (x) > (y) )
|
||||
|
||||
#if 0 /* superseded by append/sort */
|
||||
static unsigned mdb_midl_search( MDB_IDL ids, MDB_ID id )
|
||||
unsigned mdb_midl_search( MDB_IDL ids, MDB_ID id )
|
||||
{
|
||||
/*
|
||||
* binary search of id in ids
|
||||
|
|
@ -67,6 +66,7 @@ static unsigned mdb_midl_search( MDB_IDL ids, MDB_ID id )
|
|||
return cursor;
|
||||
}
|
||||
|
||||
#if 0 /* superseded by append/sort */
|
||||
int mdb_midl_insert( MDB_IDL ids, MDB_ID id )
|
||||
{
|
||||
unsigned x, i;
|
||||
|
|
|
|||
|
|
@ -74,14 +74,12 @@ typedef MDB_ID *MDB_IDL;
|
|||
xidl[xlen] = (id); \
|
||||
} while (0)
|
||||
|
||||
#if 0 /* superseded by append/sort */
|
||||
/** Insert an ID into an IDL.
|
||||
* @param[in,out] ids The IDL to insert into.
|
||||
* @param[in] id The ID to insert.
|
||||
* @return 0 on success, -1 if ID was already present, -2 on error.
|
||||
/** Search for an ID in an IDL.
|
||||
* @param[in] ids The IDL to search.
|
||||
* @param[in] id The ID to search for.
|
||||
* @return The index of the first ID greater than or equal to \b id.
|
||||
*/
|
||||
int mdb_midl_insert( MDB_IDL ids, MDB_ID id );
|
||||
#endif
|
||||
unsigned mdb_midl_search( MDB_IDL ids, MDB_ID id );
|
||||
|
||||
/** Allocate an IDL.
|
||||
* Allocates memory for an IDL of the given size.
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ int main(int argc,char * argv[])
|
|||
rc = mdb_cursor_open(txn, dbi, &cur2);
|
||||
for (i=0; i<50; i++) {
|
||||
rc = mdb_cursor_get(cur2, &key, &data, MDB_NEXT);
|
||||
if (rc)
|
||||
break;
|
||||
printf("key: %p %.*s, data: %p %.*s\n",
|
||||
key.mv_data, (int) key.mv_size, (char *) key.mv_data,
|
||||
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
|
||||
|
|
@ -142,6 +144,7 @@ int main(int argc,char * argv[])
|
|||
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
|
||||
for (i=0; i<32; i++) {
|
||||
rc = mdb_cursor_get(cur2, &key, &data, MDB_NEXT);
|
||||
if (rc) break;
|
||||
printf("key: %p %.*s, data: %p %.*s\n",
|
||||
key.mv_data, (int) key.mv_size, (char *) key.mv_data,
|
||||
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
|
||||
|
|
@ -158,6 +161,7 @@ int main(int argc,char * argv[])
|
|||
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
|
||||
for (i=0; i<32; i++) {
|
||||
rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT);
|
||||
if (rc) break;
|
||||
printf("key: %p %.*s, data: %p %.*s\n",
|
||||
key.mv_data, (int) key.mv_size, (char *) key.mv_data,
|
||||
data.mv_data, (int) data.mv_size, (char *) data.mv_data);
|
||||
|
|
|
|||
Loading…
Reference in a new issue