1: # include "../ingres.h" 2: # include "../aux.h" 3: # include "../catalog.h" 4: # include "../access.h" 5: 6: 7: 8: /* 9: ** get access parameters of a relation from its descriptor and return 10: ** them in struct pointed to by "ap". 11: */ 12: 13: 14: paramd(desc, param) 15: struct descriptor *desc; 16: struct accessparam *param; 17: 18: { 19: register struct descriptor *d; 20: register struct accessparam *ap; 21: register int i; 22: int p; 23: 24: ap = param; 25: d = desc; 26: 27: ap->mode = getmode(d->relspec); 28: ap->sec_index = FALSE; /* indicate that this isn't the index-rel */ 29: 30: for (i = 0; i < MAXDOM+1; i++) 31: ap->keydno[i] = 0; 32: 33: for (p = 1; p <= d->relatts; p++) 34: if (i = d->relxtra[p]) 35: ap->keydno[i-1] = p; 36: return (0); 37: } 38: 39: parami(ip, param) 40: struct index *ip; 41: struct accessparam *param; 42: { 43: register struct accessparam *ap; 44: 45: ap = param; 46: ap->mode = getmode(ip->irelspeci); 47: ap->sec_index = TRUE; /* this is an index */ 48: 49: bmove(ip->idom, ap->keydno, MAXKEYS); 50: ap->keydno[MAXKEYS] = 0; 51: return(0); 52: } 53: 54: 55: getmode(spec) 56: int spec; 57: { 58: switch (abs(spec)) 59: { 60: case M_HEAP: 61: return(NOKEY); 62: 63: case M_ISAM: 64: return(LRANGEKEY); 65: 66: case M_HASH: 67: return(EXACTKEY); 68: 69: default: 70: syserr("getmode:bad relspec %d", spec); 71: } 72: }