Annotation of 42BSD/ingres/source/dbu/get_p_tid.c, revision 1.1

1.1     ! root        1: # include      <ingres.h>
        !             2: # include      <catalog.h>
        !             3: # include      <sccs.h>
        !             4: 
        !             5: SCCSID(@(#)get_p_tid.c 7.1     2/5/81)
        !             6: 
        !             7: /*
        !             8: **  GET_P_TID -- Get the primary tid for a relation for locking
        !             9: **
        !            10: **     Finds the correct tid for locking the relation. If the
        !            11: **     relation is a primary relation, then the tid of the
        !            12: **     relation is returned.
        !            13: **
        !            14: **     If the relation is a secondary index then the tid of the
        !            15: **     primary relation is returned.
        !            16: **
        !            17: **     Parameters:
        !            18: **             des - an open descriptor for the relation.
        !            19: **             tidp - a pointer to a place to store the tid.
        !            20: **
        !            21: **     Returns:
        !            22: **             none
        !            23: **
        !            24: **     Side Effects:
        !            25: **             alters the value stored in "tidp",
        !            26: **             may cause access to the indexes relation
        !            27: **
        !            28: **     Called By:
        !            29: **             modify
        !            30: */
        !            31: 
        !            32: 
        !            33: 
        !            34: get_p_tid(d, tp)
        !            35: register DESC  *d;
        !            36: register TID   *tp;
        !            37: {
        !            38:        register int    i;
        !            39:        struct index    indkey, itup;
        !            40:        DESC            ides;
        !            41:        extern DESC     Inddes;
        !            42: 
        !            43:        if (d->reldum.relindxd < 0)
        !            44:        {
        !            45:                /* this is a secondary index. lock the primary rel */
        !            46:                opencatalog("indexes", 0);
        !            47:                setkey(&Inddes, &indkey, d->reldum.relowner, IOWNERP);
        !            48:                setkey(&Inddes, &indkey, d->reldum.relid, IRELIDI);
        !            49:                if (getequal(&Inddes, &indkey, &itup, tp))
        !            50:                        syserr("No prim for %.14s", d->reldum.relid);
        !            51: 
        !            52:                if (i = openr(&ides, -1, itup.irelidp))
        !            53:                        syserr("openr prim %d,%.14s", i, itup.irelidp);
        !            54: 
        !            55:                bmove(&ides.reltid, tp, sizeof (*tp));
        !            56:        }
        !            57:        else
        !            58:                bmove(&d->reltid, tp, sizeof (*tp));
        !            59: }

unix.superglobalmegacorp.com

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