Annotation of 43BSD/ingres/source/dbu/resetrel.c, revision 1.1.1.1

1.1       root        1: # include      <pv.h>
                      2: # include      <ingres.h>
                      3: # include      <aux.h>
                      4: # include      <batch.h>
                      5: # include      <access.h>
                      6: # include      <func.h>
                      7: # include      <sccs.h>
                      8: 
                      9: SCCSID(@(#)resetrel.c  8.2     1/15/85)
                     10: 
                     11: extern short   tTdbu[];
                     12: extern int     resetrel();
                     13: extern int     null_fn();
                     14: 
                     15: struct fn_def ResetrFn =
                     16: {
                     17:        "RESETREL",
                     18:        resetrel,
                     19:        null_fn,                /* initialization function */
                     20:        null_fn,
                     21:        NULL,
                     22:        0,
                     23:        tTdbu,
                     24:        100,
                     25:        'Z',
                     26:        0
                     27: };
                     28: /*
                     29: **     RESETREL -- will change a relation to an empty heap.  This is only
                     30: **             to be used on temporary relations and should only be called
                     31: **             by the DECOMP process.
                     32: */
                     33: 
                     34: resetrel(pc, pv)
                     35: int    pc;
                     36: PARM   pv[];
                     37: 
                     38: {
                     39:        extern DESC     Reldes;
                     40:        DESC            desc;
                     41:        char            relname[MAXNAME + 4];
                     42:        long            lnum;
                     43: 
                     44:        opencatalog("relation", OR_WRITE);
                     45:        while (pc-- > 0)
                     46:        {
                     47:                if (openr(&desc, OR_RELTID, pv->pv_val.pv_str))
                     48:                        syserr("RESETREL: openr %s", pv->pv_val.pv_str);
                     49:                if (!bequal(Usercode, desc.reldum.relowner, sizeof desc.reldum.relowner))
                     50:                        syserr("RESETREL: not owner of %s", pv->pv_val.pv_str);
                     51:                ingresname(desc.reldum.relid, desc.reldum.relowner, relname);
                     52:                if ((desc.relfp = creat(relname, FILEMODE)) < 0)
                     53:                        syserr("RESETREL: create %s", relname);
                     54:                lnum = 1;
                     55:                if (formatpg(&desc, lnum))
                     56:                        syserr("RESETREL: formatpg %s", relname);
                     57:                desc.reldum.reltups = 0;
                     58:                desc.reldum.relspec = M_HEAP;
                     59:                desc.reldum.relprim = 1;
                     60:                close(desc.relfp);
                     61:                if (replace(&Reldes, &desc.reltid, &desc, FALSE) < 0)
                     62:                        syserr("RESETREL: replace rel %s", relname);
                     63:                pv++;
                     64:        }
                     65:        return (0);
                     66: 
                     67: }

unix.superglobalmegacorp.com

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