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

unix.superglobalmegacorp.com

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