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

1.1     ! root        1: # include      <ingres.h>
        !             2: # include      <aux.h>
        !             3: # include      <access.h>
        !             4: # include      <sccs.h>
        !             5: 
        !             6: SCCSID(@(#)get.c       8.1     12/31/84)
        !             7: 
        !             8: /*
        !             9: **  GET - get a single tuple
        !            10: **
        !            11: **     Get either gets the next sequencial tuple after
        !            12: **     "tid" or else gets the tuple specified by tid.
        !            13: **
        !            14: **     If getnxt == TRUE, then tid is incremented to the next
        !            15: **     tuple after tid. If there are no more, then get returns
        !            16: **     1. Otherwise get returns 0 and "tid" is set to the tid of
        !            17: **     the returned tuple.
        !            18: **
        !            19: **     Under getnxt mode, the previous page is reset before
        !            20: **     the next page is read. This is done to prevent the previous
        !            21: **     page from hanging around in the am's buffers when we "know"
        !            22: **     that it will not be referenced again.
        !            23: **
        !            24: **     If getnxt == FALSE then the tuple specified by tid is
        !            25: **     returned. If the tuple was deleted previously,
        !            26: **     get retuns 2 else get returns 0.
        !            27: **
        !            28: **     If getnxt is true, limtid holds the the page number
        !            29: **     of the first page past the end point. Limtid and the
        !            30: **     initial value of tid are set by calls to FIND.
        !            31: **
        !            32: **     returns:
        !            33: **             <0  fatal error
        !            34: **             0   success
        !            35: **             1   end of scan (getnxt=TRUE only)
        !            36: **             2   tuple deleted (getnxt=FALSE only)
        !            37: */
        !            38: 
        !            39: 
        !            40: get(d, tid, limtid, tuple, getnxt)
        !            41: register DESC  *d;
        !            42: register TID   *tid;
        !            43: TID            *limtid;
        !            44: int            getnxt;
        !            45: char           *tuple;
        !            46: {
        !            47:        register int    i;
        !            48:        long            pageid, lpageid;
        !            49: 
        !            50: #      ifdef xATR1
        !            51:        if (tTf(23, 0))
        !            52:        {
        !            53:                printf("get: %.14s,", d->reldum.relid);
        !            54:                dumptid(tid);
        !            55:                printf("get: lim");
        !            56:                dumptid(limtid);
        !            57:        }
        !            58: #      endif
        !            59:        if (get_page(d, tid))
        !            60:        {
        !            61:                return (-1);
        !            62:        }
        !            63:        if (getnxt)
        !            64:        {
        !            65:                pluck_page(limtid, &lpageid);
        !            66:                do
        !            67:                {
        !            68:                        while (((++(tid->line_id)) & I1MASK) >= Acc_head->nxtlino)
        !            69:                        {
        !            70:                                tid->line_id = -1;
        !            71:                                pageid = Acc_head->ovflopg;
        !            72:                                stuff_page(tid, &pageid);
        !            73:                                if (pageid == 0)
        !            74:                                {
        !            75:                                        pageid = Acc_head->mainpg;
        !            76:                                        stuff_page(tid, &pageid);
        !            77:                                        if (pageid == 0 || pageid == lpageid + 1)
        !            78:                                                return (1);
        !            79:                                }
        !            80:                                if (i = resetacc(Acc_head))
        !            81:                                        return (i);
        !            82:                                if (i = get_page(d, tid))
        !            83:                                        return (i);
        !            84:                        }
        !            85:                } while (!Acc_head->linetab[-(tid->line_id & I1MASK)]);
        !            86:        }
        !            87:        else
        !            88:        {
        !            89:                if (i = invalid(tid))
        !            90:                        return (i);
        !            91:        }
        !            92:        get_tuple(d, tid, tuple);
        !            93: #      ifdef xATR2
        !            94:        if (tTf(23, 1))
        !            95:        {
        !            96:                printf("get: ");
        !            97:                printup(d, tuple);
        !            98:        }
        !            99: #      endif
        !           100:        return (0);
        !           101: }

unix.superglobalmegacorp.com

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