|
|
1.1 ! root 1: # include <ingres.h> ! 2: # include <aux.h> ! 3: # include <access.h> ! 4: # include <sccs.h> ! 5: ! 6: SCCSID(@(#)noclose.c 7.1 2/5/81) ! 7: ! 8: /* ! 9: ** noclose - update system catalogs for a relation ! 10: ** DESCRIPTION ! 11: ** ! 12: ** function values: ! 13: ** ! 14: ** <0 fatal error ! 15: ** 0 success ! 16: ** 1 relation was not open ! 17: */ ! 18: ! 19: ! 20: noclose(d) ! 21: register DESC *d; ! 22: { ! 23: register int i; ! 24: struct relation rel; ! 25: ! 26: # ifdef xATR1 ! 27: if (tTf(21, 12)) ! 28: printf("noclose: %.14s,%ld\n", d->reldum.relid, d->reladds); ! 29: # endif ! 30: ! 31: /* make sure relation relation is read/write mode */ ! 32: if (abs(d->relopn) != (d->relfp + 1) * 5) ! 33: return (1); ! 34: ! 35: /* flush all pages associated with relation */ ! 36: /* if system catalog, reset all the buffers so they can't be reused */ ! 37: i = flush_rel(d, d->reldum.relstat & S_CATALOG); ! 38: ! 39: /* check to see if number of tuples has changed */ ! 40: if (d->reladds != 0) ! 41: { ! 42: /* yes, update the system catalogs */ ! 43: /* get tuple from relation relation */ ! 44: Admin.adreld.relopn = (Admin.adreld.relfp + 1) * -5; ! 45: if (i = get_page(&Admin.adreld, &d->reltid.s_tupid)) ! 46: return (i); /* fatal error */ ! 47: ! 48: /* get the actual tuple */ ! 49: get_tuple(&Admin.adreld, &d->reltid.s_tupid, (char *) &rel); ! 50: ! 51: /* update the reltups field */ ! 52: rel.reltups += d->reladds; ! 53: d->reldum.reltups = rel.reltups; ! 54: ! 55: /* put the tuple back */ ! 56: put_tuple(&d->reltid.s_tupid, (char *) &rel, sizeof rel); ! 57: i = resetacc(Acc_head); ! 58: d->reladds = 0; ! 59: } ! 60: return (i); ! 61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.