1 /* id2children.c - routines to deal with the id2children index */
11 #include "back-ldbm.h"
26 #ifdef HAVE_BERKELEY_DB2
29 ldbm_datum_init( key );
30 ldbm_datum_init( data );
33 Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %lu, %lu )\n",
34 p ? p->e_id : 0, e->e_id, 0 );
36 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
37 LDBM_WRCREAT )) == NULL ) {
38 Debug( LDAP_DEBUG_ANY,
39 "<= id2children_add -1 could not open \"id2children%s\"\n",
44 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
46 key.dsize = strlen( buf ) + 1;
48 if ( idl_insert_key( be, db, key, e->e_id ) != 0 ) {
49 Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
51 ldbm_cache_close( be, db );
55 ldbm_cache_close( be, db );
57 Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
75 Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %lu, %lu )\n", p ? p->e_id
78 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
79 LDBM_WRCREAT )) == NULL ) {
80 Debug( LDAP_DEBUG_ANY,
81 "<= id2children_remove -1 could not open \"id2children%s\"\n",
86 ldbm_datum_init( key );
87 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
89 key.dsize = strlen( buf ) + 1;
91 if ( idl_delete_key( be, db, key, e->e_id ) != 0 ) {
92 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove -1 (idl_insert)\n",
94 ldbm_cache_close( be, db );
98 ldbm_cache_close( be, db );
100 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove 0\n", 0, 0, 0 );
116 ldbm_datum_init( key );
118 Debug( LDAP_DEBUG_TRACE, "=> has_children( %lu )\n", p->e_id , 0, 0 );
120 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
121 LDBM_WRCREAT )) == NULL ) {
122 Debug( LDAP_DEBUG_ANY,
123 "<= has_children -1 could not open \"id2children%s\"\n",
128 sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id );
130 key.dsize = strlen( buf ) + 1;
132 idl = idl_fetch( be, db, key );
134 ldbm_cache_close( be, db );
138 Debug( LDAP_DEBUG_TRACE, "<= has_children %d\n", rc, 0, 0 );