|
|
1.1 ! root 1: # include <ingres.h> ! 2: # include <access.h> ! 3: # include <aux.h> ! 4: # include <sccs.h> ! 5: ! 6: SCCSID(@(#)get_reltup.c 7.1 2/5/81) ! 7: ! 8: /* ! 9: ** GET_RELTUP -- get appropriate tuple from relation catalog ! 10: ** ! 11: ** Get the tuple for the relation specified by 'name' ! 12: ** and put it in the descriptor 'dx'. ! 13: ** ! 14: ** First a relation named 'name' owned ! 15: ** by the current user is searched for. If that fails, ! 16: ** then a relation owned by the dba is searched for. ! 17: */ ! 18: ! 19: get_reltup(d, name) ! 20: register DESC *d; ! 21: char *name; ! 22: { ! 23: struct relation rel; ! 24: register int i; ! 25: ! 26: clearkeys(&Admin.adreld); ! 27: ! 28: /* make believe relation relation is read only for concurrency */ ! 29: Admin.adreld.relopn = abs(Admin.adreld.relopn); ! 30: ! 31: /* relation relation is open. Search for relation 'name' */ ! 32: setkey(&Admin.adreld, (char *) &rel, name, RELID); ! 33: setkey(&Admin.adreld, (char *) &rel, Usercode, RELOWNER); ! 34: ! 35: if ((i = getequal(&Admin.adreld, (char *) &rel, d, &d->reltid.s_tupid)) == 1) ! 36: { ! 37: /* not a user relation. try relation owner by dba */ ! 38: setkey(&Admin.adreld, (char *) &rel, Admin.adhdr.adowner, RELOWNER); ! 39: i = getequal(&Admin.adreld, (char *) &rel, d, &d->reltid.s_tupid); ! 40: } ! 41: ! 42: flush_rel(&Admin.adreld, TRUE); ! 43: ! 44: # ifdef xATR1 ! 45: if (tTf(21, 1)) ! 46: printf("get_reltup: %d\n", i); ! 47: # endif ! 48: ! 49: /* restore relation relation to read/write mode */ ! 50: Admin.adreld.relopn = -Admin.adreld.relopn; ! 51: return (i); ! 52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.