mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Added at_official_name() to enable uniform naming of index files.
This commit is contained in:
parent
7d8330fd40
commit
f3b3c68792
@ -103,6 +103,8 @@ bdb2i_index_read(
|
|||||||
char *realval, *tmpval;
|
char *realval, *tmpval;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
char *at_on;
|
||||||
|
|
||||||
ldbm_datum_init( key );
|
ldbm_datum_init( key );
|
||||||
|
|
||||||
prefix = index2prefix( indextype );
|
prefix = index2prefix( indextype );
|
||||||
@ -119,10 +121,12 @@ bdb2i_index_read(
|
|||||||
}
|
}
|
||||||
|
|
||||||
attr_normalize( type );
|
attr_normalize( type );
|
||||||
if ( (db = bdb2i_cache_open( be, type, BDB2_SUFFIX, LDBM_WRCREAT ))
|
at_on = at_official_name(type);
|
||||||
|
|
||||||
|
if ( (db = bdb2i_cache_open( be, at_on, BDB2_SUFFIX, LDBM_WRCREAT ))
|
||||||
== NULL ) {
|
== NULL ) {
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"<= bdb2i_index_read NULL (could not open %s%s)\n", type,
|
"<= bdb2i_index_read NULL (could not open %s%s)\n", at_on,
|
||||||
BDB2_SUFFIX, 0 );
|
BDB2_SUFFIX, 0 );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -225,6 +229,8 @@ bdb2i_index_add_values(
|
|||||||
char *bigbuf;
|
char *bigbuf;
|
||||||
struct dbcache *db;
|
struct dbcache *db;
|
||||||
|
|
||||||
|
char *at_on;
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "=> bdb2i_index_add_values( \"%s\", %ld )\n", type,
|
Debug( LDAP_DEBUG_TRACE, "=> bdb2i_index_add_values( \"%s\", %ld )\n", type,
|
||||||
id, 0 );
|
id, 0 );
|
||||||
attr_normalize( type );
|
attr_normalize( type );
|
||||||
@ -232,12 +238,13 @@ bdb2i_index_add_values(
|
|||||||
if ( indexmask == 0 ) {
|
if ( indexmask == 0 ) {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
at_on = at_official_name(type);
|
||||||
|
|
||||||
if ( (db = bdb2i_cache_open( be, type, BDB2_SUFFIX, LDBM_WRCREAT ))
|
if ( (db = bdb2i_cache_open( be, at_on, BDB2_SUFFIX, LDBM_WRCREAT ))
|
||||||
== NULL ) {
|
== NULL ) {
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"<= bdb2i_index_add_values -1 (could not open/create %s%s)\n",
|
"<= bdb2i_index_add_values -1 (could not open/create %s%s)\n",
|
||||||
type, BDB2_SUFFIX, 0 );
|
at_on, BDB2_SUFFIX, 0 );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +253,7 @@ bdb2i_index_add_values(
|
|||||||
* presence index entry
|
* presence index entry
|
||||||
*/
|
*/
|
||||||
if ( indexmask & INDEX_PRESENCE ) {
|
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, "*** bdb2i_index_add_values syntax 0x%x syntax bin 0x%x\n",
|
Debug( LDAP_DEBUG_TRACE, "*** bdb2i_index_add_values syntax 0x%x syntax bin 0x%x\n",
|
||||||
@ -278,7 +285,7 @@ bdb2i_index_add_values(
|
|||||||
* equality index entry
|
* equality index entry
|
||||||
*/
|
*/
|
||||||
if ( indexmask & INDEX_EQUALITY ) {
|
if ( indexmask & INDEX_EQUALITY ) {
|
||||||
add_value( be, db, type, INDEX_EQUALITY, val, id );
|
add_value( be, db, at_on, INDEX_EQUALITY, val, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -288,7 +295,7 @@ bdb2i_index_add_values(
|
|||||||
for ( w = first_word( val ); w != NULL;
|
for ( w = first_word( val ); w != NULL;
|
||||||
w = next_word( w ) ) {
|
w = next_word( w ) ) {
|
||||||
if ( (code = phonetic( w )) != NULL ) {
|
if ( (code = phonetic( w )) != NULL ) {
|
||||||
add_value( be, db, type, INDEX_APPROX,
|
add_value( be, db, at_on, INDEX_APPROX,
|
||||||
code, id );
|
code, id );
|
||||||
free( code );
|
free( code );
|
||||||
}
|
}
|
||||||
@ -307,7 +314,7 @@ bdb2i_index_add_values(
|
|||||||
}
|
}
|
||||||
buf[SUBLEN] = '\0';
|
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;
|
p = val + len - SUBLEN + 1;
|
||||||
for ( j = 0; j < SUBLEN - 1; j++ ) {
|
for ( j = 0; j < SUBLEN - 1; j++ ) {
|
||||||
@ -316,7 +323,7 @@ bdb2i_index_add_values(
|
|||||||
buf[SUBLEN - 1] = '$';
|
buf[SUBLEN - 1] = '$';
|
||||||
buf[SUBLEN] = '\0';
|
buf[SUBLEN] = '\0';
|
||||||
|
|
||||||
add_value( be, db, type, INDEX_SUB, buf, id );
|
add_value( be, db, at_on, INDEX_SUB, buf, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* any */
|
/* any */
|
||||||
@ -326,7 +333,7 @@ bdb2i_index_add_values(
|
|||||||
}
|
}
|
||||||
buf[SUBLEN] = '\0';
|
buf[SUBLEN] = '\0';
|
||||||
|
|
||||||
add_value( be, db, type, INDEX_SUB, buf, id );
|
add_value( be, db, at_on, INDEX_SUB, buf, id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user