1: # include   <ingres.h>
   2: # include   <aux.h>
   3: # include   <tree.h>
   4: # include   <symbol.h>
   5: # include   "parser.h"
   6: # include   <sccs.h>
   7: 
   8: SCCSID(@(#)xdot.c	8.1	12/31/84)
   9: 
  10: extern QTREE        *tree();
  11: extern QTREE        *addresdom();
  12: 
  13: /*
  14: ** XDOT
  15: **	add to attribute stash any missing attributes in the
  16: **	source relation and then build tree with all attribs
  17: **	in the 'attid' order.  This algorithm assumes that
  18: **	the function 'attadd' insert attributes into the list
  19: **	in 'attid' order from 1 -> N.
  20: */
  21: QTREE *
  22: xdot(slot)
  23: int slot;
  24: {
  25:     PARRNG              *rptr;
  26:     struct attribute        tuple;
  27:     register struct attribute   *ktuple;
  28:     struct attribute        ktup;
  29:     TID             tid;
  30:     TID             limtid;
  31:     QTREE       *tempt;
  32:     register QTREE  *vnode;
  33:     int             ik;
  34:     register struct atstash     *aptr;
  35: 
  36:     extern PARRNG           Parrng[];
  37:     extern char         *Trname;
  38:     extern DESC         Attdes;
  39: 
  40:     rptr = &Parrng[slot];
  41: 
  42: #	ifdef xPTR2
  43:     tTfp(35, 0, "ALL being processed for %12s\n",
  44:         rptr->vardesc.relvname);
  45: #	endif
  46: 
  47:     if (rptr->vardesc.reldum.relatts <= 0)
  48:         syserr("xdot: rptr->vardesc.reldum.relatts %d.\n", rptr->vardesc.reldum.relatts);
  49:     /* if attstash is missing any attribs then fill in list */
  50:     if (rptr->vardesc.reldum.relatts != attcount(slot))
  51:     {
  52:         /* get all entries in attrib relation */
  53:         clearkeys(&Attdes);
  54:         ktuple = &ktup;
  55:         setkey(&Attdes, ktuple, rptr->vardesc.reldum.relid, ATTRELID);
  56:         setkey(&Attdes, ktuple, rptr->vardesc.reldum.relowner, ATTOWNER);
  57:         if (ik = find(&Attdes, EXACTKEY, &tid, &limtid, ktuple))
  58:             syserr("bad find in xdot '%d'", ik);
  59:         while (!get(&Attdes, &tid, &limtid, &tuple, 1))
  60:             if (!kcompare(&Attdes, &tuple, ktuple))
  61:                 /* add any that are not in the stash */
  62:                 if (!attfind(slot, tuple.attname))
  63:                     attadd(slot, &tuple);
  64:     }
  65: 
  66:     /* build tree for ALL */
  67:     tempt = NULL;
  68:     aptr = rptr->attlist;
  69:     while (aptr != 0)
  70:     {
  71:         vnode = tree(NULL, NULL, VAR, sizeof(struct varnode), slot, aptr);
  72:         Trname = aptr->atbname;
  73:         tempt = addresdom(tempt, vnode);
  74:         aptr = aptr->atbnext;
  75:     }
  76: 
  77: #	ifdef xPTR3
  78:     tTfp(35, 0, "end of xdot %12s\n", rptr->vardesc.relvname);
  79: #	endif
  80: 
  81:     return(tempt);
  82: }

Defined functions

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