1: # include <ingres.h> 2: # include <access.h> 3: # include <sccs.h> 4: 5: SCCSID(@(#)purgetup.c 8.1 12/31/84) 6: 7: /* 8: ** Remove tuples from the specified system relation. 9: ** 10: ** 'Desa' is a descriptor for a system relation and 11: ** key[12] and dom[12] are the keys and domain numbers 12: ** to match on for the delete. 13: ** All the tuples in 'desa' with key1 and key2 14: ** are deleted from the relation. 15: */ 16: 17: purgetup(d, key1, dom1, key2, dom2) 18: register DESC *d; 19: char *key1; 20: int dom1; 21: char *key2; 22: int dom2; 23: { 24: TID tid, limtid; 25: register int i; 26: char tupkey[MAXTUP], tuple[MAXTUP]; 27: 28: setkey(d, tupkey, key1, dom1); 29: setkey(d, tupkey, key2, dom2); 30: if (i = find(d, EXACTKEY, &tid, &limtid, tupkey)) 31: syserr("purgetup:find:%d", i); 32: while ((i = get(d, &tid, &limtid, tuple, TRUE)) == 0) 33: { 34: if (kcompare(d, tuple, tupkey) == 0) 35: if (i = delete(d, &tid)) 36: syserr("attflush: delete %d", i); 37: } 38: 39: if (i < 0) 40: syserr("purgetup:get %.14s:%d", d->reldum.relid, i); 41: }