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 ) {
83 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove -1 (idl_delete)\n",
85 ldbm_cache_close( be, db );
89 ldbm_cache_close( be, db );
91 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove 0\n", 0, 0, 0 );
107 ldbm_datum_init( key );
109 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
111 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
112 LDBM_WRCREAT )) == NULL ) {
113 Debug( LDAP_DEBUG_ANY,
114 "<= has_children -1 could not open \"id2children%s\"\n",
119 sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id );
121 key.dsize = strlen( buf ) + 1;
123 idl = idl_fetch( be, db, key );
125 ldbm_cache_close( be, db );
132 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
133 p->e_id, rc ? "yes" : "no", 0 );