*** btree/bt_cursor.c.orig Wed Jan 6 21:38:45 1999 --- btree/bt_cursor.c Fri Jan 15 09:17:27 1999 *************** *** 58,63 **** --- 58,72 ---- } /* If the cursor references a deleted record. */ + #undef IS_CUR_DELETED + #define IS_CUR_DELETED(cp) \ + (((cp)->dpgno == PGNO_INVALID && \ + B_DISSET(GET_BKEYDATA((cp)->page, \ + (cp)->indx + O_INDX)->type)) || \ + ((cp)->dpgno != PGNO_INVALID && \ + B_DISSET(GET_BKEYDATA((cp)->page, (cp)->dindx)->type))) + + /* If the cursor and index combination references a deleted record. */ #undef IS_DELETED #define IS_DELETED(cp, indx) \ (((cp)->dpgno == PGNO_INVALID && \ *************** *** 486,491 **** --- 495,506 ---- /* Search for a matching entry. */ if ((ret = __bam_dsearch(dbc, cp, data, NULL)) != 0) goto err; + + /* Ignore deleted entries. */ + if (IS_CUR_DELETED(cp)) { + ret = DB_NOTFOUND; + goto err; + } break; case DB_SET_RANGE: if ((ret = __bam_c_search(dbc, cp, key, flags, &exact)) != 0) *************** *** 1070,1076 **** return (ret); /* If on an empty page or a deleted record, move to the next one. */ ! if (NUM_ENT(cp->page) == 0 || IS_DELETED(cp, cp->indx)) if ((ret = __bam_c_next(dbc, cp, 0)) != 0) return (ret); --- 1085,1091 ---- return (ret); /* If on an empty page or a deleted record, move to the next one. */ ! if (NUM_ENT(cp->page) == 0 || IS_CUR_DELETED(cp)) if ((ret = __bam_c_next(dbc, cp, 0)) != 0) return (ret); *************** *** 1118,1124 **** return (ret); /* If on an empty page or a deleted record, move to the next one. */ ! if (NUM_ENT(cp->page) == 0 || IS_DELETED(cp, cp->indx)) if ((ret = __bam_c_prev(dbc, cp)) != 0) return (ret); --- 1133,1139 ---- return (ret); /* If on an empty page or a deleted record, move to the next one. */ ! if (NUM_ENT(cp->page) == 0 || IS_CUR_DELETED(cp)) if ((ret = __bam_c_prev(dbc, cp)) != 0) return (ret); *************** *** 1556,1562 **** return (0); /* If it's a deleted record, go to the next valid record. */ ! while (IS_DELETED(cp, cp->dindx)) if ((ret = __bam_c_next(dbc, cp, 0)) != 0) return (ret); return (0); --- 1571,1577 ---- return (0); /* If it's a deleted record, go to the next valid record. */ ! if (IS_CUR_DELETED(cp)) if ((ret = __bam_c_next(dbc, cp, 0)) != 0) return (ret); return (0);