|
|
1.1 root 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 7.1 2/5/81
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: ** If PDP11 is defined, the wordsize is defined as 16, and any other
26: ** machine dependant things are set to the values needed for a PDP 11/70.
27: ** Currently the default is to the 32 bits existant on VAX 11/780s.
28: */
29:
30: # define VAX
31:
32:
33:
34:
35: # include <trace.h>
36:
37: /*
38: ** INGRES manifest constants
39: **
40: ** These constants are manifest to the operation of the entire
41: ** system. If anything
42: ** is changed part or all of the system will stop working.
43: ** The values have been carefully chosen and are not intended
44: ** to be modifiable by users.
45: */
46:
47: # define MAXDOM 50 /* max # + 1 of doms in a relation */
48: # define MAXNAME 12 /* max size of a name (in bytes) */
49: # define MAXVAR 10 /* max # of variables */
50: # define MAXKEYS 6 /* max # of keys in secondary index */
51: # define MAXAGG 50 /* max number of aggs in a qry */
52: # define STACKSIZ 20 /* max depth for arith. expr. stacks */
53: # define I1MASK 0377 /* mask out sign extension that occurs
54: ** when a c1 or i1 field is converted
55: ** to an i2 field.
56: */
57:
58: # define i_1 char
59: # define i_2 short
60: # define i_4 long
61: # define c_1 char
62: # define c_2 char
63: # define c_12 char
64:
65: /*
66: ** RELATION relation struct
67: **
68: ** The RELATION relation contains one tuple for each relation
69: ** in the database. This relation contains information which
70: ** describes how each relation is actually stored in the
71: ** database, who the owner is, information about its size,
72: ** assorted operation information, etc.
73: */
74:
75: # define RELID 1 /* domain for setkey */
76: # define RELOWNER 2
77:
78: struct relation
79: {
80: c_12 relid[MAXNAME]; /* relation name */
81: c_2 relowner[2]; /* code of relation owner */
82: i_1 relspec; /* storage mode of relation */
83: /* M_HEAP unsorted paged heap */
84: /* -M_HEAP compressed heap */
85: /* M_ISAM isam */
86: /* -M_ISAM compressed isam */
87: /* M_HASH hashed */
88: /* -M_HASH compressed hash */
89: i_1 relindxd; /* -1 rel is an index, 0 not indexed, 1 indexed */
90: i_2 relstat2; /* more status bits */
91: i_2 relstat; /* relation status bits */
92: i_4 relsave; /*unix time until which relation is saved*/
93: i_4 reltups; /*number of tuples in relation */
94: i_2 relatts; /*number of attributes in relation */
95: i_2 relwid; /*width (in bytes) of relation */
96: i_4 relprim; /*no. of primary pages in relation*/
97: i_4 relfree; /* head of freelist (b-trees only) */
98: i_4 relstamp; /*time of last mod*/
99: };
100:
101:
102: /*
103: ** ATTRIBUTE relation struct
104: **
105: ** The ATTRIBUTE relation contains one tuple for each domain
106: ** of each relation in the database. This relation describes
107: ** the position of each domain in the tuple, its format,
108: ** its length, and whether or not it is used in part of the key.
109: */
110:
111: # define ATTRELID 1
112: # define ATTOWNER 2
113: # define ATTID 3
114: # define ATTNAME 4
115:
116:
117: struct attribute
118: {
119: c_12 attrelid[MAXNAME]; /*relation name of which this is an attr */
120: c_2 attowner[2]; /* code of relation owner */
121: i_2 attid; /*domain number (from 1 to relatts) */
122: c_12 attname[MAXNAME]; /*alias for this domain*/
123: i_2 attoff; /*offset in tuple (no. of bytes*/
124: i_1 attfrmt; /* INT, FLOAT, CHAR (in symbol.h) */
125: i_1 attfrml; /* unsigned integer no of bytes */
126: i_1 attxtra; /* flag indicating whether this dom is part of a key */
127: };
128:
129: /*
130: ** tuple id struct
131: **
132: ** We want the line_id to be in the low-order of a long, in
133: ** order to make index work efficiently; since the order
134: ** of halfwords is reversed in a VAX, this is dependent...
135: */
136:
137: struct tup_id
138: {
139: # ifdef PDP11
140: c_1 pg1, pg0;
141: c_1 line_id, pg2;
142: # else PDP11
143: c_1 line_id, pg2, pg1, pg0;
144: # endif PDP11
145: };
146:
147: typedef struct tup_id TID;
148:
149: typedef union
150: {
151: long ltid;
152: TID s_tupid;
153: } tid_type;
154:
155:
156: # include <range.h> /* to get the descriptor struct */
157:
158:
159: /* modes to find */
160: # define NOKEY 1 /* scan entire relation */
161: # define EXACTKEY 2
162: # define LRANGEKEY 3 /* low range key */
163: # define FULLKEY 4 /* forces full key comparison */
164: # define HRANGEKEY 5 /* high range key */
165:
166: /*
167: ** anytype union -- union of ingres types
168: */
169:
170: union anytype
171: {
172: char i1type;
173: short i2type;
174: long i4type;
175: float f4type;
176: double f8type;
177: char c0type[1]; /* the 1 is bogus, only needs
178: * starting address
179: */
180: char *cptype;
181: char **cpptype;
182: };
183:
184: typedef union anytype ANYTYPE;
185:
186:
187: /*
188: ** Definitions for interface to the control module.
189: */
190:
191: extern char Qbuf[];
192:
193:
194: # endif MAXNAME
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.