From 7d8330fd40fd3822c66398f9a78eeb26d86ab640 Mon Sep 17 00:00:00 2001 From: Juan Gomez Date: Fri, 11 Jun 1999 20:42:48 +0000 Subject: [PATCH] Added code for uniform naming of index files. --- servers/slapd/back-ldbm/index.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 8561da7040..c4587af153 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -47,6 +47,7 @@ index_add_entry( /* add each attribute to the indexes */ for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) { + index_add_values( be, ap->a_type, ap->a_vals, e->e_id ); } @@ -103,6 +104,8 @@ index_read( char *realval, *tmpval; char buf[BUFSIZ]; + char *at_on; + ldbm_datum_init( key ); prefix = index2prefix( indextype ); @@ -119,10 +122,12 @@ index_read( } attr_normalize( type ); - if ( (db = ldbm_cache_open( be, type, LDBM_SUFFIX, LDBM_WRCREAT )) + at_on = at_official_name( type ); + + if ( (db = ldbm_cache_open( be, at_on, LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { Debug( LDAP_DEBUG_ANY, - "<= index_read NULL (could not open %s%s)\n", type, + "<= index_read NULL (could not open %s%s)\n", at_on, LDBM_SUFFIX, 0 ); return( NULL ); } @@ -231,6 +236,8 @@ index_add_values( char *bigbuf; struct dbcache *db; + char *at_on; /* Attribute official name */ + Debug( LDAP_DEBUG_TRACE, "=> index_add_values( \"%s\", %ld )\n", type, id, 0 ); attr_normalize(type); @@ -238,12 +245,12 @@ index_add_values( if ( indexmask == 0 ) { return( 0 ); } - - if ( (db = ldbm_cache_open( be, type, LDBM_SUFFIX, LDBM_WRCREAT )) + at_on = at_official_name( type ); + if ( (db = ldbm_cache_open( be, at_on, LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { Debug( LDAP_DEBUG_ANY, "<= index_add_values -1 (could not open/create %s%s)\n", - type, LDBM_SUFFIX, 0 ); + at_on, LDBM_SUFFIX, 0 ); return( -1 ); } @@ -253,7 +260,7 @@ index_add_values( * presence index entry */ if ( indexmask & INDEX_PRESENCE ) { - add_value( be, db, type, INDEX_PRESENCE, "*", id ); + add_value( be, db, at_on, INDEX_PRESENCE, "*", id ); } Debug( LDAP_DEBUG_TRACE, "*** index_add_values syntax 0x%x syntax bin 0x%x\n", @@ -285,7 +292,7 @@ index_add_values( * equality index entry */ if ( indexmask & INDEX_EQUALITY ) { - add_value( be, db, type, INDEX_EQUALITY, val, id ); + add_value( be, db, at_on, INDEX_EQUALITY, val, id ); } /* @@ -295,7 +302,7 @@ index_add_values( for ( w = first_word( val ); w != NULL; w = next_word( w ) ) { if ( (code = phonetic( w )) != NULL ) { - add_value( be, db, type, INDEX_APPROX, + add_value( be, db, at_on, INDEX_APPROX, code, id ); free( code ); } @@ -314,7 +321,7 @@ index_add_values( } buf[SUBLEN] = '\0'; - add_value( be, db, type, INDEX_SUB, buf, id ); + add_value( be, db, at_on, INDEX_SUB, buf, id ); p = val + len - SUBLEN + 1; for ( j = 0; j < SUBLEN - 1; j++ ) { @@ -323,7 +330,7 @@ index_add_values( buf[SUBLEN - 1] = '$'; buf[SUBLEN] = '\0'; - add_value( be, db, type, INDEX_SUB, buf, id ); + add_value( be, db, at_on, INDEX_SUB, buf, id ); } /* any */ @@ -333,7 +340,7 @@ index_add_values( } buf[SUBLEN] = '\0'; - add_value( be, db, type, INDEX_SUB, buf, id ); + add_value( be, db, at_on, INDEX_SUB, buf, id ); } } -- 2.39.5