1: # include   "../ingres.h"
   2: # include   "../aux.h"
   3: # include   "../access.h"
   4: 
   5: /*
   6: noclose - update system catalogs for a relation
   7: DESCRIPTION
   8: 
   9: 
  10: 	function values:
  11: 
  12: 		<0  fatal error
  13: 		 0  success
  14: 		 1  relation was not open
  15:  */
  16: 
  17: 
  18: noclose(d)
  19: struct descriptor   *d;
  20: {
  21:     char                name[MAXNAME + 4];
  22:     register struct descriptor  *dx;
  23:     register int            i;
  24:     register struct accbuf      *b;
  25:     struct relation         rel;
  26: 
  27:     dx = d;
  28: #	ifdef xATR1
  29:     if (tTf(90, 8))
  30:         printf("noclose: %.14s,%s\n", dx->relid, locv(dx->reladds));
  31: #	endif
  32: 
  33:     /* make sure relation relation is read/write mode */
  34:     if (abs(dx->relopn) != (dx->relfp + 1) * 5)
  35:         return (1);
  36: 
  37:     /* flush all pages associated with relation */
  38:     /* if system catalog, reset all the buffers so they can't be reused */
  39:     i = flush_rel(dx, dx->relstat & S_CATALOG);
  40: 
  41:     /* check to see if number of tuples has changed */
  42:     if (dx->reladds != 0)
  43:     {
  44:         /* yes, update the system catalogs */
  45:         /* get tuple from relation relation */
  46:         Admin.adreld.relopn = (Admin.adreld.relfp + 1) * -5;
  47:         if (i = get_page(&Admin.adreld, &dx->reltid))
  48:             return (i); /* fatal error */
  49: 
  50:         /* get the actual tuple */
  51:         get_tuple(&Admin.adreld, &dx->reltid, &rel);
  52: 
  53:         /* update the reltups field */
  54:         rel.reltups += dx->reladds;
  55:         dx->reltups = rel.reltups;
  56: 
  57:         /* put the tuple back */
  58:         put_tuple(&dx->reltid, &rel, sizeof rel);
  59:         i = resetacc(Acc_head);
  60:         dx->reladds = 0;
  61:     }
  62:     return (i);
  63: }
Last modified: 1995-02-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2250
Valid CSS Valid XHTML 1.0 Strict