1 /* id2children.c - routines to deal with the id2children index */
11 #include "back-ldbm.h"
24 ldbm_datum_init( key );
26 Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %ld, %ld )\n",
27 p ? p->e_id : 0, e->e_id, 0 );
29 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
30 LDBM_WRCREAT )) == NULL ) {
31 Debug( LDAP_DEBUG_ANY,
32 "<= id2children_add -1 could not open \"id2children%s\"\n",
37 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
39 key.dsize = strlen( buf ) + 1;
41 if ( idl_insert_key( be, db, key, e->e_id ) != 0 ) {
42 Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
44 ldbm_cache_close( be, db );
48 ldbm_cache_close( be, db );
50 Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
66 Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %ld, %ld )\n", p ? p->e_id
69 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
70 LDBM_WRCREAT )) == NULL ) {
71 Debug( LDAP_DEBUG_ANY,
72 "<= id2children_remove -1 could not open \"id2children%s\"\n",
77 ldbm_datum_init( key );
78 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
80 key.dsize = strlen( buf ) + 1;
82 if ( idl_delete_key( be, db, key, e->e_id ) != 0 ) {
84 Debug( LDAP_DEBUG_ANY,
85 "<= id2children_remove: idl_delete_key failure\n",
87 ldbm_cache_close( be, db );
90 Debug( LDAP_DEBUG_ANY,
91 "<= id2children_remove: ignoring idl_delete_key failure\n",
96 ldbm_cache_close( be, db );
98 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove 0\n", 0, 0, 0 );
114 ldbm_datum_init( key );
116 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
118 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
119 LDBM_WRCREAT )) == NULL ) {
120 Debug( LDAP_DEBUG_ANY,
121 "<= has_children -1 could not open \"id2children%s\"\n",
126 sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id );
128 key.dsize = strlen( buf ) + 1;
130 idl = idl_fetch( be, db, key );
132 ldbm_cache_close( be, db );
139 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
140 p->e_id, rc ? "yes" : "no", 0 );