1 /* id2children.c - routines to deal with the id2children index */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
13 #include <ac/socket.h>
16 #include "back-ldbm.h"
29 ldbm_datum_init( key );
32 LDAP_LOG( INDEX, ENTRY, "has_children: enter %ld\n", p->e_id, 0, 0 );
34 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
38 if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX,
39 LDBM_WRCREAT )) == NULL ) {
42 "has_children: could not open \"dn2id%s\"\n", LDBM_SUFFIX, 0, 0 );
44 Debug( LDAP_DEBUG_ANY,
45 "<= has_children -1 could not open \"dn2id%s\"\n",
52 key.dsize = strlen( p->e_ndn ) + 2;
53 key.dptr = ch_malloc( key.dsize );
54 sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, p->e_ndn );
56 idl = idl_fetch( be, db, key );
60 ldbm_cache_close( be, db );
68 LDAP_LOG( INDEX, ENTRY,
69 "has_children: id (%ld) %s children.\n",
70 p->e_id, rc ? "has" : "doesn't have", 0 );
72 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
73 p->e_id, rc ? "yes" : "no", 0 );