1 /* id2children.c - routines to deal with the id2children index */
11 #include "back-ldbm.h"
26 #ifdef HAVE_BERKELEY_DB2
28 memset( &key, 0, sizeof( key ) );
29 memset( &data, 0, sizeof( data ) );
32 Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %lu, %lu )\n",
33 p ? p->e_id : 0, e->e_id, 0 );
35 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
36 LDBM_WRCREAT )) == NULL ) {
37 Debug( LDAP_DEBUG_ANY,
38 "<= id2children_add -1 could not open \"id2children%s\"\n",
43 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
45 key.dsize = strlen( buf ) + 1;
47 if ( idl_insert_key( be, db, key, e->e_id ) != 0 ) {
48 Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
50 ldbm_cache_close( be, db );
54 ldbm_cache_close( be, db );
56 Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
74 Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %lu, %lu )\n", p ? p->e_id
77 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
78 LDBM_WRCREAT )) == NULL ) {
79 Debug( LDAP_DEBUG_ANY,
80 "<= id2children_remove -1 could not open \"id2children%s\"\n",
85 memset( &key, 0, sizeof(key) );
86 sprintf( buf, "%c%ld", EQ_PREFIX, p ? p->e_id : 0 );
88 key.dsize = strlen( buf ) + 1;
90 if ( idl_delete_key( be, db, key, e->e_id ) != 0 ) {
91 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove -1 (idl_insert)\n",
93 ldbm_cache_close( be, db );
97 ldbm_cache_close( be, db );
99 Debug( LDAP_DEBUG_TRACE, "<= id2children_remove 0\n", 0, 0, 0 );
115 #ifdef HAVE_BERKELEY_DB2
116 memset( &key, 0, sizeof( key ) );
119 Debug( LDAP_DEBUG_TRACE, "=> has_children( %lu )\n", p->e_id , 0, 0 );
121 if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
122 LDBM_WRCREAT )) == NULL ) {
123 Debug( LDAP_DEBUG_ANY,
124 "<= has_children -1 could not open \"id2children%s\"\n",
129 sprintf( buf, "%c%ld", EQ_PREFIX, p->e_id );
131 key.dsize = strlen( buf ) + 1;
133 idl = idl_fetch( be, db, key );
135 ldbm_cache_close( be, db );
139 Debug( LDAP_DEBUG_TRACE, "<= has_children %d\n", rc, 0, 0 );