forked from electrum/ssb-dbgen
-
Notifications
You must be signed in to change notification settings - Fork 10
/
dsstypes.h
312 lines (266 loc) · 7.77 KB
/
dsstypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
* Sccsid: @(#)dsstypes.h 2.1.8.1
*
* general definitions and control information for the DSS data types
* and function prototypes
* Modified for SSBM prototype
*/
/*
* typedefs
*/
#ifdef SSBM
typedef struct
{
long custkey;
char name[C_NAME_LEN + 1];
int nlen;
char address[C_ADDR_MAX + 1];
int alen;
char city[CITY_FIX+1];
int nation_key;
char nation_name[C_NATION_NAME_LEN+1];
int region_key;
char region_name[C_REGION_NAME_LEN+1];
char phone[PHONE_LEN + 1];
char mktsegment[MAXAGG_LEN + 1];
} customer_t;
#else
typedef struct
{
long custkey;
char name[C_NAME_LEN + 1];
char address[C_ADDR_MAX + 1];
int alen;
long nation_code;
char phone[PHONE_LEN + 1];
long acctbal;
char mktsegment[MAXAGG_LEN + 1];
char comment[C_CMNT_MAX + 1];
int clen;
} customer_t;
#endif
/* customers.c */
long mk_cust PROTO((long n_cust, customer_t * c));
int pr_cust PROTO((customer_t * c, int mode));
int ld_cust PROTO((customer_t * c, int mode));
#ifdef SSBM
typedef struct
{
DSS_HUGE *okey; /*for clustering line items*/
int linenumber; /*integer, constrain to max of 7*/
long custkey;
long partkey;
long suppkey;
char orderdate[DATE_LEN];
char opriority[MAXAGG_LEN + 1];
long ship_priority;
long quantity;
long extended_price;
long order_totalprice;
long discount;
long revenue;
long supp_cost;
long tax;
char commit_date[DATE_LEN] ;
char shipmode[O_SHIP_MODE_LEN + 1];
} lineorder_t;
#else
typedef struct
{
DSS_HUGE *okey;
long partkey;
long suppkey;
long lcnt;
long quantity;
long eprice;
long discount;
long tax;
char rflag[1];
char lstatus[1];
char cdate[DATE_LEN];
char sdate[DATE_LEN];
char rdate[DATE_LEN];
char shipinstruct[MAXAGG_LEN + 1];
char shipmode[MAXAGG_LEN + 1];
char comment[L_CMNT_MAX + 1];
int clen;
} line_t;
#endif
#ifdef SSBM
typedef struct
{
DSS_HUGE *okey;
long custkey;
int totalprice;
char odate[DATE_LEN];
char opriority[MAXAGG_LEN + 1];
char clerk[O_CLRK_LEN + 1];
int spriority;
long lines;
lineorder_t lineorders[O_LCNT_MAX];
} order_t;
#else
typedef struct
{
DSS_HUGE *okey;
long custkey;
char orderstatus;
long totalprice;
char odate[DATE_LEN];
char opriority[MAXAGG_LEN + 1];
char clerk[O_CLRK_LEN + 1];
long spriority;
long lines;
char comment[O_CMNT_MAX + 1];
int clen;
line_t l[O_LCNT_MAX];
} order_t;
#endif
/* order.c */
long mk_order PROTO((long index, order_t * o, long upd_num));
int pr_order PROTO((order_t * o, int mode));
int ld_order PROTO((order_t * o, int mode));
void ez_sparse PROTO((long index, DSS_HUGE *ok, long seq));
#ifndef SUPPORT_64BITS
void hd_sparse PROTO((long index, DSS_HUGE *ok, long seq));
#endif
#ifdef SSBM
/*SSBM removes the part supplier table*/
#else
typedef struct
{
long partkey;
long suppkey;
long qty;
long scost;
char comment[PS_CMNT_MAX + 1];
int clen;
} partsupp_t;
#endif
#ifdef SSBM
typedef struct
{
long partkey;
char name[P_NAME_LEN + 1];
int nlen;
char mfgr[P_MFG_LEN + 1];
char category[P_CAT_LEN + 1];
char brand[P_BRND_LEN + 1];
char color[P_COLOR_MAX + 1];
int clen;
char type[P_TYPE_MAX + 1];
int tlen;
long size;
char container[P_CNTR_LEN + 1];
} part_t;
#else
typedef struct
{
long partkey;
char name[P_NAME_LEN + 1];
int nlen;
char mfgr[P_MFG_LEN + 1];
char brand[P_BRND_LEN + 1];
char type[P_TYPE_LEN + 1];
int tlen;
long size;
char container[P_CNTR_LEN + 1];
long retailprice;
char comment[P_CMNT_MAX + 1];
int clen;
partsupp_t s[SUPP_PER_PART];
} part_t;
#endif
/* parts.c */
long mk_part PROTO((long index, part_t * p));
int pr_part PROTO((part_t * part, int mode));
int ld_part PROTO((part_t * part, int mode));
#ifdef SSBM
typedef struct
{
long suppkey;
char name[S_NAME_LEN + 1];
char address[S_ADDR_MAX + 1];
int alen;
char city[CITY_FIX +1];
int nation_key;
char nation_name[S_NATION_NAME_LEN+1];
int region_key;
char region_name[S_REGION_NAME_LEN+1];
char phone[PHONE_LEN + 1];
} supplier_t;
#else
typedef struct
{
long suppkey;
char name[S_NAME_LEN + 1];
char address[S_ADDR_MAX + 1];
int alen;
long nation_code;
char phone[PHONE_LEN + 1];
long acctbal;
char comment[S_CMNT_MAX + 1];
int clen;
} supplier_t;
#endif
/* supplier.c */
long mk_supp PROTO((long index, supplier_t * s));
int pr_supp PROTO((supplier_t * supp, int mode));
int ld_supp PROTO((supplier_t * supp, int mode));
#ifdef SSBM
/*todo: add new date table*/
typedef struct
{
long datekey;
char date[D_DATE_LEN+1];
char dayofweek[D_DAYWEEK_LEN+1] ;
char month[D_MONTH_LEN+1];
int year;
int yearmonthnum;
char yearmonth[D_YEARMONTH_LEN+1];
int daynuminweek;
int daynuminmonth;
int daynuminyear;
int monthnuminyear;
int weeknuminyear;
char sellingseason[D_SEASON_LEN + 1];
int slen;
char lastdayinweekfl[2];
char lastdayinmonthfl[2];
char holidayfl[2];
char weekdayfl[2];
} date_t;
/* date.c */
long mk_date PROTO((long index, date_t * d));
int pr_date PROTO((date_t * date, int mode));
int ld_date PROTO((date_t * date, int mode));
#endif
typedef struct
{
long timekey;
char alpha[DATE_LEN];
long year;
long month;
long week;
long day;
} dss_time_t;
/* time.c */
long mk_time PROTO((long index, dss_time_t * t));
/*
* this assumes that N_CMNT_LEN >= R_CMNT_LEN
*/
typedef struct
{
long code;
char *text;
long join;
char comment[N_CMNT_MAX + 1];
int clen;
} code_t;
/* code table */
int mk_nation PROTO((long i, code_t * c));
int pr_nation PROTO((code_t * c, int mode));
int ld_nation PROTO((code_t * c, int mode));
int mk_region PROTO((long i, code_t * c));
int pr_region PROTO((code_t * c, int mode));
int ld_region PROTO((code_t * c, int mode));