~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/pars0pars.h

  • Committer: Monty Taylor
  • Date: 2008-07-26 16:51:58 UTC
  • mto: (236.1.42 codestyle)
  • mto: This revision was merged to the branch mainline in revision 261.
  • Revision ID: monty@inaugust.com-20080726165158-qneg06kyisawnt3d
Added drizzle.pot. Not 100% on best practice here, but this seems ok.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
SQL parser
 
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
 
6
Created 11/19/1996 Heikki Tuuri
 
7
*******************************************************/
 
8
 
 
9
#ifndef pars0pars_h
 
10
#define pars0pars_h
 
11
 
 
12
#include "univ.i"
 
13
#include "que0types.h"
 
14
#include "usr0types.h"
 
15
#include "pars0types.h"
 
16
#include "row0types.h"
 
17
#include "trx0types.h"
 
18
#include "ut0vec.h"
 
19
 
 
20
/* Type of the user functions. The first argument is always InnoDB-supplied
 
21
and varies in type, while 'user_arg' is a user-supplied argument. The
 
22
meaning of the return type also varies. See the individual use cases, e.g.
 
23
the FETCH statement, for details on them. */
 
24
typedef void* (*pars_user_func_cb_t)(void* arg, void* user_arg);
 
25
 
 
26
extern int      yydebug;
 
27
 
 
28
/* If the following is set TRUE, the lexer will print the SQL string
 
29
as it tokenizes it */
 
30
 
 
31
#ifdef UNIV_SQL_DEBUG
 
32
extern ibool    pars_print_lexed;
 
33
#endif /* UNIV_SQL_DEBUG */
 
34
 
 
35
/* Global variable used while parsing a single procedure or query : the code is
 
36
NOT re-entrant */
 
37
extern sym_tab_t*       pars_sym_tab_global;
 
38
 
 
39
extern pars_res_word_t  pars_to_char_token;
 
40
extern pars_res_word_t  pars_to_number_token;
 
41
extern pars_res_word_t  pars_to_binary_token;
 
42
extern pars_res_word_t  pars_binary_to_number_token;
 
43
extern pars_res_word_t  pars_substr_token;
 
44
extern pars_res_word_t  pars_replstr_token;
 
45
extern pars_res_word_t  pars_concat_token;
 
46
extern pars_res_word_t  pars_length_token;
 
47
extern pars_res_word_t  pars_instr_token;
 
48
extern pars_res_word_t  pars_sysdate_token;
 
49
extern pars_res_word_t  pars_printf_token;
 
50
extern pars_res_word_t  pars_assert_token;
 
51
extern pars_res_word_t  pars_rnd_token;
 
52
extern pars_res_word_t  pars_rnd_str_token;
 
53
extern pars_res_word_t  pars_count_token;
 
54
extern pars_res_word_t  pars_sum_token;
 
55
extern pars_res_word_t  pars_distinct_token;
 
56
extern pars_res_word_t  pars_binary_token;
 
57
extern pars_res_word_t  pars_blob_token;
 
58
extern pars_res_word_t  pars_int_token;
 
59
extern pars_res_word_t  pars_char_token;
 
60
extern pars_res_word_t  pars_float_token;
 
61
extern pars_res_word_t  pars_update_token;
 
62
extern pars_res_word_t  pars_asc_token;
 
63
extern pars_res_word_t  pars_desc_token;
 
64
extern pars_res_word_t  pars_open_token;
 
65
extern pars_res_word_t  pars_close_token;
 
66
extern pars_res_word_t  pars_share_token;
 
67
extern pars_res_word_t  pars_unique_token;
 
68
extern pars_res_word_t  pars_clustered_token;
 
69
 
 
70
extern ulint            pars_star_denoter;
 
71
 
 
72
/* Procedure parameter types */
 
73
#define PARS_INPUT      0
 
74
#define PARS_OUTPUT     1
 
75
#define PARS_NOT_PARAM  2
 
76
 
 
77
 
 
78
/*****************************************************************
 
79
Parses an SQL string returning the query graph. */
 
80
 
 
81
que_t*
 
82
pars_sql(
 
83
/*=====*/
 
84
                                /* out, own: the query graph */
 
85
        pars_info_t*    info,   /* in: extra information, or NULL */
 
86
        const char*     str);   /* in: SQL string */
 
87
/*****************************************************************
 
88
Retrieves characters to the lexical analyzer. */
 
89
 
 
90
void
 
91
pars_get_lex_chars(
 
92
/*===============*/
 
93
        char*   buf,            /* in/out: buffer where to copy */
 
94
        int*    result,         /* out: number of characters copied or EOF */
 
95
        int     max_size);      /* in: maximum number of characters which fit
 
96
                                in the buffer */
 
97
/*****************************************************************
 
98
Called by yyparse on error. */
 
99
 
 
100
void
 
101
yyerror(
 
102
/*====*/
 
103
        const char*     s);     /* in: error message string */
 
104
/*************************************************************************
 
105
Parses a variable declaration. */
 
106
 
 
107
sym_node_t*
 
108
pars_variable_declaration(
 
109
/*======================*/
 
110
                                /* out, own: symbol table node of type
 
111
                                SYM_VAR */
 
112
        sym_node_t*     node,   /* in: symbol table node allocated for the
 
113
                                id of the variable */
 
114
        pars_res_word_t* type); /* in: pointer to a type token */
 
115
/*************************************************************************
 
116
Parses a function expression. */
 
117
 
 
118
func_node_t*
 
119
pars_func(
 
120
/*======*/
 
121
                                /* out, own: function node in a query tree */
 
122
        que_node_t*     res_word,/* in: function name reserved word */
 
123
        que_node_t*     arg);   /* in: first argument in the argument list */
 
124
/*************************************************************************
 
125
Parses an operator expression. */
 
126
 
 
127
func_node_t*
 
128
pars_op(
 
129
/*====*/
 
130
                                /* out, own: function node in a query tree */
 
131
        int             func,   /* in: operator token code */
 
132
        que_node_t*     arg1,   /* in: first argument */
 
133
        que_node_t*     arg2);  /* in: second argument or NULL for an unary
 
134
                                operator */
 
135
/*************************************************************************
 
136
Parses an ORDER BY clause. Order by a single column only is supported. */
 
137
 
 
138
order_node_t*
 
139
pars_order_by(
 
140
/*==========*/
 
141
                                /* out, own: order-by node in a query tree */
 
142
        sym_node_t*     column, /* in: column name */
 
143
        pars_res_word_t* asc);  /* in: &pars_asc_token or pars_desc_token */
 
144
/*************************************************************************
 
145
Parses a select list; creates a query graph node for the whole SELECT
 
146
statement. */
 
147
 
 
148
sel_node_t*
 
149
pars_select_list(
 
150
/*=============*/
 
151
                                        /* out, own: select node in a query
 
152
                                        tree */
 
153
        que_node_t*     select_list,    /* in: select list */
 
154
        sym_node_t*     into_list);     /* in: variables list or NULL */
 
155
/*************************************************************************
 
156
Parses a cursor declaration. */
 
157
 
 
158
que_node_t*
 
159
pars_cursor_declaration(
 
160
/*====================*/
 
161
                                        /* out: sym_node */
 
162
        sym_node_t*     sym_node,       /* in: cursor id node in the symbol
 
163
                                        table */
 
164
        sel_node_t*     select_node);   /* in: select node */
 
165
/*************************************************************************
 
166
Parses a function declaration. */
 
167
 
 
168
que_node_t*
 
169
pars_function_declaration(
 
170
/*======================*/
 
171
                                        /* out: sym_node */
 
172
        sym_node_t*     sym_node);      /* in: function id node in the symbol
 
173
                                        table */
 
174
/*************************************************************************
 
175
Parses a select statement. */
 
176
 
 
177
sel_node_t*
 
178
pars_select_statement(
 
179
/*==================*/
 
180
                                        /* out, own: select node in a query
 
181
                                        tree */
 
182
        sel_node_t*     select_node,    /* in: select node already containing
 
183
                                        the select list */
 
184
        sym_node_t*     table_list,     /* in: table list */
 
185
        que_node_t*     search_cond,    /* in: search condition or NULL */
 
186
        pars_res_word_t* for_update,    /* in: NULL or &pars_update_token */
 
187
        pars_res_word_t* consistent_read,/* in: NULL or
 
188
                                                &pars_consistent_token */
 
189
        order_node_t*   order_by);      /* in: NULL or an order-by node */
 
190
/*************************************************************************
 
191
Parses a column assignment in an update. */
 
192
 
 
193
col_assign_node_t*
 
194
pars_column_assignment(
 
195
/*===================*/
 
196
                                /* out: column assignment node */
 
197
        sym_node_t*     column, /* in: column to assign */
 
198
        que_node_t*     exp);   /* in: value to assign */
 
199
/*************************************************************************
 
200
Parses a delete or update statement start. */
 
201
 
 
202
upd_node_t*
 
203
pars_update_statement_start(
 
204
/*========================*/
 
205
                                        /* out, own: update node in a query
 
206
                                        tree */
 
207
        ibool           is_delete,      /* in: TRUE if delete */
 
208
        sym_node_t*     table_sym,      /* in: table name node */
 
209
        col_assign_node_t* col_assign_list);/* in: column assignment list, NULL
 
210
                                        if delete */
 
211
/*************************************************************************
 
212
Parses an update or delete statement. */
 
213
 
 
214
upd_node_t*
 
215
pars_update_statement(
 
216
/*==================*/
 
217
                                        /* out, own: update node in a query
 
218
                                        tree */
 
219
        upd_node_t*     node,           /* in: update node */
 
220
        sym_node_t*     cursor_sym,     /* in: pointer to a cursor entry in
 
221
                                        the symbol table or NULL */
 
222
        que_node_t*     search_cond);   /* in: search condition or NULL */
 
223
/*************************************************************************
 
224
Parses an insert statement. */
 
225
 
 
226
ins_node_t*
 
227
pars_insert_statement(
 
228
/*==================*/
 
229
                                        /* out, own: update node in a query
 
230
                                        tree */
 
231
        sym_node_t*     table_sym,      /* in: table name node */
 
232
        que_node_t*     values_list,    /* in: value expression list or NULL */
 
233
        sel_node_t*     select);        /* in: select condition or NULL */
 
234
/*************************************************************************
 
235
Parses a procedure parameter declaration. */
 
236
 
 
237
sym_node_t*
 
238
pars_parameter_declaration(
 
239
/*=======================*/
 
240
                                /* out, own: symbol table node of type
 
241
                                SYM_VAR */
 
242
        sym_node_t*     node,   /* in: symbol table node allocated for the
 
243
                                id of the parameter */
 
244
        ulint           param_type,
 
245
                                /* in: PARS_INPUT or PARS_OUTPUT */
 
246
        pars_res_word_t* type); /* in: pointer to a type token */
 
247
/*************************************************************************
 
248
Parses an elsif element. */
 
249
 
 
250
elsif_node_t*
 
251
pars_elsif_element(
 
252
/*===============*/
 
253
                                        /* out: elsif node */
 
254
        que_node_t*     cond,           /* in: if-condition */
 
255
        que_node_t*     stat_list);     /* in: statement list */
 
256
/*************************************************************************
 
257
Parses an if-statement. */
 
258
 
 
259
if_node_t*
 
260
pars_if_statement(
 
261
/*==============*/
 
262
                                        /* out: if-statement node */
 
263
        que_node_t*     cond,           /* in: if-condition */
 
264
        que_node_t*     stat_list,      /* in: statement list */
 
265
        que_node_t*     else_part);     /* in: else-part statement list */
 
266
/*************************************************************************
 
267
Parses a for-loop-statement. */
 
268
 
 
269
for_node_t*
 
270
pars_for_statement(
 
271
/*===============*/
 
272
                                        /* out: for-statement node */
 
273
        sym_node_t*     loop_var,       /* in: loop variable */
 
274
        que_node_t*     loop_start_limit,/* in: loop start expression */
 
275
        que_node_t*     loop_end_limit, /* in: loop end expression */
 
276
        que_node_t*     stat_list);     /* in: statement list */
 
277
/*************************************************************************
 
278
Parses a while-statement. */
 
279
 
 
280
while_node_t*
 
281
pars_while_statement(
 
282
/*=================*/
 
283
                                        /* out: while-statement node */
 
284
        que_node_t*     cond,           /* in: while-condition */
 
285
        que_node_t*     stat_list);     /* in: statement list */
 
286
/*************************************************************************
 
287
Parses an exit statement. */
 
288
 
 
289
exit_node_t*
 
290
pars_exit_statement(void);
 
291
/*=====================*/
 
292
                                        /* out: exit statement node */
 
293
/*************************************************************************
 
294
Parses a return-statement. */
 
295
 
 
296
return_node_t*
 
297
pars_return_statement(void);
 
298
/*=======================*/
 
299
                                        /* out: return-statement node */
 
300
/*************************************************************************
 
301
Parses a procedure call. */
 
302
 
 
303
func_node_t*
 
304
pars_procedure_call(
 
305
/*================*/
 
306
                                /* out: function node */
 
307
        que_node_t*     res_word,/* in: procedure name reserved word */
 
308
        que_node_t*     args);  /* in: argument list */
 
309
/*************************************************************************
 
310
Parses an assignment statement. */
 
311
 
 
312
assign_node_t*
 
313
pars_assignment_statement(
 
314
/*======================*/
 
315
                                /* out: assignment statement node */
 
316
        sym_node_t*     var,    /* in: variable to assign */
 
317
        que_node_t*     val);   /* in: value to assign */
 
318
/*************************************************************************
 
319
Parses a fetch statement. into_list or user_func (but not both) must be
 
320
non-NULL. */
 
321
 
 
322
fetch_node_t*
 
323
pars_fetch_statement(
 
324
/*=================*/
 
325
                                        /* out: fetch statement node */
 
326
        sym_node_t*     cursor,         /* in: cursor node */
 
327
        sym_node_t*     into_list,      /* in: variables to set, or NULL */
 
328
        sym_node_t*     user_func);     /* in: user function name, or NULL */
 
329
/*************************************************************************
 
330
Parses an open or close cursor statement. */
 
331
 
 
332
open_node_t*
 
333
pars_open_statement(
 
334
/*================*/
 
335
                                /* out: fetch statement node */
 
336
        ulint           type,   /* in: ROW_SEL_OPEN_CURSOR
 
337
                                or ROW_SEL_CLOSE_CURSOR */
 
338
        sym_node_t*     cursor);        /* in: cursor node */
 
339
/*************************************************************************
 
340
Parses a row_printf-statement. */
 
341
 
 
342
row_printf_node_t*
 
343
pars_row_printf_statement(
 
344
/*======================*/
 
345
                                        /* out: row_printf-statement node */
 
346
        sel_node_t*     sel_node);      /* in: select node */
 
347
/*************************************************************************
 
348
Parses a commit statement. */
 
349
 
 
350
commit_node_t*
 
351
pars_commit_statement(void);
 
352
/*=======================*/
 
353
/*************************************************************************
 
354
Parses a rollback statement. */
 
355
 
 
356
roll_node_t*
 
357
pars_rollback_statement(void);
 
358
/*=========================*/
 
359
/*************************************************************************
 
360
Parses a column definition at a table creation. */
 
361
 
 
362
sym_node_t*
 
363
pars_column_def(
 
364
/*============*/
 
365
                                                /* out: column sym table
 
366
                                                node */
 
367
        sym_node_t*             sym_node,       /* in: column node in the
 
368
                                                symbol table */
 
369
        pars_res_word_t*        type,           /* in: data type */
 
370
        sym_node_t*             len,            /* in: length of column, or
 
371
                                                NULL */
 
372
        void*                   is_unsigned,    /* in: if not NULL, column
 
373
                                                is of type UNSIGNED. */
 
374
        void*                   is_not_null);   /* in: if not NULL, column
 
375
                                                is of type NOT NULL. */
 
376
/*************************************************************************
 
377
Parses a table creation operation. */
 
378
 
 
379
tab_node_t*
 
380
pars_create_table(
 
381
/*==============*/
 
382
                                        /* out: table create subgraph */
 
383
        sym_node_t*     table_sym,      /* in: table name node in the symbol
 
384
                                        table */
 
385
        sym_node_t*     column_defs,    /* in: list of column names */
 
386
        void*           not_fit_in_memory);/* in: a non-NULL pointer means that
 
387
                                        this is a table which in simulations
 
388
                                        should be simulated as not fitting
 
389
                                        in memory; thread is put to sleep
 
390
                                        to simulate disk accesses; NOTE that
 
391
                                        this flag is not stored to the data
 
392
                                        dictionary on disk, and the database
 
393
                                        will forget about non-NULL value if
 
394
                                        it has to reload the table definition
 
395
                                        from disk */
 
396
/*************************************************************************
 
397
Parses an index creation operation. */
 
398
 
 
399
ind_node_t*
 
400
pars_create_index(
 
401
/*==============*/
 
402
                                        /* out: index create subgraph */
 
403
        pars_res_word_t* unique_def,    /* in: not NULL if a unique index */
 
404
        pars_res_word_t* clustered_def, /* in: not NULL if a clustered index */
 
405
        sym_node_t*     index_sym,      /* in: index name node in the symbol
 
406
                                        table */
 
407
        sym_node_t*     table_sym,      /* in: table name node in the symbol
 
408
                                        table */
 
409
        sym_node_t*     column_list);   /* in: list of column names */
 
410
/*************************************************************************
 
411
Parses a procedure definition. */
 
412
 
 
413
que_fork_t*
 
414
pars_procedure_definition(
 
415
/*======================*/
 
416
                                        /* out: query fork node */
 
417
        sym_node_t*     sym_node,       /* in: procedure id node in the symbol
 
418
                                        table */
 
419
        sym_node_t*     param_list,     /* in: parameter declaration list */
 
420
        que_node_t*     stat_list);     /* in: statement list */
 
421
 
 
422
/*****************************************************************
 
423
Parses a stored procedure call, when this is not within another stored
 
424
procedure, that is, the client issues a procedure call directly.
 
425
In MySQL/InnoDB, stored InnoDB procedures are invoked via the
 
426
parsed procedure tree, not via InnoDB SQL, so this function is not used. */
 
427
 
 
428
que_fork_t*
 
429
pars_stored_procedure_call(
 
430
/*=======================*/
 
431
                                        /* out: query graph */
 
432
        sym_node_t*     sym_node);      /* in: stored procedure name */
 
433
/**********************************************************************
 
434
Completes a query graph by adding query thread and fork nodes
 
435
above it and prepares the graph for running. The fork created is of
 
436
type QUE_FORK_MYSQL_INTERFACE. */
 
437
 
 
438
que_thr_t*
 
439
pars_complete_graph_for_exec(
 
440
/*=========================*/
 
441
                                /* out: query thread node to run */
 
442
        que_node_t*     node,   /* in: root node for an incomplete
 
443
                                query graph */
 
444
        trx_t*          trx,    /* in: transaction handle */
 
445
        mem_heap_t*     heap);  /* in: memory heap from which allocated */
 
446
 
 
447
/********************************************************************
 
448
Create parser info struct.*/
 
449
 
 
450
pars_info_t*
 
451
pars_info_create(void);
 
452
/*==================*/
 
453
                /* out, own: info struct */
 
454
 
 
455
/********************************************************************
 
456
Free info struct and everything it contains.*/
 
457
 
 
458
void
 
459
pars_info_free(
 
460
/*===========*/
 
461
        pars_info_t*    info);  /* in: info struct */
 
462
 
 
463
/********************************************************************
 
464
Add bound literal. */
 
465
 
 
466
void
 
467
pars_info_add_literal(
 
468
/*==================*/
 
469
        pars_info_t*    info,           /* in: info struct */
 
470
        const char*     name,           /* in: name */
 
471
        const void*     address,        /* in: address */
 
472
        ulint           length,         /* in: length of data */
 
473
        ulint           type,           /* in: type, e.g. DATA_FIXBINARY */
 
474
        ulint           prtype);        /* in: precise type, e.g.
 
475
                                        DATA_UNSIGNED */
 
476
 
 
477
/********************************************************************
 
478
Equivalent to pars_info_add_literal(info, name, str, strlen(str),
 
479
DATA_VARCHAR, DATA_ENGLISH). */
 
480
 
 
481
void
 
482
pars_info_add_str_literal(
 
483
/*======================*/
 
484
        pars_info_t*    info,           /* in: info struct */
 
485
        const char*     name,           /* in: name */
 
486
        const char*     str);           /* in: string */
 
487
 
 
488
/********************************************************************
 
489
Equivalent to:
 
490
 
 
491
char buf[4];
 
492
mach_write_to_4(buf, val);
 
493
pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
 
494
 
 
495
except that the buffer is dynamically allocated from the info struct's
 
496
heap. */
 
497
 
 
498
void
 
499
pars_info_add_int4_literal(
 
500
/*=======================*/
 
501
        pars_info_t*    info,           /* in: info struct */
 
502
        const char*     name,           /* in: name */
 
503
        lint            val);           /* in: value */
 
504
 
 
505
/********************************************************************
 
506
Equivalent to:
 
507
 
 
508
char buf[8];
 
509
mach_write_to_8(buf, val);
 
510
pars_info_add_literal(info, name, buf, 8, DATA_BINARY, 0);
 
511
 
 
512
except that the buffer is dynamically allocated from the info struct's
 
513
heap. */
 
514
 
 
515
void
 
516
pars_info_add_dulint_literal(
 
517
/*=========================*/
 
518
        pars_info_t*    info,           /* in: info struct */
 
519
        const char*     name,           /* in: name */
 
520
        dulint          val);           /* in: value */
 
521
/********************************************************************
 
522
Add user function. */
 
523
 
 
524
void
 
525
pars_info_add_function(
 
526
/*===================*/
 
527
        pars_info_t*            info,   /* in: info struct */
 
528
        const char*             name,   /* in: function name */
 
529
        pars_user_func_cb_t     func,   /* in: function address */
 
530
        void*                   arg);   /* in: user-supplied argument */
 
531
 
 
532
/********************************************************************
 
533
Add bound id. */
 
534
 
 
535
void
 
536
pars_info_add_id(
 
537
/*=============*/
 
538
        pars_info_t*    info,           /* in: info struct */
 
539
        const char*     name,           /* in: name */
 
540
        const char*     id);            /* in: id */
 
541
 
 
542
/********************************************************************
 
543
Get user function with the given name.*/
 
544
 
 
545
pars_user_func_t*
 
546
pars_info_get_user_func(
 
547
/*====================*/
 
548
                                        /* out: user func, or NULL if not
 
549
                                        found */
 
550
        pars_info_t*            info,   /* in: info struct */
 
551
        const char*             name);  /* in: function name to find*/
 
552
 
 
553
/********************************************************************
 
554
Get bound literal with the given name.*/
 
555
 
 
556
pars_bound_lit_t*
 
557
pars_info_get_bound_lit(
 
558
/*====================*/
 
559
                                        /* out: bound literal, or NULL if
 
560
                                        not found */
 
561
        pars_info_t*            info,   /* in: info struct */
 
562
        const char*             name);  /* in: bound literal name to find */
 
563
 
 
564
/********************************************************************
 
565
Get bound id with the given name.*/
 
566
 
 
567
pars_bound_id_t*
 
568
pars_info_get_bound_id(
 
569
/*===================*/
 
570
                                        /* out: bound id, or NULL if not
 
571
                                        found */
 
572
        pars_info_t*            info,   /* in: info struct */
 
573
        const char*             name);  /* in: bound id name to find */
 
574
 
 
575
 
 
576
/* Extra information supplied for pars_sql(). */
 
577
struct pars_info_struct {
 
578
        mem_heap_t*     heap;           /* our own memory heap */
 
579
 
 
580
        ib_vector_t*    funcs;          /* user functions, or NUll
 
581
                                        (pars_user_func_t*) */
 
582
        ib_vector_t*    bound_lits;     /* bound literals, or NULL
 
583
                                        (pars_bound_lit_t*) */
 
584
        ib_vector_t*    bound_ids;      /* bound ids, or NULL
 
585
                                        (pars_bound_id_t*) */
 
586
 
 
587
        ibool           graph_owns_us;  /* if TRUE (which is the default),
 
588
                                        que_graph_free() will free us */
 
589
};
 
590
 
 
591
/* User-supplied function and argument. */
 
592
struct pars_user_func_struct {
 
593
        const char*             name;           /* function name */
 
594
        pars_user_func_cb_t     func;           /* function address */
 
595
        void*                   arg;            /* user-supplied argument */
 
596
};
 
597
 
 
598
/* Bound literal. */
 
599
struct pars_bound_lit_struct {
 
600
        const char*     name;           /* name */
 
601
        const void*     address;        /* address */
 
602
        ulint           length;         /* length of data */
 
603
        ulint           type;           /* type, e.g. DATA_FIXBINARY */
 
604
        ulint           prtype;         /* precise type, e.g. DATA_UNSIGNED */
 
605
};
 
606
 
 
607
/* Bound id. */
 
608
struct pars_bound_id_struct {
 
609
        const char*     name;           /* name */
 
610
        const char*     id;             /* id */
 
611
};
 
612
 
 
613
/* Struct used to denote a reserved word in a parsing tree */
 
614
struct pars_res_word_struct{
 
615
        int     code;   /* the token code for the reserved word from
 
616
                        pars0grm.h */
 
617
};
 
618
 
 
619
/* A predefined function or operator node in a parsing tree; this construct
 
620
is also used for some non-functions like the assignment ':=' */
 
621
struct func_node_struct{
 
622
        que_common_t    common; /* type: QUE_NODE_FUNC */
 
623
        int             func;   /* token code of the function name */
 
624
        ulint           klass;  /* class of the function */
 
625
        que_node_t*     args;   /* argument(s) of the function */
 
626
        UT_LIST_NODE_T(func_node_t) cond_list;
 
627
                                /* list of comparison conditions; defined
 
628
                                only for comparison operator nodes except,
 
629
                                presently, for OPT_SCROLL_TYPE ones */
 
630
        UT_LIST_NODE_T(func_node_t) func_node_list;
 
631
                                /* list of function nodes in a parsed
 
632
                                query graph */
 
633
};
 
634
 
 
635
/* An order-by node in a select */
 
636
struct order_node_struct{
 
637
        que_common_t    common; /* type: QUE_NODE_ORDER */
 
638
        sym_node_t*     column; /* order-by column */
 
639
        ibool           asc;    /* TRUE if ascending, FALSE if descending */
 
640
};
 
641
 
 
642
/* Procedure definition node */
 
643
struct proc_node_struct{
 
644
        que_common_t    common;         /* type: QUE_NODE_PROC */
 
645
        sym_node_t*     proc_id;        /* procedure name symbol in the symbol
 
646
                                        table of this same procedure */
 
647
        sym_node_t*     param_list;     /* input and output parameters */
 
648
        que_node_t*     stat_list;      /* statement list */
 
649
        sym_tab_t*      sym_tab;        /* symbol table of this procedure */
 
650
};
 
651
 
 
652
/* elsif-element node */
 
653
struct elsif_node_struct{
 
654
        que_common_t    common;         /* type: QUE_NODE_ELSIF */
 
655
        que_node_t*     cond;           /* if condition */
 
656
        que_node_t*     stat_list;      /* statement list */
 
657
};
 
658
 
 
659
/* if-statement node */
 
660
struct if_node_struct{
 
661
        que_common_t    common;         /* type: QUE_NODE_IF */
 
662
        que_node_t*     cond;           /* if condition */
 
663
        que_node_t*     stat_list;      /* statement list */
 
664
        que_node_t*     else_part;      /* else-part statement list */
 
665
        elsif_node_t*   elsif_list;     /* elsif element list */
 
666
};
 
667
 
 
668
/* while-statement node */
 
669
struct while_node_struct{
 
670
        que_common_t    common;         /* type: QUE_NODE_WHILE */
 
671
        que_node_t*     cond;           /* while condition */
 
672
        que_node_t*     stat_list;      /* statement list */
 
673
};
 
674
 
 
675
/* for-loop-statement node */
 
676
struct for_node_struct{
 
677
        que_common_t    common;         /* type: QUE_NODE_FOR */
 
678
        sym_node_t*     loop_var;       /* loop variable: this is the
 
679
                                        dereferenced symbol from the
 
680
                                        variable declarations, not the
 
681
                                        symbol occurrence in the for loop
 
682
                                        definition */
 
683
        que_node_t*     loop_start_limit;/* initial value of loop variable */
 
684
        que_node_t*     loop_end_limit; /* end value of loop variable */
 
685
        int             loop_end_value; /* evaluated value for the end value:
 
686
                                        it is calculated only when the loop
 
687
                                        is entered, and will not change within
 
688
                                        the loop */
 
689
        que_node_t*     stat_list;      /* statement list */
 
690
};
 
691
 
 
692
/* exit statement node */
 
693
struct exit_node_struct{
 
694
        que_common_t    common;         /* type: QUE_NODE_EXIT */
 
695
};
 
696
 
 
697
/* return-statement node */
 
698
struct return_node_struct{
 
699
        que_common_t    common;         /* type: QUE_NODE_RETURN */
 
700
};
 
701
 
 
702
/* Assignment statement node */
 
703
struct assign_node_struct{
 
704
        que_common_t    common;         /* type: QUE_NODE_ASSIGNMENT */
 
705
        sym_node_t*     var;            /* variable to set */
 
706
        que_node_t*     val;            /* value to assign */
 
707
};
 
708
 
 
709
/* Column assignment node */
 
710
struct col_assign_node_struct{
 
711
        que_common_t    common;         /* type: QUE_NODE_COL_ASSIGN */
 
712
        sym_node_t*     col;            /* column to set */
 
713
        que_node_t*     val;            /* value to assign */
 
714
};
 
715
 
 
716
/* Classes of functions */
 
717
#define PARS_FUNC_ARITH         1       /* +, -, *, / */
 
718
#define PARS_FUNC_LOGICAL       2
 
719
#define PARS_FUNC_CMP           3
 
720
#define PARS_FUNC_PREDEFINED    4       /* TO_NUMBER, SUBSTR, ... */
 
721
#define PARS_FUNC_AGGREGATE     5       /* COUNT, DISTINCT, SUM */
 
722
#define PARS_FUNC_OTHER         6       /* these are not real functions,
 
723
                                        e.g., := */
 
724
 
 
725
#ifndef UNIV_NONINL
 
726
#include "pars0pars.ic"
 
727
#endif
 
728
 
 
729
#endif