1: # include   "../ingres.h"
   2: # include   "../access.h"
   3: 
   4: /* tTf flag 97		TTF */
   5: 
   6: /*
   7: getequal - get the first tuple equal to the provided key
   8: DESCRIPTION
   9: GETEQUAL is used to do a keyed retrieval of a single
  10: tuple in cases where the calling program knows the key to
  11: be unique.  SETKEY must be called first to set all desired
  12: domain values.  GETEQUAL will return the first tuple with
  13: equality on all of the specified domains.
  14: The tuple is returned in TUPLE.
  15: 
  16: 	function values:
  17: 
  18: 		<0 fatal error
  19: 		 0  success
  20: 		 1  no match
  21:  */
  22: 
  23: 
  24: getequal(d1, key, tuple, tid)
  25: struct descriptor   *d1;
  26: char            key[MAXTUP];
  27: char            tuple[MAXTUP];
  28: struct tup_id       *tid;
  29: {
  30:     struct tup_id           limtid;
  31:     register struct descriptor  *d;
  32:     register int            i;
  33: 
  34:     d = d1;
  35: 
  36: #	ifdef xATR1
  37:     if (tTf(97, 0))
  38:     {
  39:         printf("getequal: %.14s,", d->relid);
  40:         printup(d, key);
  41:     }
  42: #	endif
  43:     if (i = find(d, EXACTKEY, tid, &limtid, key))
  44:         return (i);
  45:     while ((i = get(d, tid, &limtid, tuple, TRUE)) == 0)
  46:     {
  47:         if (!kcompare(d, key, tuple))
  48:         {
  49: #			ifdef xATR2
  50:             if (tTf(97, 1))
  51:             {
  52:                 printf("getequal: ");
  53:                 dumptid(tid);
  54:                 printf("getequal: ");
  55:                 printup(d, tuple);
  56:             }
  57: #			endif
  58:             return (0);
  59:         }
  60:     }
  61: #	ifdef xATR2
  62:     if (tTf(97, 2))
  63:         printf("getequal: %d\n", i);
  64: #	endif
  65:     return (i);
  66: }
Last modified: 1980-12-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 352
Valid CSS Valid XHTML 1.0 Strict