1:
2: /*
3: ** INGRES.H -- basic header file for ingres.
4: **
5: ** See also aux.h for definitions used by some but not all.
6: **
7: ** Version:
8: ** @(#)ingres.h 8.4 12/8/85
9: */
10:
11: # ifndef MAXNAME
12:
13:
14: /*
15: ** Some generally useful stuff.
16: */
17:
18: # include <useful.h>
19:
20:
21:
22: /*
23: ** Definition of machine type
24: **
25: ** Currently the default is to the 32 bits existant on VAX 11/780s.
26: */
27:
28: # ifndef sun
29: # define VAX
30: # endif
31:
32: # include <trace.h>
33:
34: /*
35: ** INGRES manifest constants
36: **
37: ** These constants are manifest to the operation of the entire
38: ** system. If anything
39: ** is changed part or all of the system will stop working.
40: ** The values have been carefully chosen and are not intended
41: ** to be modifiable by users.
42: */
43:
44: # define MAXDOM 50 /* max # + 1 of doms in a relation */
45: # define MAXNAME 12 /* max size of a name (in bytes) */
46: # define MAXVAR 10 /* max # of variables */
47: # define MAXKEYS 6 /* max # of keys in secondary index */
48: # define MAXAGG 50 /* max number of aggs in a qry */
49: # define STACKSIZ 20 /* max depth for arith. expr. stacks */
50:
51: # define i_1 char
52: # define i_2 short
53: # define i_4 long
54: # define c_1 char
55: # define c_2 char
56: # define c_12 char
57: # define c_16 char
58:
59: /*
60: ** RELATION relation struct
61: **
62: ** The RELATION relation contains one tuple for each relation
63: ** in the database. This relation contains information which
64: ** describes how each relation is actually stored in the
65: ** database, who the owner is, information about its size,
66: ** assorted operation information, etc.
67: */
68:
69: # define RELID 1 /* domain for setkey */
70: # define RELOWNER 2
71:
72: struct relation
73: {
74: c_12 relid[MAXNAME]; /* relation name */
75: c_2 relowner[2]; /* code of relation owner */
76: i_1 relspec; /* storage mode of relation */
77: /* M_HEAP unsorted paged heap */
78: /* -M_HEAP compressed heap */
79: /* M_ISAM isam */
80: /* -M_ISAM compressed isam */
81: /* M_HASH hashed */
82: /* -M_HASH compressed hash */
83: i_1 relindxd; /* -1 rel is an index, 0 not indexed, 1 indexed */
84: i_2 relstat2; /* more status bits */
85: i_2 relstat; /* relation status bits */
86: i_4 relsave; /*unix time until which relation is saved*/
87: i_4 reltups; /*number of tuples in relation */
88: i_2 relatts; /*number of attributes in relation */
89: i_2 relwid; /*width (in bytes) of relation */
90: i_4 relprim; /*no. of primary pages in relation*/
91: i_4 relfree; /* head of freelist (b-trees only) */
92: i_4 relstamp; /* time of last mod*/
93: i_2 reldim; /* ordering dimension */
94: };
95:
96:
97: /*
98: ** ATTRIBUTE relation struct
99: **
100: ** The ATTRIBUTE relation contains one tuple for each domain
101: ** of each relation in the database. This relation describes
102: ** the position of each domain in the tuple, its format,
103: ** its length, and whether or not it is used in part of the key.
104: */
105:
106: # define ATTRELID 1
107: # define ATTOWNER 2
108: # define ATTID 3
109: # define ATTNAME 4
110:
111:
112: struct attribute
113: {
114: c_12 attrelid[MAXNAME]; /*relation name of which this is an attr */
115: c_2 attowner[2]; /* code of relation owner */
116: i_2 attid; /*domain number (from 1 to relatts) */
117: c_12 attname[MAXNAME]; /*alias for this domain*/
118: i_2 attoff; /*offset in tuple (no. of bytes*/
119: i_1 attfrmt; /* INT, FLOAT, CHAR (in symbol.h) */
120: i_1 attfrml; /* unsigned integer no of bytes */
121: i_1 attxtra; /* flag indicating whether this dom is part of a key */
122: };
123:
124: /*
125: ** tuple id struct
126: **
127: ** We want the line_id to be in the low-order of a long, in
128: ** order to make index work efficiently; since the order
129: ** of halfwords is reversed in a VAX, this is dependent...
130: */
131:
132: struct tup_id
133: {
134: # ifdef VAX
135: c_1 line_id, pg2, pg1, pg0;
136: # else
137: c_1 pg0, pg1, pg2, line_id;
138: # endif
139: };
140:
141: typedef struct tup_id TID;
142:
143: typedef union
144: {
145: long ltid;
146: TID s_tupid;
147: } tid_type;
148:
149:
150: # include <range.h> /* to get the descriptor struct */
151:
152:
153: /* modes to find */
154: # define NOKEY 1 /* scan entire relation */
155: # define EXACTKEY 2
156: # define LRANGEKEY 3 /* low range key */
157: # define FULLKEY 4 /* forces full key comparison */
158: # define HRANGEKEY 5 /* high range key */
159: # define BTREEKEY 6 /* search btree with exact lid keys */
160: # define BTREERANGE 7 /* use btree range to aid search */
161:
162: /*
163: ** anytype union -- union of ingres types
164: */
165:
166: union anytype
167: {
168: char i1type;
169: short i2type;
170: long i4type;
171: float f4type;
172: double f8type;
173: char c0type[1]; /* the 1 is bogus, only needs
174: * starting address
175: */
176: char *cptype;
177: char **cpptype;
178: };
179:
180: typedef union anytype ANYTYPE;
181:
182:
183: /*
184: ** Definitions for interface to the control module.
185: */
186:
187: extern char Qbuf[];
188:
189: /* structures for user defined delimiters */
190:
191: # define BITS 8
192: # define ACHARS 128
193: # define BITMAPLEN ACHARS/ BITS
194:
195:
196: struct dmap
197: {
198: int order; /* order in bitmap list */
199: char bits[ACHARS];/* 16 8-bit chars, each bits is one ascii char */
200: int type; /* 0 = ONE, 1 = ZEROMORE */
201: struct dmap *next; /* pointer to next map */
202: };
203: typedef struct dmap DMAP;
204:
205: struct delimlist
206: {
207: char group[12];
208: char delim[12];
209: struct dmap *maptr; /* pointer to map queue */
210: struct delimlist *back; /* pointer to delim after */
211: };
212: typedef struct delimlist DELIMLIST;
213:
214: struct delim_tup
215: {
216: int order;
217: char group[12];
218: char delim[12];
219: int type;
220: char bitmap[16];
221: };
222:
223: typedef struct delim_tup DELIM_TUP;
224:
225:
226:
227: /* structure for saving the header fields */
228:
229: struct hdrinfo
230: {
231: int len;
232: struct hdrinfo *next;
233: } ;
234:
235: typedef struct hdrinfo HDRINFO;
236:
237:
238: # endif MAXNAME
Defined struct's
dmap
defined in line
196; used 6 times
Defined union's
Defined typedef's
DMAP
defined in line
203;
never used
TID
defined in line
141; used 1 times
Defined macros
BITS
defined in line
191; used 1 times
RELID
defined in line
69;
never used
VAX
defined in line
29; used 1 times
c_1
defined in line
54; used 2 times
c_12
defined in line
56; used 3 times
c_16
defined in line
57;
never used
c_2
defined in line
55; used 2 times
i_1
defined in line
51; used 5 times
i_2
defined in line
52; used 7 times
i_4
defined in line
53; used 5 times