1: # include   <ingres.h>
   2: # include   <access.h>
   3: # include   <catalog.h>
   4: # include   <batch.h>
   5: # include   <btree.h>
   6: # include   <sccs.h>
   7: 
   8: SCCSID(@(#)delete.c	8.1	12/31/84)
   9: 
  10: /*
  11: **	Delete - delete the tuple specified by tid
  12: **
  13: **	Delete removes the tuple specified by tid
  14: **	and reclaims the tuple space.
  15: **
  16: **	returns:
  17: **		<0  fatal error
  18: **		0   success
  19: **		2   tuple specified by tid aleady deleted
  20: */
  21: 
  22: delete(dx, tidx)
  23: DESC    *dx;
  24: TID *tidx;
  25: {
  26:     register DESC   *d;
  27:     register TID    *tid;
  28:     register int    i;
  29:     char        btree[MAXNAME + 4];
  30:     TID     tidloc;
  31:     long        lid[MAXLID];
  32: 
  33:     d = dx;
  34:     tid = tidx;
  35: 
  36: #	ifdef xATR1
  37:     if (tTf(24, 8))
  38:     {
  39:         printf("delete: %.14s,", d->reldum.relid);
  40:         dumptid(tid);
  41:     }
  42: #	endif
  43: 
  44:     if (i = get_page(d, tid))
  45:         return (i);
  46: 
  47:     if (i = invalid(tid))
  48:         return (i);
  49: 
  50:     i = tup_len(tid);
  51: 
  52:     del_tuple(tid, i);
  53: 
  54:     if (d->reldum.reldim > 0)
  55:     /* remove corresponding lid from B-Tree */
  56:     {
  57:         btreename(d->reldum.relid, btree);
  58:         search_btree(*tid, &tidloc);
  59:         get_lid(&tidloc, lid);
  60:         if (fwrite(lid, 1, LIDSIZE * d->reldum.reldim, Del_infp) != LIDSIZE * d->reldum.reldim)
  61:             syserr("write error");
  62:         ++Del_cnt;
  63:     }
  64: 
  65:     d->reladds--;
  66: 
  67:     return (0);
  68: }

Defined functions

delete defined in line 8; never used
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 894
Valid CSS Valid XHTML 1.0 Strict