1: # include   "../ingres.h"
   2: # include   "../aux.h"
   3: # include   "../batch.h"
   4: # include   "../access.h"
   5: 
   6: /*
   7: **	RESETREL -- will change a relation to an empty heap.  This is only
   8: **		to be used on temporary relations and should only be called
   9: **		by the DECOMP process.
  10: */
  11: 
  12: resetrel(pc, pv)
  13: int pc;
  14: char    **pv;
  15: 
  16: {
  17:     extern struct descriptor    Reldes;
  18:     struct descriptor       desc;
  19:     char                relname[MAXNAME + 4];
  20:     long                lnum;
  21: 
  22:     opencatalog("relation", 2);
  23:     while (*pv != -1)
  24:     {
  25:         if (openr(&desc, -1, *pv))
  26:             syserr("RESETREL: openr %s", *pv);
  27:         if (!bequal(Usercode, desc.relowner, sizeof desc.relowner))
  28:             syserr("RESETREL: not owner of %s", *pv);
  29:         ingresname(desc.relid, desc.relowner, relname);
  30:         if ((desc.relfp = creat(relname, FILEMODE)) < 0)
  31:             syserr("RESETREL: create %s", relname);
  32:         lnum = 1;
  33:         if (formatpg(&desc, lnum))
  34:             syserr("RESETREL: formatpg %s", relname);
  35:         desc.reltups = 0;
  36:         desc.relspec = M_HEAP;
  37:         desc.relprim = 1;
  38:         close(desc.relfp);
  39:         if (replace(&Reldes, &desc.reltid, &desc, FALSE) < 0)
  40:             syserr("RESETREL: replace rel %s", relname);
  41:         pv++;
  42:     }
  43:     return (0);
  44: }
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2302
Valid CSS Valid XHTML 1.0 Strict