1: # include <ingres.h>
   2: # include <access.h>
   3: # include <aux.h>
   4: # include <sccs.h>
   5: 
   6: SCCSID(@(#)get_reltup.c	8.1	12/31/84)
   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: }

Defined functions

get_reltup defined in line 6; used 2 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 903
Valid CSS Valid XHTML 1.0 Strict