1 /* id2children.c - routines to deal with the id2children index */
11 #include "back-ldbm.h"
26 ldbm_datum_init( key );
28 Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %lu, %lu )\n",
29 p ? p->e_id : 0, e->e_id, 0 );
31 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
32 LDBM_WRCREAT )) == NULL ) {
33 Debug( LDAP_DEBUG_ANY,
34 "<= id2children_add -1 could not open \"id2children%s\"\n",
39 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
41 key.dsize = strlen( buf ) + 1;
43 if ( idl_insert_key( be, db, key, e->e_id ) != 0 ) {
44 Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
46 ldbm_cache_close( be, db );
50 ldbm_cache_close( be, db );
52 Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
70 Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %lu, %lu )\n", p ? p->e_id
73 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
74 LDBM_WRCREAT )) == NULL ) {
75 Debug( LDAP_DEBUG_ANY,
76 "<= id2children_remove -1 could not open \"id2children%s\"\n",
81 ldbm_datum_init( key );
82 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
84 key.dsize = strlen( buf ) + 1;
86 if ( idl_delete_key( be, db, key, e->e_id ) != 0 ) {
87 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove -1 (idl_insert)\n",
89 ldbm_cache_close( be, db );
93 ldbm_cache_close( be, db );
95 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove 0\n", 0, 0, 0 );
111 ldbm_datum_init( key );
113 Debug( LDAP_DEBUG_TRACE, "=> has_children( %lu )\n", p->e_id , 0, 0 );
115 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
116 LDBM_WRCREAT )) == NULL ) {
117 Debug( LDAP_DEBUG_ANY,
118 "<= has_children -1 could not open \"id2children%s\"\n",
123 sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id );
125 key.dsize = strlen( buf ) + 1;
127 idl = idl_fetch( be, db, key );
129 ldbm_cache_close( be, db );
133 Debug( LDAP_DEBUG_TRACE, "<= has_children %d\n", rc, 0, 0 );