1: # include "../ingres.h"
2: # include "../aux.h"
3: # include "../tree.h"
4: # include "../pipes.h"
5: # include "../symbol.h"
6: # include "parser.h"
7:
8: /*
9: ** XDOT
10: ** add to attribute stash any missing attributes in the
11: ** source relation and then build tree with all attribs
12: ** in the 'attid' order. This algorithm assumes that
13: ** the function 'attadd' insert attributes into the list
14: ** in 'attid' order from 1 -> N.
15: */
16: struct querytree *
17: xdot(rptr)
18: struct rngtab *rptr;
19: {
20: struct attribute tuple;
21: register struct attribute *ktuple;
22: struct attribute ktup;
23: struct tup_id tid;
24: struct tup_id limtid;
25: struct querytree *tempt;
26: register struct querytree *vnode;
27: int ik;
28: register struct atstash *aptr;
29: struct querytree *tree();
30: struct querytree *addresdom();
31:
32: # ifdef xPTR2
33: tTfp(15, 0, "ALL being processed for %s\n", rptr->relnm);
34: # endif
35:
36: /* if attstash is missing any attribs then fill in list */
37: if (rptr->ratts != attcount(rptr))
38: {
39: /* get all entries in attrib relation */
40: clearkeys(&Desc);
41: ktuple = &ktup;
42: setkey(&Desc, ktuple, rptr->relnm, ATTRELID);
43: setkey(&Desc, ktuple, rptr->relnowner, ATTOWNER);
44: if (ik = find(&Desc, EXACTKEY, &tid, &limtid, ktuple))
45: syserr("bad find in xdot '%d'", ik);
46: while (!get(&Desc, &tid, &limtid, &tuple, 1))
47: if (!kcompare(&Desc, &tuple, ktuple))
48: /* add any that are not in the stash */
49: if (!attfind(rptr, tuple.attname))
50: attadd(rptr, &tuple);
51: }
52:
53: /* build tree for ALL */
54: tempt = NULL;
55: aptr = rptr->attlist;
56: while (aptr != 0)
57: {
58: vnode = tree(NULL, NULL, VAR, 6, rptr->rentno, aptr);
59: Trname = aptr->atbname;
60: tempt = addresdom(tempt, vnode);
61: aptr = aptr->atbnext;
62: }
63: return(tempt);
64: }
Defined functions
xdot
defined in line
16; used 1 times