1: # include   <ingres.h>
   2: # include   <catalog.h>
   3: # include   <sccs.h>
   4: 
   5: SCCSID(@(#)get_p_tid.c	8.2	1/15/85)
   6: 
   7: /*
   8: **  GET_P_TID -- Get the primary tid for a relation for locking
   9: **
  10: **	Finds the correct tid for locking the relation. If the
  11: **	relation is a primary relation, then the tid of the
  12: **	relation is returned.
  13: **
  14: **	If the relation is a secondary index then the tid of the
  15: **	primary relation is returned.
  16: **
  17: **	Parameters:
  18: **		des - an open descriptor for the relation.
  19: **		tidp - a pointer to a place to store the tid.
  20: **
  21: **	Returns:
  22: **		none
  23: **
  24: **	Side Effects:
  25: **		alters the value stored in "tidp",
  26: **		may cause access to the indexes relation
  27: **
  28: **	Called By:
  29: **		modify
  30: */
  31: 
  32: 
  33: 
  34: get_p_tid(d, tp)
  35: register DESC   *d;
  36: register TID    *tp;
  37: {
  38:     register int    i;
  39:     struct index    indkey, itup;
  40:     DESC        ides;
  41:     extern DESC Inddes;
  42: 
  43:     if (d->reldum.relindxd < 0)
  44:     {
  45:         /* this is a secondary index. lock the primary rel */
  46:         opencatalog("indexes", OR_READ);
  47:         setkey(&Inddes, &indkey, d->reldum.relowner, IOWNERP);
  48:         setkey(&Inddes, &indkey, d->reldum.relid, IRELIDI);
  49:         if (getequal(&Inddes, &indkey, &itup, tp))
  50:             syserr("No prim for %.14s", d->reldum.relid);
  51: 
  52:         if (i = openr(&ides, OR_RELTID, itup.irelidp))
  53:             syserr("openr prim %d,%.14s", i, itup.irelidp);
  54: 
  55:         bmove(&ides.reltid, tp, sizeof (*tp));
  56:     }
  57:     else
  58:         bmove(&d->reltid, tp, sizeof (*tp));
  59: }

Defined functions

get_p_tid defined in line 5; used 1 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 816
Valid CSS Valid XHTML 1.0 Strict