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