1 /* id2children.c - routines to deal with the id2children index */
5 #include <sys/socket.h>
9 struct dbcache *ldbm_cache_open();
10 extern Datum ldbm_cache_fetch();
27 memset( &key, 0, sizeof( key ) );
28 memset( &data, 0, sizeof( data ) );
31 Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %d, %d )\n", p ? p->e_id
34 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
35 LDBM_WRCREAT )) == NULL ) {
36 Debug( LDAP_DEBUG_ANY,
37 "<= id2children_add -1 could not open \"id2children%s\"\n",
42 sprintf( buf, "%c%d", EQ_PREFIX, p ? p->e_id : 0 );
44 key.dsize = strlen( buf ) + 1;
46 if ( idl_insert_key( be, db, key, e->e_id ) != 0 ) {
47 Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
49 ldbm_cache_close( be, db );
53 ldbm_cache_close( be, db );
55 Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
72 memset( &key, 0, sizeof( key ) );
75 Debug( LDAP_DEBUG_TRACE, "=> has_children( %d )\n", p->e_id , 0, 0 );
77 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
78 LDBM_WRCREAT )) == NULL ) {
79 Debug( LDAP_DEBUG_ANY,
80 "<= has_children -1 could not open \"id2children%s\"\n",
85 sprintf( buf, "%c%d", EQ_PREFIX, p->e_id );
87 key.dsize = strlen( buf ) + 1;
89 idl = idl_fetch( be, db, key );
91 ldbm_cache_close( be, db );
95 Debug( LDAP_DEBUG_TRACE, "<= has_children %d\n", rc, 0, 0 );