1: /* 2: ** Structures Used In The Nodes Of The Querytree 3: */ 4: 5: /* 6: ** Basic symbol structure. "Type" is one of the symbols 7: ** in "symbol.h", "len" is the length of the "value" 8: ** field (0 to 255 bytes), "value" is variable length and 9: ** holds the actual value (if len != 0) of the node. 10: */ 11: struct symbol 12: { 13: char type; /* type codes in symbol.h */ 14: char len; /* length in bytes of value field */ 15: int value[]; /* variable length (0 - 255 bytes) */ 16: }; 17: 18: /* 19: ** Basic node in the querytree. Each node has a left and 20: ** right descendent. If the node is a leaf node then the 21: ** left and right pointers will be NULL. Depending on the 22: ** "type" field of the symbol structure, there may be additional 23: ** information. The cases are itemized below. 24: */ 25: 26: struct querytree 27: { 28: struct querytree *left; 29: struct querytree *right; 30: struct symbol sym; 31: }; 32: 33: 34: /* 35: ** Variable nodes of the form: 36: ** varno.attno 37: ** "Varno" is the variable number which can be translated 38: ** to a relation name by indexing into the range table. 39: ** "Attno" is the attribute number specifically the 40: ** "attid" field in the attribute tuple for the attribute. 41: ** "Frmt" and "frml" are the type and length of the attribute. 42: ** "Valptr" is used only in decomposition. If the variable 43: ** is tuple substituted then "valptr" will have a pointer to 44: ** the substituted value for the attribute; otherwise it will 45: ** be NULL. If reduction or one variable restriction has changed 46: ** the attribute number, then "valptr" will point to the next 47: ** active VAR node for this VAR. 48: */ 49: 50: struct qt_var 51: { 52: char filler[6]; 53: char varno; 54: char attno; 55: char frmt; 56: char frml; 57: char *valptr; 58: }; 59: 60: 61: /* 62: ** Structure for ROOT, AGHEAD, and AND nodes. In the parser and qrymod 63: ** these nodes are of length zero and none of this information 64: ** is present. Decomp maintains information about the variables 65: ** in the left and right descendents of the nodes. 66: ** The "rootuser" flag is present only in the ROOT and AGHEAD nodes. 67: ** It is TRUE only in the original ROOT node of the query. 68: */ 69: 70: struct qt_root 71: { 72: char filler[6]; 73: char tvarc; /* total of var's in sub-tree */ 74: char lvarc; /* # of variables in left branch */ 75: int lvarm; /* bit map of var's in left branch */ 76: int rvarm; /* bit map of var's in right branch*/ 77: int rootuser; /* flag: TRUE if root of user generated query */ 78: }; 79: 80: struct qt_res /* RESDOM and AOP nodes */ 81: { 82: char filler[6]; 83: int resno; /* result domain number */ 84: /* type and length are referenced as 85: ** frmt and frml */ 86: }; 87: 88: struct qt_ag 89: { 90: char filler[6]; 91: char filler2[4]; /* fill in over aop_type, frmt, and frml */ 92: char agfrmt, agfrml; /* result format type and length for agg's */ 93: }; 94: struct qt_op 95: { 96: char filler[6]; 97: int opno; /* operator number */ 98: }; 99: 100: struct qt_v 101: { 102: int fill[2]; 103: char vtype; /* variable type */ 104: char vlen; /* variable length */ 105: int *vpoint; /* variable pointer to value */ 106: }; 107: /* 108: ** structure for referencing a SOURCEID type symbol for 109: ** pipe transmission 110: ** 111: ** SOURCEID is a range table element. 112: */ 113: struct srcid 114: { 115: char type; /* type codes in symbol.h */ 116: char len; /* length in bytes of value field */ 117: int srcvar; /* variable number */ 118: char srcname[MAXNAME]; /* relation name */ 119: char srcown[2]; /* relation owner usercode */ 120: int srcstat; /* relstat field */ 121: };