clear set collate to 'machine' cPrefix = 'someString' && any string with len>0 N = 1 && 1..255 create cursor CursorTest ; ( j_ref c(LEN(cPrefix)+1) ; ) index on j_ref TAG j_ref * Start the index with a fixed sequence FOR k=1 TO 2 && COMPACT use the recno=1 key insert into CursorTest values(m.cPrefix+CHR(m.N)) && prefix + not NULL ASCII NEXT * Append a Key with: same prefix, BUT END with NULL CHAR insert into CursorTest values(m.cPrefix+CHR(0)) ? "FOUND",test() AT 20 && now found it * Append another keys group with the keys equal to that of the start group FOR k=1 TO 10 insert into CursorTest values(m.cPrefix+CHR(m.N)) && prefix + not NULL ASCII ? "NOT FOUND",test() AT 20 NEXT * Append another key with a different key insert into CursorTest values(m.cPrefix+CHR((m.N+1)%256)) ? "FOUND",test() AT 20 && now the gost key it reappears PROCEDURE TEST REINDEX RETURN KEYMATCH(m.cPrefix+CHR(0))For integers index VFP uses a different C++ routine,
clear set collate to 'machine' cPrefix = '340133' && any string N = 1 && 1..255 create cursor CursorTest ; ( j_ref I ; ) index on j_ref TAG j_ref insert into CursorTest values(0x01&cPrefix) && prefix + not NULL ASCII * Append a Key with: same prefix, BUT END with NULL CHAR insert into CursorTest values(0x00&cPrefix) ? "FOUND",test() AT 20 && now found it * Append another keys group with the keys equal to that of the start group FOR k=1 TO 10 insert into CursorTest values(0x01&cPrefix) && prefix + not NULL ASCII ? "NOT FOUND",test() AT 20 NEXT * Append another key with a different key insert into CursorTest values(0x00&cPrefix) ? "FOUND",test() AT 20 && now the gost key it reappears PROCEDURE TEST REINDEX RETURN KEYMATCH(0x00&cPrefix)The presence of the bug until version 8,