Annotation of 42BSD/ingres/source/decomp/ret_unique.c, revision 1.1.1.1

1.1       root        1: # include      <ingres.h>
                      2: # include      <symbol.h>
                      3: # include      <aux.h>
                      4: # include      <tree.h>
                      5: # include      "globs.h"
                      6: # include      <sccs.h>
                      7: 
                      8: SCCSID(@(#)ret_unique.c        7.1     2/5/81)
                      9: 
                     10: 
                     11: 
                     12: /*
                     13: **     create a result relation for a ret_unique
                     14: */
                     15: 
                     16: mk_unique(root)
                     17: QTREE  *root;
                     18: {
                     19:        register int    i, domcnt;
                     20:        register QTREE  *r;
                     21: 
                     22:        r = root;
                     23: 
                     24:        /* verify that target list is within range */
                     25:        domcnt = r->left->sym.type != TREE ? r->left->sym.value.sym_resdom.resno : 0;
                     26:        if (findwid(r) > MAXTUP || domcnt > MAXDOM)
                     27:                derror(4620);
                     28:        i = MAXRANGE - 1;
                     29:        De.de_rangev[i].relnum = mak_t_rel(r, "u", -1);
                     30:        De.de_resultvar = i;
                     31: 
                     32:        /* don't count retrieve into portion as a user query */
                     33:        r->sym.value.sym_root.rootuser = 0;
                     34: }
                     35: /*
                     36: **     Retrieve all domains of the variable "var".
                     37: **     This routine is used for ret_unique to retrieve
                     38: **     the result relation. First duplicates are removed
                     39: **     then the original tree is converted to be a
                     40: **     retrieve of all domains of "var", and then
                     41: **     ovqp is called to retrieve the relation.
                     42: */
                     43: 
                     44: pr_unique(root1, var1)
                     45: QTREE  *root1;
                     46: int                    var1;
                     47: {
                     48:        register QTREE  *root, *r;
                     49:        register int    var;
                     50:        extern QTREE    *makavar();
                     51: 
                     52:        root = root1;
                     53:        var = var1;
                     54: 
                     55:        /* remove duplicates from the unopened relation */
                     56:        removedups(var);
                     57: 
                     58:        /* remove the qual from the tree */
                     59:        root->right = De.de_qle;
                     60: 
                     61:        /* make all resdoms refer to the result relation */
                     62:        for (r = root->left; r->sym.type != TREE; r = r->left)
                     63:                r->right = makavar(r, var, r->sym.value.sym_resdom.resno);
                     64: 
                     65:        /* count as a user query */
                     66:        root->sym.value.sym_root.rootuser = TRUE;
                     67: 
                     68:        /* run the retrieve */
                     69:        De.de_sourcevar = var;
                     70:        De.de_newq = De.de_newr = TRUE;
                     71:        call_ovqp(root, mdRETR, NORESULT);
                     72: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.