|
|
1.1 ! root 1: # include <ingres.h> ! 2: # include <access.h> ! 3: # include <sccs.h> ! 4: ! 5: SCCSID(@(#)getequal.c 7.1 2/5/81) ! 6: ! 7: ! 8: /* ! 9: ** getequal - get the first tuple equal to the provided key ! 10: ** ! 11: ** GETEQUAL is used to do a keyed retrieval of a single ! 12: ** tuple in cases where the calling program knows the key to ! 13: ** be unique. SETKEY must be called first to set all desired ! 14: ** domain values. GETEQUAL will return the first tuple with ! 15: ** equality on all of the specified domains. ! 16: ** The tuple is returned in TUPLE. ! 17: ** ! 18: ** function values: ! 19: ** ! 20: ** <0 fatal error ! 21: ** 0 success ! 22: ** 1 no match ! 23: ** ! 24: ** Trace Flags: ! 25: ** 23.8-15 ! 26: */ ! 27: ! 28: ! 29: getequal(d, key, tuple, tid) ! 30: register DESC *d; ! 31: char key[MAXTUP]; ! 32: char tuple[MAXTUP]; ! 33: TID *tid; ! 34: { ! 35: TID limtid; ! 36: register int i; ! 37: ! 38: # ifdef xATR1 ! 39: if (tTf(23, 8)) ! 40: { ! 41: printf("getequal: %.14s,", d->reldum.relid); ! 42: printdesc(d); ! 43: printup(d, key); ! 44: } ! 45: # endif ! 46: if (i = find(d, EXACTKEY, tid, &limtid, key)) ! 47: return (i); ! 48: while ((i = get(d, tid, &limtid, tuple, TRUE)) == 0) ! 49: { ! 50: if (!kcompare(d, key, tuple)) ! 51: { ! 52: # ifdef xATR2 ! 53: if (tTf(23, 9)) ! 54: { ! 55: printf("getequal: "); ! 56: dumptid(tid); ! 57: printf("getequal: "); ! 58: printup(d, tuple); ! 59: } ! 60: # endif ! 61: return (0); ! 62: } ! 63: } ! 64: # ifdef xATR2 ! 65: if (tTf(23, 10)) ! 66: printf("getequal: %d\n", i); ! 67: # endif ! 68: return (i); ! 69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.