1: # include   "../ingres.h"
   2: # include   "../symbol.h"
   3: 
   4: /*
   5: **	Clearkeys - reset all key indicators in descriptor
   6: **
   7: **	Clearkeys is used to clear the key supplied
   8: **	flags before calls to setkey
   9: */
  10: 
  11: 
  12: clearkeys(des)
  13: struct descriptor   *des;
  14: {
  15:     register struct descriptor  *d;
  16:     register int            i;
  17: 
  18:     d = des;
  19:     for (i = 0; i <= d->relatts; i++)
  20:         d->relgiven[i] = 0;
  21:     return (0);
  22: }
  23: 
  24: /*
  25: **	Setkey - indicate a partial key for find
  26: **
  27: **	Setkey is used to set a key value into place
  28: **	in a key. The key can be as large as the entire
  29: **	tuple. Setkey moves the key value into the
  30: **	proper place in the key and marks the value as
  31: **	supplied
  32: **
  33: **	If the value is a null pointer, then the key is
  34: **	cleared.
  35: **
  36: **	Clearkeys should be called once before the
  37: **	first call to setkey.
  38: **
  39: */
  40: 
  41: setkey(d1, key, value, domnum)
  42: struct descriptor   *d1;
  43: char            *key;
  44: char            *value;
  45: int         domnum;
  46: 
  47: {
  48:     register struct descriptor  *d;
  49:     register int            dom, len;
  50:     char                *cp;
  51: 
  52:     d = d1;
  53:     dom = domnum;
  54: 
  55: #	ifdef xATR1
  56:     if (tTf(96, 0))
  57:         printf("setkey: %.14s, %d\n", d->relid, dom);
  58: #	endif
  59: 
  60:     /* check validity of domain number */
  61:     if (dom < 1 || dom > d->relatts)
  62:         syserr("setkey:rel=%.12s,dom=%d", d->relid, dom);
  63: 
  64:     /* if value is null, clear key */
  65:     if (value == 0)
  66:     {
  67:         d->relgiven[dom] = 0;
  68:         return;
  69:     }
  70: 
  71:     /* mark as given */
  72:     d->relgiven[dom] = 1;
  73: 
  74:     len = d->relfrml[dom] & I1MASK;
  75:     cp = &key[d->reloff[dom]];
  76: 
  77:     if (d->relfrmt[dom] == CHAR)
  78:         pmove(value, cp, len, ' ');
  79:     else
  80:         bmove(value, cp, len);
  81: }

Defined functions

setkey defined in line 41; used 132 times
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2176
Valid CSS Valid XHTML 1.0 Strict