Annotation of 43BSD/ingres/source/iutil/getequal.c, revision 1.1

1.1     ! root        1: # include      <ingres.h>
        !             2: # include      <access.h>
        !             3: # include      <sccs.h>
        !             4: 
        !             5: SCCSID(@(#)getequal.c  8.1     12/31/84)
        !             6: 
        !             7: 
        !             8: /*
        !             9: **     getequal - get the first tuple equal to the provided key
        !            10: **     
        !            11: **     GETEQUAL is used to do a keyed retrieval of a single
        !            12: **     tuple in cases where the calling program knows the key to
        !            13: **     be unique.  SETKEY must be called first to set all desired
        !            14: **     domain values.  GETEQUAL will return the first tuple with
        !            15: **     equality on all of the specified domains.
        !            16: **     The tuple is returned in TUPLE.
        !            17: **     
        !            18: ** NOTE:
        !            19: **     This function used to call get() for the scan, I have exploded the
        !            20: **     call for efficency reasons. I also call get_page only when we leave a
        !            21: **     page boundary.
        !            22: **
        !            23: **     function values:
        !            24: **     
        !            25: **             <0 fatal error
        !            26: **              0  success
        !            27: **              1  no match
        !            28: **
        !            29: **     Trace Flags:
        !            30: **             23.8-15
        !            31: */
        !            32: 
        !            33: 
        !            34: getequal(d, keyval, tupleval, tid)
        !            35: register DESC  *d;
        !            36: char           keyval[MAXTUP];
        !            37: char           tupleval[MAXTUP];
        !            38: register       TID             *tid;
        !            39: {
        !            40:        auto            long    lpageid,pageid;
        !            41:        TID             limtid;
        !            42:        register        char    *tuple;
        !            43:        register        char    *key;
        !            44:        register        int     i;
        !            45: 
        !            46:        key = keyval;
        !            47:        tuple = tupleval;
        !            48: 
        !            49: #      ifdef xATR1
        !            50:        if (tTf(23, 8))
        !            51:        {
        !            52:                printf("getequal: %.14s,", d->reldum.relid);
        !            53:                printdesc(d);
        !            54:                printup(d, key);
        !            55:        }
        !            56: #      endif
        !            57:        if (i = find(d, EXACTKEY, tid, &limtid, key))
        !            58:                return (i);
        !            59: 
        !            60:        pluck_page(&limtid,&lpageid);
        !            61:        if (i = get_page(d, tid))
        !            62:                return ( i );
        !            63: 
        !            64:        for (;;)
        !            65:        {
        !            66: 
        !            67:                do
        !            68:                {
        !            69:                        while (((++(tid->line_id)) & I1MASK) >= Acc_head->nxtlino)
        !            70:                        {
        !            71:                                tid->line_id = -1;
        !            72:                                pageid = Acc_head->ovflopg;
        !            73:                                stuff_page(tid, &pageid);
        !            74:                                if (pageid == 0)
        !            75:                                {
        !            76:                                        pageid = Acc_head->mainpg;
        !            77:                                        stuff_page(tid, &pageid);
        !            78:                                        if (pageid == 0 || pageid == lpageid + 1)
        !            79:                                                return (1);
        !            80:                                }
        !            81:                                if (i = resetacc(Acc_head))
        !            82:                                        return (i);
        !            83:                                if (i = get_page(d, tid))
        !            84:                                        return (i);
        !            85:                        }
        !            86:                } while (!Acc_head->linetab[-(tid->line_id & I1MASK)]);
        !            87: 
        !            88:                get_tuple(d,tid,tuple);
        !            89: 
        !            90:                if (!kcompare(d, key, tuple))
        !            91:                {
        !            92: #                      ifdef xATR2
        !            93:                        if (tTf(23, 9))
        !            94:                        {
        !            95:                                printf("getequal: ");
        !            96:                                dumptid(tid);
        !            97:                                printf("getequal: ");
        !            98:                                printup(d, tuple);
        !            99:                        }
        !           100: #                      endif
        !           101:                        return (0);
        !           102:                }
        !           103:        }
        !           104: }

unix.superglobalmegacorp.com

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