00001 /****************************************************** 00002 SQL parser 00003 00004 (c) 1996 Innobase Oy 00005 00006 Created 11/19/1996 Heikki Tuuri 00007 *******************************************************/ 00008 00009 #ifndef pars0pars_h 00010 #define pars0pars_h 00011 00012 #include "univ.i" 00013 #include "que0types.h" 00014 #include "usr0types.h" 00015 #include "pars0types.h" 00016 #include "row0types.h" 00017 #include "trx0types.h" 00018 #include "ut0vec.h" 00019 00020 /* Type of the user functions. The first argument is always InnoDB-supplied 00021 and varies in type, while 'user_arg' is a user-supplied argument. The 00022 meaning of the return type also varies. See the individual use cases, e.g. 00023 the FETCH statement, for details on them. */ 00024 typedef void* (*pars_user_func_cb_t)(void* arg, void* user_arg); 00025 00026 extern int yydebug; 00027 00028 /* If the following is set TRUE, the lexer will print the SQL string 00029 as it tokenizes it */ 00030 00031 #ifdef UNIV_SQL_DEBUG 00032 extern ibool pars_print_lexed; 00033 #endif /* UNIV_SQL_DEBUG */ 00034 00035 /* Global variable used while parsing a single procedure or query : the code is 00036 NOT re-entrant */ 00037 extern sym_tab_t* pars_sym_tab_global; 00038 00039 extern pars_res_word_t pars_to_char_token; 00040 extern pars_res_word_t pars_to_number_token; 00041 extern pars_res_word_t pars_to_binary_token; 00042 extern pars_res_word_t pars_binary_to_number_token; 00043 extern pars_res_word_t pars_substr_token; 00044 extern pars_res_word_t pars_replstr_token; 00045 extern pars_res_word_t pars_concat_token; 00046 extern pars_res_word_t pars_length_token; 00047 extern pars_res_word_t pars_instr_token; 00048 extern pars_res_word_t pars_sysdate_token; 00049 extern pars_res_word_t pars_printf_token; 00050 extern pars_res_word_t pars_assert_token; 00051 extern pars_res_word_t pars_rnd_token; 00052 extern pars_res_word_t pars_rnd_str_token; 00053 extern pars_res_word_t pars_count_token; 00054 extern pars_res_word_t pars_sum_token; 00055 extern pars_res_word_t pars_distinct_token; 00056 extern pars_res_word_t pars_binary_token; 00057 extern pars_res_word_t pars_blob_token; 00058 extern pars_res_word_t pars_int_token; 00059 extern pars_res_word_t pars_char_token; 00060 extern pars_res_word_t pars_float_token; 00061 extern pars_res_word_t pars_update_token; 00062 extern pars_res_word_t pars_asc_token; 00063 extern pars_res_word_t pars_desc_token; 00064 extern pars_res_word_t pars_open_token; 00065 extern pars_res_word_t pars_close_token; 00066 extern pars_res_word_t pars_share_token; 00067 extern pars_res_word_t pars_unique_token; 00068 extern pars_res_word_t pars_clustered_token; 00069 00070 extern ulint pars_star_denoter; 00071 00072 /* Procedure parameter types */ 00073 #define PARS_INPUT 0 00074 #define PARS_OUTPUT 1 00075 #define PARS_NOT_PARAM 2 00076 00077 int 00078 yyparse(void); 00079 00080 /***************************************************************** 00081 Parses an SQL string returning the query graph. */ 00082 00083 que_t* 00084 pars_sql( 00085 /*=====*/ 00086 /* out, own: the query graph */ 00087 pars_info_t* info, /* in: extra information, or NULL */ 00088 const char* str); /* in: SQL string */ 00089 /***************************************************************** 00090 Retrieves characters to the lexical analyzer. */ 00091 00092 void 00093 pars_get_lex_chars( 00094 /*===============*/ 00095 char* buf, /* in/out: buffer where to copy */ 00096 int* result, /* out: number of characters copied or EOF */ 00097 int max_size); /* in: maximum number of characters which fit 00098 in the buffer */ 00099 /***************************************************************** 00100 Called by yyparse on error. */ 00101 00102 void 00103 yyerror( 00104 /*====*/ 00105 const char* s); /* in: error message string */ 00106 /************************************************************************* 00107 Parses a variable declaration. */ 00108 00109 sym_node_t* 00110 pars_variable_declaration( 00111 /*======================*/ 00112 /* out, own: symbol table node of type 00113 SYM_VAR */ 00114 sym_node_t* node, /* in: symbol table node allocated for the 00115 id of the variable */ 00116 pars_res_word_t* type); /* in: pointer to a type token */ 00117 /************************************************************************* 00118 Parses a function expression. */ 00119 00120 func_node_t* 00121 pars_func( 00122 /*======*/ 00123 /* out, own: function node in a query tree */ 00124 que_node_t* res_word,/* in: function name reserved word */ 00125 que_node_t* arg); /* in: first argument in the argument list */ 00126 /************************************************************************* 00127 Parses an operator expression. */ 00128 00129 func_node_t* 00130 pars_op( 00131 /*====*/ 00132 /* out, own: function node in a query tree */ 00133 int func, /* in: operator token code */ 00134 que_node_t* arg1, /* in: first argument */ 00135 que_node_t* arg2); /* in: second argument or NULL for an unary 00136 operator */ 00137 /************************************************************************* 00138 Parses an ORDER BY clause. Order by a single column only is supported. */ 00139 00140 order_node_t* 00141 pars_order_by( 00142 /*==========*/ 00143 /* out, own: order-by node in a query tree */ 00144 sym_node_t* column, /* in: column name */ 00145 pars_res_word_t* asc); /* in: &pars_asc_token or pars_desc_token */ 00146 /************************************************************************* 00147 Parses a select list; creates a query graph node for the whole SELECT 00148 statement. */ 00149 00150 sel_node_t* 00151 pars_select_list( 00152 /*=============*/ 00153 /* out, own: select node in a query 00154 tree */ 00155 que_node_t* select_list, /* in: select list */ 00156 sym_node_t* into_list); /* in: variables list or NULL */ 00157 /************************************************************************* 00158 Parses a cursor declaration. */ 00159 00160 que_node_t* 00161 pars_cursor_declaration( 00162 /*====================*/ 00163 /* out: sym_node */ 00164 sym_node_t* sym_node, /* in: cursor id node in the symbol 00165 table */ 00166 sel_node_t* select_node); /* in: select node */ 00167 /************************************************************************* 00168 Parses a function declaration. */ 00169 00170 que_node_t* 00171 pars_function_declaration( 00172 /*======================*/ 00173 /* out: sym_node */ 00174 sym_node_t* sym_node); /* in: function id node in the symbol 00175 table */ 00176 /************************************************************************* 00177 Parses a select statement. */ 00178 00179 sel_node_t* 00180 pars_select_statement( 00181 /*==================*/ 00182 /* out, own: select node in a query 00183 tree */ 00184 sel_node_t* select_node, /* in: select node already containing 00185 the select list */ 00186 sym_node_t* table_list, /* in: table list */ 00187 que_node_t* search_cond, /* in: search condition or NULL */ 00188 pars_res_word_t* for_update, /* in: NULL or &pars_update_token */ 00189 pars_res_word_t* consistent_read,/* in: NULL or 00190 &pars_consistent_token */ 00191 order_node_t* order_by); /* in: NULL or an order-by node */ 00192 /************************************************************************* 00193 Parses a column assignment in an update. */ 00194 00195 col_assign_node_t* 00196 pars_column_assignment( 00197 /*===================*/ 00198 /* out: column assignment node */ 00199 sym_node_t* column, /* in: column to assign */ 00200 que_node_t* exp); /* in: value to assign */ 00201 /************************************************************************* 00202 Parses a delete or update statement start. */ 00203 00204 upd_node_t* 00205 pars_update_statement_start( 00206 /*========================*/ 00207 /* out, own: update node in a query 00208 tree */ 00209 ibool is_delete, /* in: TRUE if delete */ 00210 sym_node_t* table_sym, /* in: table name node */ 00211 col_assign_node_t* col_assign_list);/* in: column assignment list, NULL 00212 if delete */ 00213 /************************************************************************* 00214 Parses an update or delete statement. */ 00215 00216 upd_node_t* 00217 pars_update_statement( 00218 /*==================*/ 00219 /* out, own: update node in a query 00220 tree */ 00221 upd_node_t* node, /* in: update node */ 00222 sym_node_t* cursor_sym, /* in: pointer to a cursor entry in 00223 the symbol table or NULL */ 00224 que_node_t* search_cond); /* in: search condition or NULL */ 00225 /************************************************************************* 00226 Parses an insert statement. */ 00227 00228 ins_node_t* 00229 pars_insert_statement( 00230 /*==================*/ 00231 /* out, own: update node in a query 00232 tree */ 00233 sym_node_t* table_sym, /* in: table name node */ 00234 que_node_t* values_list, /* in: value expression list or NULL */ 00235 sel_node_t* select); /* in: select condition or NULL */ 00236 /************************************************************************* 00237 Parses a procedure parameter declaration. */ 00238 00239 sym_node_t* 00240 pars_parameter_declaration( 00241 /*=======================*/ 00242 /* out, own: symbol table node of type 00243 SYM_VAR */ 00244 sym_node_t* node, /* in: symbol table node allocated for the 00245 id of the parameter */ 00246 ulint param_type, 00247 /* in: PARS_INPUT or PARS_OUTPUT */ 00248 pars_res_word_t* type); /* in: pointer to a type token */ 00249 /************************************************************************* 00250 Parses an elsif element. */ 00251 00252 elsif_node_t* 00253 pars_elsif_element( 00254 /*===============*/ 00255 /* out: elsif node */ 00256 que_node_t* cond, /* in: if-condition */ 00257 que_node_t* stat_list); /* in: statement list */ 00258 /************************************************************************* 00259 Parses an if-statement. */ 00260 00261 if_node_t* 00262 pars_if_statement( 00263 /*==============*/ 00264 /* out: if-statement node */ 00265 que_node_t* cond, /* in: if-condition */ 00266 que_node_t* stat_list, /* in: statement list */ 00267 que_node_t* else_part); /* in: else-part statement list */ 00268 /************************************************************************* 00269 Parses a for-loop-statement. */ 00270 00271 for_node_t* 00272 pars_for_statement( 00273 /*===============*/ 00274 /* out: for-statement node */ 00275 sym_node_t* loop_var, /* in: loop variable */ 00276 que_node_t* loop_start_limit,/* in: loop start expression */ 00277 que_node_t* loop_end_limit, /* in: loop end expression */ 00278 que_node_t* stat_list); /* in: statement list */ 00279 /************************************************************************* 00280 Parses a while-statement. */ 00281 00282 while_node_t* 00283 pars_while_statement( 00284 /*=================*/ 00285 /* out: while-statement node */ 00286 que_node_t* cond, /* in: while-condition */ 00287 que_node_t* stat_list); /* in: statement list */ 00288 /************************************************************************* 00289 Parses an exit statement. */ 00290 00291 exit_node_t* 00292 pars_exit_statement(void); 00293 /*=====================*/ 00294 /* out: exit statement node */ 00295 /************************************************************************* 00296 Parses a return-statement. */ 00297 00298 return_node_t* 00299 pars_return_statement(void); 00300 /*=======================*/ 00301 /* out: return-statement node */ 00302 /************************************************************************* 00303 Parses a procedure call. */ 00304 00305 func_node_t* 00306 pars_procedure_call( 00307 /*================*/ 00308 /* out: function node */ 00309 que_node_t* res_word,/* in: procedure name reserved word */ 00310 que_node_t* args); /* in: argument list */ 00311 /************************************************************************* 00312 Parses an assignment statement. */ 00313 00314 assign_node_t* 00315 pars_assignment_statement( 00316 /*======================*/ 00317 /* out: assignment statement node */ 00318 sym_node_t* var, /* in: variable to assign */ 00319 que_node_t* val); /* in: value to assign */ 00320 /************************************************************************* 00321 Parses a fetch statement. into_list or user_func (but not both) must be 00322 non-NULL. */ 00323 00324 fetch_node_t* 00325 pars_fetch_statement( 00326 /*=================*/ 00327 /* out: fetch statement node */ 00328 sym_node_t* cursor, /* in: cursor node */ 00329 sym_node_t* into_list, /* in: variables to set, or NULL */ 00330 sym_node_t* user_func); /* in: user function name, or NULL */ 00331 /************************************************************************* 00332 Parses an open or close cursor statement. */ 00333 00334 open_node_t* 00335 pars_open_statement( 00336 /*================*/ 00337 /* out: fetch statement node */ 00338 ulint type, /* in: ROW_SEL_OPEN_CURSOR 00339 or ROW_SEL_CLOSE_CURSOR */ 00340 sym_node_t* cursor); /* in: cursor node */ 00341 /************************************************************************* 00342 Parses a row_printf-statement. */ 00343 00344 row_printf_node_t* 00345 pars_row_printf_statement( 00346 /*======================*/ 00347 /* out: row_printf-statement node */ 00348 sel_node_t* sel_node); /* in: select node */ 00349 /************************************************************************* 00350 Parses a commit statement. */ 00351 00352 commit_node_t* 00353 pars_commit_statement(void); 00354 /*=======================*/ 00355 /************************************************************************* 00356 Parses a rollback statement. */ 00357 00358 roll_node_t* 00359 pars_rollback_statement(void); 00360 /*=========================*/ 00361 /************************************************************************* 00362 Parses a column definition at a table creation. */ 00363 00364 sym_node_t* 00365 pars_column_def( 00366 /*============*/ 00367 /* out: column sym table 00368 node */ 00369 sym_node_t* sym_node, /* in: column node in the 00370 symbol table */ 00371 pars_res_word_t* type, /* in: data type */ 00372 sym_node_t* len, /* in: length of column, or 00373 NULL */ 00374 void* is_unsigned, /* in: if not NULL, column 00375 is of type UNSIGNED. */ 00376 void* is_not_null); /* in: if not NULL, column 00377 is of type NOT NULL. */ 00378 /************************************************************************* 00379 Parses a table creation operation. */ 00380 00381 tab_node_t* 00382 pars_create_table( 00383 /*==============*/ 00384 /* out: table create subgraph */ 00385 sym_node_t* table_sym, /* in: table name node in the symbol 00386 table */ 00387 sym_node_t* column_defs, /* in: list of column names */ 00388 void* not_fit_in_memory);/* in: a non-NULL pointer means that 00389 this is a table which in simulations 00390 should be simulated as not fitting 00391 in memory; thread is put to sleep 00392 to simulate disk accesses; NOTE that 00393 this flag is not stored to the data 00394 dictionary on disk, and the database 00395 will forget about non-NULL value if 00396 it has to reload the table definition 00397 from disk */ 00398 /************************************************************************* 00399 Parses an index creation operation. */ 00400 00401 ind_node_t* 00402 pars_create_index( 00403 /*==============*/ 00404 /* out: index create subgraph */ 00405 pars_res_word_t* unique_def, /* in: not NULL if a unique index */ 00406 pars_res_word_t* clustered_def, /* in: not NULL if a clustered index */ 00407 sym_node_t* index_sym, /* in: index name node in the symbol 00408 table */ 00409 sym_node_t* table_sym, /* in: table name node in the symbol 00410 table */ 00411 sym_node_t* column_list); /* in: list of column names */ 00412 /************************************************************************* 00413 Parses a procedure definition. */ 00414 00415 que_fork_t* 00416 pars_procedure_definition( 00417 /*======================*/ 00418 /* out: query fork node */ 00419 sym_node_t* sym_node, /* in: procedure id node in the symbol 00420 table */ 00421 sym_node_t* param_list, /* in: parameter declaration list */ 00422 que_node_t* stat_list); /* in: statement list */ 00423 00424 /***************************************************************** 00425 Parses a stored procedure call, when this is not within another stored 00426 procedure, that is, the client issues a procedure call directly. 00427 In MySQL/InnoDB, stored InnoDB procedures are invoked via the 00428 parsed procedure tree, not via InnoDB SQL, so this function is not used. */ 00429 00430 que_fork_t* 00431 pars_stored_procedure_call( 00432 /*=======================*/ 00433 /* out: query graph */ 00434 sym_node_t* sym_node); /* in: stored procedure name */ 00435 /********************************************************************** 00436 Completes a query graph by adding query thread and fork nodes 00437 above it and prepares the graph for running. The fork created is of 00438 type QUE_FORK_MYSQL_INTERFACE. */ 00439 00440 que_thr_t* 00441 pars_complete_graph_for_exec( 00442 /*=========================*/ 00443 /* out: query thread node to run */ 00444 que_node_t* node, /* in: root node for an incomplete 00445 query graph */ 00446 trx_t* trx, /* in: transaction handle */ 00447 mem_heap_t* heap); /* in: memory heap from which allocated */ 00448 00449 /******************************************************************** 00450 Create parser info struct.*/ 00451 00452 pars_info_t* 00453 pars_info_create(void); 00454 /*==================*/ 00455 /* out, own: info struct */ 00456 00457 /******************************************************************** 00458 Free info struct and everything it contains.*/ 00459 00460 void 00461 pars_info_free( 00462 /*===========*/ 00463 pars_info_t* info); /* in: info struct */ 00464 00465 /******************************************************************** 00466 Add bound literal. */ 00467 00468 void 00469 pars_info_add_literal( 00470 /*==================*/ 00471 pars_info_t* info, /* in: info struct */ 00472 const char* name, /* in: name */ 00473 const void* address, /* in: address */ 00474 ulint length, /* in: length of data */ 00475 ulint type, /* in: type, e.g. DATA_FIXBINARY */ 00476 ulint prtype); /* in: precise type, e.g. 00477 DATA_UNSIGNED */ 00478 00479 /******************************************************************** 00480 Equivalent to pars_info_add_literal(info, name, str, strlen(str), 00481 DATA_VARCHAR, DATA_ENGLISH). */ 00482 00483 void 00484 pars_info_add_str_literal( 00485 /*======================*/ 00486 pars_info_t* info, /* in: info struct */ 00487 const char* name, /* in: name */ 00488 const char* str); /* in: string */ 00489 00490 /******************************************************************** 00491 Equivalent to: 00492 00493 char buf[4]; 00494 mach_write_to_4(buf, val); 00495 pars_info_add_literal(info, name, buf, 4, DATA_INT, 0); 00496 00497 except that the buffer is dynamically allocated from the info struct's 00498 heap. */ 00499 00500 void 00501 pars_info_add_int4_literal( 00502 /*=======================*/ 00503 pars_info_t* info, /* in: info struct */ 00504 const char* name, /* in: name */ 00505 lint val); /* in: value */ 00506 00507 /******************************************************************** 00508 Equivalent to: 00509 00510 char buf[8]; 00511 mach_write_to_8(buf, val); 00512 pars_info_add_literal(info, name, buf, 8, DATA_BINARY, 0); 00513 00514 except that the buffer is dynamically allocated from the info struct's 00515 heap. */ 00516 00517 void 00518 pars_info_add_dulint_literal( 00519 /*=========================*/ 00520 pars_info_t* info, /* in: info struct */ 00521 const char* name, /* in: name */ 00522 dulint val); /* in: value */ 00523 /******************************************************************** 00524 Add user function. */ 00525 00526 void 00527 pars_info_add_function( 00528 /*===================*/ 00529 pars_info_t* info, /* in: info struct */ 00530 const char* name, /* in: function name */ 00531 pars_user_func_cb_t func, /* in: function address */ 00532 void* arg); /* in: user-supplied argument */ 00533 00534 /******************************************************************** 00535 Add bound id. */ 00536 00537 void 00538 pars_info_add_id( 00539 /*=============*/ 00540 pars_info_t* info, /* in: info struct */ 00541 const char* name, /* in: name */ 00542 const char* id); /* in: id */ 00543 00544 /******************************************************************** 00545 Get user function with the given name.*/ 00546 00547 pars_user_func_t* 00548 pars_info_get_user_func( 00549 /*====================*/ 00550 /* out: user func, or NULL if not 00551 found */ 00552 pars_info_t* info, /* in: info struct */ 00553 const char* name); /* in: function name to find*/ 00554 00555 /******************************************************************** 00556 Get bound literal with the given name.*/ 00557 00558 pars_bound_lit_t* 00559 pars_info_get_bound_lit( 00560 /*====================*/ 00561 /* out: bound literal, or NULL if 00562 not found */ 00563 pars_info_t* info, /* in: info struct */ 00564 const char* name); /* in: bound literal name to find */ 00565 00566 /******************************************************************** 00567 Get bound id with the given name.*/ 00568 00569 pars_bound_id_t* 00570 pars_info_get_bound_id( 00571 /*===================*/ 00572 /* out: bound id, or NULL if not 00573 found */ 00574 pars_info_t* info, /* in: info struct */ 00575 const char* name); /* in: bound id name to find */ 00576 00577 00578 /* Extra information supplied for pars_sql(). */ 00579 struct pars_info_struct { 00580 mem_heap_t* heap; /* our own memory heap */ 00581 00582 ib_vector_t* funcs; /* user functions, or NUll 00583 (pars_user_func_t*) */ 00584 ib_vector_t* bound_lits; /* bound literals, or NULL 00585 (pars_bound_lit_t*) */ 00586 ib_vector_t* bound_ids; /* bound ids, or NULL 00587 (pars_bound_id_t*) */ 00588 00589 ibool graph_owns_us; /* if TRUE (which is the default), 00590 que_graph_free() will free us */ 00591 }; 00592 00593 /* User-supplied function and argument. */ 00594 struct pars_user_func_struct { 00595 const char* name; /* function name */ 00596 pars_user_func_cb_t func; /* function address */ 00597 void* arg; /* user-supplied argument */ 00598 }; 00599 00600 /* Bound literal. */ 00601 struct pars_bound_lit_struct { 00602 const char* name; /* name */ 00603 const void* address; /* address */ 00604 ulint length; /* length of data */ 00605 ulint type; /* type, e.g. DATA_FIXBINARY */ 00606 ulint prtype; /* precise type, e.g. DATA_UNSIGNED */ 00607 }; 00608 00609 /* Bound id. */ 00610 struct pars_bound_id_struct { 00611 const char* name; /* name */ 00612 const char* id; /* id */ 00613 }; 00614 00615 /* Struct used to denote a reserved word in a parsing tree */ 00616 struct pars_res_word_struct{ 00617 int code; /* the token code for the reserved word from 00618 pars0grm.h */ 00619 }; 00620 00621 /* A predefined function or operator node in a parsing tree; this construct 00622 is also used for some non-functions like the assignment ':=' */ 00623 struct func_node_struct{ 00624 que_common_t common; /* type: QUE_NODE_FUNC */ 00625 int func; /* token code of the function name */ 00626 ulint class; /* class of the function */ 00627 que_node_t* args; /* argument(s) of the function */ 00628 UT_LIST_NODE_T(func_node_t) cond_list; 00629 /* list of comparison conditions; defined 00630 only for comparison operator nodes except, 00631 presently, for OPT_SCROLL_TYPE ones */ 00632 UT_LIST_NODE_T(func_node_t) func_node_list; 00633 /* list of function nodes in a parsed 00634 query graph */ 00635 }; 00636 00637 /* An order-by node in a select */ 00638 struct order_node_struct{ 00639 que_common_t common; /* type: QUE_NODE_ORDER */ 00640 sym_node_t* column; /* order-by column */ 00641 ibool asc; /* TRUE if ascending, FALSE if descending */ 00642 }; 00643 00644 /* Procedure definition node */ 00645 struct proc_node_struct{ 00646 que_common_t common; /* type: QUE_NODE_PROC */ 00647 sym_node_t* proc_id; /* procedure name symbol in the symbol 00648 table of this same procedure */ 00649 sym_node_t* param_list; /* input and output parameters */ 00650 que_node_t* stat_list; /* statement list */ 00651 sym_tab_t* sym_tab; /* symbol table of this procedure */ 00652 }; 00653 00654 /* elsif-element node */ 00655 struct elsif_node_struct{ 00656 que_common_t common; /* type: QUE_NODE_ELSIF */ 00657 que_node_t* cond; /* if condition */ 00658 que_node_t* stat_list; /* statement list */ 00659 }; 00660 00661 /* if-statement node */ 00662 struct if_node_struct{ 00663 que_common_t common; /* type: QUE_NODE_IF */ 00664 que_node_t* cond; /* if condition */ 00665 que_node_t* stat_list; /* statement list */ 00666 que_node_t* else_part; /* else-part statement list */ 00667 elsif_node_t* elsif_list; /* elsif element list */ 00668 }; 00669 00670 /* while-statement node */ 00671 struct while_node_struct{ 00672 que_common_t common; /* type: QUE_NODE_WHILE */ 00673 que_node_t* cond; /* while condition */ 00674 que_node_t* stat_list; /* statement list */ 00675 }; 00676 00677 /* for-loop-statement node */ 00678 struct for_node_struct{ 00679 que_common_t common; /* type: QUE_NODE_FOR */ 00680 sym_node_t* loop_var; /* loop variable: this is the 00681 dereferenced symbol from the 00682 variable declarations, not the 00683 symbol occurrence in the for loop 00684 definition */ 00685 que_node_t* loop_start_limit;/* initial value of loop variable */ 00686 que_node_t* loop_end_limit; /* end value of loop variable */ 00687 int loop_end_value; /* evaluated value for the end value: 00688 it is calculated only when the loop 00689 is entered, and will not change within 00690 the loop */ 00691 que_node_t* stat_list; /* statement list */ 00692 }; 00693 00694 /* exit statement node */ 00695 struct exit_node_struct{ 00696 que_common_t common; /* type: QUE_NODE_EXIT */ 00697 }; 00698 00699 /* return-statement node */ 00700 struct return_node_struct{ 00701 que_common_t common; /* type: QUE_NODE_RETURN */ 00702 }; 00703 00704 /* Assignment statement node */ 00705 struct assign_node_struct{ 00706 que_common_t common; /* type: QUE_NODE_ASSIGNMENT */ 00707 sym_node_t* var; /* variable to set */ 00708 que_node_t* val; /* value to assign */ 00709 }; 00710 00711 /* Column assignment node */ 00712 struct col_assign_node_struct{ 00713 que_common_t common; /* type: QUE_NODE_COL_ASSIGN */ 00714 sym_node_t* col; /* column to set */ 00715 que_node_t* val; /* value to assign */ 00716 }; 00717 00718 /* Classes of functions */ 00719 #define PARS_FUNC_ARITH 1 /* +, -, *, / */ 00720 #define PARS_FUNC_LOGICAL 2 00721 #define PARS_FUNC_CMP 3 00722 #define PARS_FUNC_PREDEFINED 4 /* TO_NUMBER, SUBSTR, ... */ 00723 #define PARS_FUNC_AGGREGATE 5 /* COUNT, DISTINCT, SUM */ 00724 #define PARS_FUNC_OTHER 6 /* these are not real functions, 00725 e.g., := */ 00726 00727 #ifndef UNIV_NONINL 00728 #include "pars0pars.ic" 00729 #endif 00730 00731 #endif
1.4.7

