#include "pars0pars.h"#include "row0sel.h"#include "row0ins.h"#include "row0upd.h"#include "dict0dict.h"#include "dict0mem.h"#include "dict0crea.h"#include "que0que.h"#include "pars0grm.h"#include "pars0opt.h"#include "data0data.h"#include "data0type.h"#include "trx0trx.h"#include "trx0roll.h"#include "lock0lock.h"#include "eval0eval.h"Include dependency graph for pars0pars.c:

Go to the source code of this file.
| #define PARS_STAR_DENOTER 12345678 |
Definition at line 80 of file pars0pars.c.
| assign_node_t* pars_assignment_statement | ( | sym_node_t * | var, | |
| que_node_t * | val | |||
| ) |
Definition at line 1395 of file pars0pars.c.
References assign_node_struct::common, dfield_get_type(), dtype_get_mtype(), sym_tab_struct::heap, mem_heap_alloc(), NULL, pars_resolve_exp_variables_and_types(), pars_sym_tab_global, QUE_NODE_ASSIGNMENT, que_node_get_val(), que_common_struct::type, ut_a, assign_node_struct::val, and assign_node_struct::var.
Referenced by yyparse().
01397 : assignment statement node */ 01398 sym_node_t* var, /* in: variable to assign */ 01399 que_node_t* val) /* in: value to assign */ 01400 { 01401 assign_node_t* node; 01402 01403 node = mem_heap_alloc(pars_sym_tab_global->heap, 01404 sizeof(assign_node_t)); 01405 node->common.type = QUE_NODE_ASSIGNMENT; 01406 01407 node->var = var; 01408 node->val = val; 01409 01410 pars_resolve_exp_variables_and_types(NULL, var); 01411 pars_resolve_exp_variables_and_types(NULL, val); 01412 01413 ut_a(dtype_get_mtype(dfield_get_type(que_node_get_val(var))) 01414 == dtype_get_mtype(dfield_get_type(que_node_get_val(val)))); 01415 01416 return(node); 01417 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_check_aggregate | ( | sel_node_t * | select_node | ) | [static] |
Definition at line 651 of file pars0pars.c.
References func_node_struct::class, FALSE, sel_node_struct::is_aggregate, PARS_FUNC_AGGREGATE, QUE_NODE_FUNC, que_node_get_next(), que_node_get_type(), sel_node_struct::select_list, TRUE, and ut_a.
Referenced by pars_select_statement().
00653 : select node already containing 00654 the select list */ 00655 { 00656 que_node_t* exp_node; 00657 func_node_t* func_node; 00658 ulint n_nodes = 0; 00659 ulint n_aggregate_nodes = 0; 00660 00661 exp_node = select_node->select_list; 00662 00663 while (exp_node) { 00664 00665 n_nodes++; 00666 00667 if (que_node_get_type(exp_node) == QUE_NODE_FUNC) { 00668 00669 func_node = exp_node; 00670 00671 if (func_node->class == PARS_FUNC_AGGREGATE) { 00672 00673 n_aggregate_nodes++; 00674 } 00675 } 00676 00677 exp_node = que_node_get_next(exp_node); 00678 } 00679 00680 if (n_aggregate_nodes > 0) { 00681 ut_a(n_nodes == n_aggregate_nodes); 00682 00683 select_node->is_aggregate = TRUE; 00684 } else { 00685 select_node->is_aggregate = FALSE; 00686 } 00687 }
Here is the call graph for this function:

Here is the caller graph for this function:

| col_assign_node_t* pars_column_assignment | ( | sym_node_t * | column, | |
| que_node_t * | exp | |||
| ) |
Definition at line 843 of file pars0pars.c.
References col_assign_node_struct::col, col_assign_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_sym_tab_global, QUE_NODE_COL_ASSIGNMENT, que_common_struct::type, and col_assign_node_struct::val.
Referenced by yyparse().
00845 : column assignment node */ 00846 sym_node_t* column, /* in: column to assign */ 00847 que_node_t* exp) /* in: value to assign */ 00848 { 00849 col_assign_node_t* node; 00850 00851 node = mem_heap_alloc(pars_sym_tab_global->heap, 00852 sizeof(col_assign_node_t)); 00853 node->common.type = QUE_NODE_COL_ASSIGNMENT; 00854 00855 node->col = column; 00856 node->val = exp; 00857 00858 return(node); 00859 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sym_node_t* pars_column_def | ( | sym_node_t * | sym_node, | |
| pars_res_word_t * | type, | |||
| sym_node_t * | len, | |||
| void * | is_unsigned, | |||
| void * | is_not_null | |||
| ) |
Definition at line 1567 of file pars0pars.c.
References eval_node_get_int_val(), NULL, pars_set_dfield_type(), and que_node_get_val().
Referenced by yyparse().
01569 : column sym table 01570 node */ 01571 sym_node_t* sym_node, /* in: column node in the 01572 symbol table */ 01573 pars_res_word_t* type, /* in: data type */ 01574 sym_node_t* len, /* in: length of column, or 01575 NULL */ 01576 void* is_unsigned, /* in: if not NULL, column 01577 is of type UNSIGNED. */ 01578 void* is_not_null) /* in: if not NULL, column 01579 is of type NOT NULL. */ 01580 { 01581 ulint len2; 01582 01583 if (len) { 01584 len2 = eval_node_get_int_val(len); 01585 } else { 01586 len2 = 0; 01587 } 01588 01589 pars_set_dfield_type(que_node_get_val(sym_node), type, len2, 01590 is_unsigned != NULL, is_not_null != NULL); 01591 01592 return(sym_node); 01593 }
Here is the call graph for this function:

Here is the caller graph for this function:

| commit_node_t* pars_commit_statement | ( | void | ) |
Definition at line 1547 of file pars0pars.c.
References commit_node_create(), sym_tab_struct::heap, and pars_sym_tab_global.
Referenced by yyparse().
01549 { 01550 return(commit_node_create(pars_sym_tab_global->heap)); 01551 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_thr_t* pars_complete_graph_for_exec | ( | que_node_t * | node, | |
| trx_t * | trx, | |||
| mem_heap_t * | heap | |||
| ) |
Definition at line 1896 of file pars0pars.c.
References que_thr_struct::child, trx_struct::graph, NULL, que_fork_create(), QUE_FORK_MYSQL_INTERFACE, que_node_set_parent(), que_thr_create(), and que_fork_struct::trx.
Referenced by row_create_index_for_mysql(), row_create_table_for_mysql(), row_get_prebuilt_insert_row(), row_get_prebuilt_update_vector(), row_prebuild_sel_graph(), and trx_general_rollback_for_mysql().
01898 : query thread node to run */ 01899 que_node_t* node, /* in: root node for an incomplete 01900 query graph */ 01901 trx_t* trx, /* in: transaction handle */ 01902 mem_heap_t* heap) /* in: memory heap from which allocated */ 01903 { 01904 que_fork_t* fork; 01905 que_thr_t* thr; 01906 01907 fork = que_fork_create(NULL, NULL, QUE_FORK_MYSQL_INTERFACE, heap); 01908 fork->trx = trx; 01909 01910 thr = que_thr_create(fork, heap); 01911 01912 thr->child = node; 01913 01914 que_node_set_parent(node, thr); 01915 01916 trx->graph = NULL; 01917 01918 return(thr); 01919 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ind_node_t* pars_create_index | ( | pars_res_word_t * | unique_def, | |
| pars_res_word_t * | clustered_def, | |||
| sym_node_t * | index_sym, | |||
| sym_node_t * | table_sym, | |||
| sym_node_t * | column_list | |||
| ) |
Definition at line 1659 of file pars0pars.c.
References DICT_CLUSTERED, dict_mem_index_add_field(), dict_mem_index_create(), DICT_UNIQUE, sym_tab_struct::heap, ind_create_graph_create(), index(), sym_node_struct::name, pars_sym_tab_global, que_node_get_next(), que_node_list_get_len(), sym_node_struct::resolved, SYM_COLUMN, SYM_TABLE, sym_node_struct::token_type, and TRUE.
Referenced by yyparse().
01661 : index create subgraph */ 01662 pars_res_word_t* unique_def, /* in: not NULL if a unique index */ 01663 pars_res_word_t* clustered_def, /* in: not NULL if a clustered index */ 01664 sym_node_t* index_sym, /* in: index name node in the symbol 01665 table */ 01666 sym_node_t* table_sym, /* in: table name node in the symbol 01667 table */ 01668 sym_node_t* column_list) /* in: list of column names */ 01669 { 01670 dict_index_t* index; 01671 sym_node_t* column; 01672 ind_node_t* node; 01673 ulint n_fields; 01674 ulint ind_type; 01675 01676 n_fields = que_node_list_get_len(column_list); 01677 01678 ind_type = 0; 01679 01680 if (unique_def) { 01681 ind_type = ind_type | DICT_UNIQUE; 01682 } 01683 01684 if (clustered_def) { 01685 ind_type = ind_type | DICT_CLUSTERED; 01686 } 01687 01688 index = dict_mem_index_create(table_sym->name, index_sym->name, 0, 01689 ind_type, n_fields); 01690 column = column_list; 01691 01692 while (column) { 01693 dict_mem_index_add_field(index, column->name, 0); 01694 01695 column->resolved = TRUE; 01696 column->token_type = SYM_COLUMN; 01697 01698 column = que_node_get_next(column); 01699 } 01700 01701 node = ind_create_graph_create(index, pars_sym_tab_global->heap); 01702 01703 table_sym->resolved = TRUE; 01704 table_sym->token_type = SYM_TABLE; 01705 01706 index_sym->resolved = TRUE; 01707 index_sym->token_type = SYM_TABLE; 01708 01709 return(node); 01710 }
Here is the call graph for this function:

Here is the caller graph for this function:

| tab_node_t* pars_create_table | ( | sym_node_t * | table_sym, | |
| sym_node_t * | column_defs, | |||
| void * | not_fit_in_memory | |||
| ) |
Definition at line 1599 of file pars0pars.c.
References dfield_get_type(), dict_mem_table_add_col(), dict_mem_table_create(), dict_table_struct::does_not_fit_in_memory, sym_tab_struct::heap, dtype_struct::len, dtype_struct::mtype, sym_node_struct::name, NULL, pars_sym_tab_global, dtype_struct::prec, dtype_struct::prtype, que_node_get_next(), que_node_get_val(), que_node_list_get_len(), sym_node_struct::resolved, SYM_COLUMN, SYM_TABLE, tab_create_graph_create(), sym_node_struct::token_type, and TRUE.
Referenced by yyparse().
01601 : table create subgraph */ 01602 sym_node_t* table_sym, /* in: table name node in the symbol 01603 table */ 01604 sym_node_t* column_defs, /* in: list of column names */ 01605 void* not_fit_in_memory)/* in: a non-NULL pointer means that 01606 this is a table which in simulations 01607 should be simulated as not fitting 01608 in memory; thread is put to sleep 01609 to simulate disk accesses; NOTE that 01610 this flag is not stored to the data 01611 dictionary on disk, and the database 01612 will forget about non-NULL value if 01613 it has to reload the table definition 01614 from disk */ 01615 { 01616 dict_table_t* table; 01617 sym_node_t* column; 01618 tab_node_t* node; 01619 dtype_t* dtype; 01620 ulint n_cols; 01621 01622 n_cols = que_node_list_get_len(column_defs); 01623 01624 /* As the InnoDB SQL parser is for internal use only, 01625 for creating some system tables, this function will only 01626 create tables in the old (not compact) record format. */ 01627 table = dict_mem_table_create(table_sym->name, 0, n_cols, 0); 01628 01629 if (not_fit_in_memory != NULL) { 01630 table->does_not_fit_in_memory = TRUE; 01631 } 01632 01633 column = column_defs; 01634 01635 while (column) { 01636 dtype = dfield_get_type(que_node_get_val(column)); 01637 01638 dict_mem_table_add_col(table, column->name, dtype->mtype, 01639 dtype->prtype, dtype->len, 01640 dtype->prec); 01641 column->resolved = TRUE; 01642 column->token_type = SYM_COLUMN; 01643 01644 column = que_node_get_next(column); 01645 } 01646 01647 node = tab_create_graph_create(table, pars_sym_tab_global->heap); 01648 01649 table_sym->resolved = TRUE; 01650 table_sym->token_type = SYM_TABLE; 01651 01652 return(node); 01653 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_node_t* pars_cursor_declaration | ( | sym_node_t * | sym_node, | |
| sel_node_t * | select_node | |||
| ) |
Definition at line 777 of file pars0pars.c.
References sym_node_struct::cursor_def, sel_node_struct::explicit_cursor, sym_node_struct::resolved, SEL_NODE_CLOSED, sel_node_struct::state, SYM_CURSOR, sym_node_struct::token_type, and TRUE.
Referenced by yyparse().
00779 : sym_node */ 00780 sym_node_t* sym_node, /* in: cursor id node in the symbol 00781 table */ 00782 sel_node_t* select_node) /* in: select node */ 00783 { 00784 sym_node->resolved = TRUE; 00785 sym_node->token_type = SYM_CURSOR; 00786 sym_node->cursor_def = select_node; 00787 00788 select_node->state = SEL_NODE_CLOSED; 00789 select_node->explicit_cursor = sym_node; 00790 00791 return(sym_node); 00792 }
Here is the caller graph for this function:

| elsif_node_t* pars_elsif_element | ( | que_node_t * | cond, | |
| que_node_t * | stat_list | |||
| ) |
Definition at line 1223 of file pars0pars.c.
References elsif_node_struct::common, elsif_node_struct::cond, sym_tab_struct::heap, mem_heap_alloc(), NULL, pars_resolve_exp_variables_and_types(), pars_sym_tab_global, QUE_NODE_ELSIF, elsif_node_struct::stat_list, and que_common_struct::type.
Referenced by yyparse().
01225 : elsif node */ 01226 que_node_t* cond, /* in: if-condition */ 01227 que_node_t* stat_list) /* in: statement list */ 01228 { 01229 elsif_node_t* node; 01230 01231 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(elsif_node_t)); 01232 01233 node->common.type = QUE_NODE_ELSIF; 01234 01235 node->cond = cond; 01236 01237 pars_resolve_exp_variables_and_types(NULL, cond); 01238 01239 node->stat_list = stat_list; 01240 01241 return(node); 01242 }
Here is the call graph for this function:

Here is the caller graph for this function:

| exit_node_t* pars_exit_statement | ( | void | ) |
Definition at line 1362 of file pars0pars.c.
References exit_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_sym_tab_global, QUE_NODE_EXIT, and que_common_struct::type.
Referenced by yyparse().
01364 : exit statement node */ 01365 { 01366 exit_node_t* node; 01367 01368 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(exit_node_t)); 01369 node->common.type = QUE_NODE_EXIT; 01370 01371 return(node); 01372 }
Here is the call graph for this function:

Here is the caller graph for this function:

| fetch_node_t* pars_fetch_statement | ( | sym_node_t * | cursor, | |
| sym_node_t * | into_list, | |||
| sym_node_t * | user_func | |||
| ) |
Definition at line 1443 of file pars0pars.c.
References sym_node_struct::alias, fetch_node_struct::common, sym_node_struct::cursor_def, fetch_node_struct::cursor_def, fetch_node_struct::func, sym_tab_struct::heap, sym_tab_struct::info, fetch_node_struct::into_list, mem_heap_alloc(), sym_node_struct::name, NULL, pars_info_get_user_func(), pars_resolve_exp_list_variables_and_types(), pars_resolve_exp_variables_and_types(), pars_sym_tab_global, QUE_NODE_FETCH, que_node_list_get_len(), sel_node_struct::select_list, SYM_CURSOR, sym_node_struct::token_type, que_common_struct::type, and ut_a.
Referenced by yyparse().
01445 : fetch statement node */ 01446 sym_node_t* cursor, /* in: cursor node */ 01447 sym_node_t* into_list, /* in: variables to set, or NULL */ 01448 sym_node_t* user_func) /* in: user function name, or NULL */ 01449 { 01450 sym_node_t* cursor_decl; 01451 fetch_node_t* node; 01452 01453 /* Logical XOR. */ 01454 ut_a(!into_list != !user_func); 01455 01456 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t)); 01457 01458 node->common.type = QUE_NODE_FETCH; 01459 01460 pars_resolve_exp_variables_and_types(NULL, cursor); 01461 01462 if (into_list) { 01463 pars_resolve_exp_list_variables_and_types(NULL, into_list); 01464 node->into_list = into_list; 01465 node->func = NULL; 01466 } else { 01467 pars_resolve_exp_variables_and_types(NULL, user_func); 01468 01469 node->func = pars_info_get_user_func(pars_sym_tab_global->info, 01470 user_func->name); 01471 ut_a(node->func); 01472 01473 node->into_list = NULL; 01474 } 01475 01476 cursor_decl = cursor->alias; 01477 01478 ut_a(cursor_decl->token_type == SYM_CURSOR); 01479 01480 node->cursor_def = cursor_decl->cursor_def; 01481 01482 if (into_list) { 01483 ut_a(que_node_list_get_len(into_list) 01484 == que_node_list_get_len( 01485 node->cursor_def->select_list)); 01486 } 01487 01488 return(node); 01489 }
Here is the call graph for this function:

Here is the caller graph for this function:

| for_node_t* pars_for_statement | ( | sym_node_t * | loop_var, | |
| que_node_t * | loop_start_limit, | |||
| que_node_t * | loop_end_limit, | |||
| que_node_t * | stat_list | |||
| ) |
Definition at line 1326 of file pars0pars.c.
References for_node_struct::common, sym_tab_struct::heap, sym_node_struct::indirection, for_node_struct::loop_end_limit, for_node_struct::loop_start_limit, for_node_struct::loop_var, mem_heap_alloc(), NULL, pars_resolve_exp_variables_and_types(), pars_set_parent_in_list(), pars_sym_tab_global, QUE_NODE_FOR, for_node_struct::stat_list, que_common_struct::type, and ut_a.
Referenced by yyparse().
01328 : for-statement node */ 01329 sym_node_t* loop_var, /* in: loop variable */ 01330 que_node_t* loop_start_limit,/* in: loop start expression */ 01331 que_node_t* loop_end_limit, /* in: loop end expression */ 01332 que_node_t* stat_list) /* in: statement list */ 01333 { 01334 for_node_t* node; 01335 01336 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(for_node_t)); 01337 01338 node->common.type = QUE_NODE_FOR; 01339 01340 pars_resolve_exp_variables_and_types(NULL, loop_var); 01341 pars_resolve_exp_variables_and_types(NULL, loop_start_limit); 01342 pars_resolve_exp_variables_and_types(NULL, loop_end_limit); 01343 01344 node->loop_var = loop_var->indirection; 01345 01346 ut_a(loop_var->indirection); 01347 01348 node->loop_start_limit = loop_start_limit; 01349 node->loop_end_limit = loop_end_limit; 01350 01351 node->stat_list = stat_list; 01352 01353 pars_set_parent_in_list(stat_list, node); 01354 01355 return(node); 01356 }
Here is the call graph for this function:

Here is the caller graph for this function:

| func_node_t* pars_func | ( | que_node_t * | res_word, | |
| que_node_t * | arg | |||
| ) |
Definition at line 167 of file pars0pars.c.
References pars_func_low().
Referenced by pars_procedure_call(), and yyparse().
00169 : function node in a query tree */ 00170 que_node_t* res_word,/* in: function name reserved word */ 00171 que_node_t* arg) /* in: first argument in the argument list */ 00172 { 00173 return(pars_func_low(((pars_res_word_t*)res_word)->code, arg)); 00174 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static ulint pars_func_get_class | ( | int | func | ) | [static] |
Definition at line 88 of file pars0pars.c.
References PARS_AND_TOKEN, PARS_ASSERT_TOKEN, PARS_BINARY_TO_NUMBER_TOKEN, PARS_CONCAT_TOKEN, PARS_COUNT_TOKEN, PARS_FUNC_AGGREGATE, PARS_FUNC_ARITH, PARS_FUNC_CMP, PARS_FUNC_LOGICAL, PARS_FUNC_OTHER, PARS_FUNC_PREDEFINED, PARS_GE_TOKEN, PARS_INSTR_TOKEN, PARS_LE_TOKEN, PARS_LENGTH_TOKEN, PARS_NE_TOKEN, PARS_NOT_TOKEN, PARS_NOTFOUND_TOKEN, PARS_OR_TOKEN, PARS_PRINTF_TOKEN, PARS_REPLSTR_TOKEN, PARS_RND_STR_TOKEN, PARS_RND_TOKEN, PARS_SUBSTR_TOKEN, PARS_SUM_TOKEN, PARS_SYSDATE_TOKEN, PARS_TO_BINARY_TOKEN, PARS_TO_CHAR_TOKEN, and PARS_TO_NUMBER_TOKEN.
Referenced by pars_func_low().
00090 : function class: PARS_FUNC_ARITH, ... */ 00091 int func) /* in: function code: '=', PARS_GE_TOKEN, ... */ 00092 { 00093 if ((func == '+') || (func == '-') || (func == '*') || (func == '/')) { 00094 00095 return(PARS_FUNC_ARITH); 00096 00097 } else if ((func == '=') || (func == '<') || (func == '>') 00098 || (func == PARS_GE_TOKEN) || (func == PARS_LE_TOKEN) 00099 || (func == PARS_NE_TOKEN)) { 00100 00101 return(PARS_FUNC_CMP); 00102 00103 } else if ((func == PARS_AND_TOKEN) || (func == PARS_OR_TOKEN) 00104 || (func == PARS_NOT_TOKEN)) { 00105 00106 return(PARS_FUNC_LOGICAL); 00107 00108 } else if ((func == PARS_COUNT_TOKEN) || (func == PARS_SUM_TOKEN)) { 00109 00110 return(PARS_FUNC_AGGREGATE); 00111 00112 } else if ((func == PARS_TO_CHAR_TOKEN) 00113 || (func == PARS_TO_NUMBER_TOKEN) 00114 || (func == PARS_TO_BINARY_TOKEN) 00115 || (func == PARS_BINARY_TO_NUMBER_TOKEN) 00116 || (func == PARS_SUBSTR_TOKEN) 00117 || (func == PARS_CONCAT_TOKEN) 00118 || (func == PARS_LENGTH_TOKEN) 00119 || (func == PARS_INSTR_TOKEN) 00120 || (func == PARS_SYSDATE_TOKEN) 00121 || (func == PARS_NOTFOUND_TOKEN) 00122 || (func == PARS_PRINTF_TOKEN) 00123 || (func == PARS_ASSERT_TOKEN) 00124 || (func == PARS_RND_TOKEN) 00125 || (func == PARS_RND_STR_TOKEN) 00126 || (func == PARS_REPLSTR_TOKEN)) { 00127 00128 return(PARS_FUNC_PREDEFINED); 00129 } else { 00130 return(PARS_FUNC_OTHER); 00131 } 00132 }
Here is the caller graph for this function:

| static func_node_t* pars_func_low | ( | int | func, | |
| que_node_t * | arg | |||
| ) | [static] |
Definition at line 138 of file pars0pars.c.
References func_node_struct::args, func_node_struct::class, func_node_struct::common, dfield_set_data(), func_node_struct::func, sym_tab_struct::func_node_list, sym_tab_struct::heap, mem_heap_alloc(), NULL, pars_func_get_class(), pars_sym_tab_global, QUE_NODE_FUNC, que_common_struct::type, UT_LIST_ADD_LAST, que_common_struct::val, and que_common_struct::val_buf_size.
Referenced by pars_func(), and pars_op().
00140 : function node in a query tree */ 00141 int func, /* in: function token code */ 00142 que_node_t* arg) /* in: first argument in the argument list */ 00143 { 00144 func_node_t* node; 00145 00146 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(func_node_t)); 00147 00148 node->common.type = QUE_NODE_FUNC; 00149 dfield_set_data(&(node->common.val), NULL, 0); 00150 node->common.val_buf_size = 0; 00151 00152 node->func = func; 00153 00154 node->class = pars_func_get_class(func); 00155 00156 node->args = arg; 00157 00158 UT_LIST_ADD_LAST(func_node_list, pars_sym_tab_global->func_node_list, 00159 node); 00160 return(node); 00161 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_node_t* pars_function_declaration | ( | sym_node_t * | sym_node | ) |
Definition at line 798 of file pars0pars.c.
References sym_tab_struct::info, sym_node_struct::name, pars_info_get_user_func(), pars_sym_tab_global, sym_node_struct::resolved, SYM_FUNCTION, sym_node_struct::token_type, TRUE, and ut_a.
Referenced by yyparse().
00800 : sym_node */ 00801 sym_node_t* sym_node) /* in: function id node in the symbol 00802 table */ 00803 { 00804 sym_node->resolved = TRUE; 00805 sym_node->token_type = SYM_FUNCTION; 00806 00807 /* Check that the function exists. */ 00808 ut_a(pars_info_get_user_func(pars_sym_tab_global->info, 00809 sym_node->name)); 00810 00811 return(sym_node); 00812 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_get_lex_chars | ( | char * | buf, | |
| int * | result, | |||
| int | max_size | |||
| ) |
Definition at line 1780 of file pars0pars.c.
References sym_tab_struct::next_char_pos, pars_sym_tab_global, sym_tab_struct::sql_string, sym_tab_struct::string_len, and ut_memcpy().
01782 : buffer where to copy */ 01783 int* result, /* out: number of characters copied or EOF */ 01784 int max_size) /* in: maximum number of characters which fit 01785 in the buffer */ 01786 { 01787 int len; 01788 01789 len = pars_sym_tab_global->string_len 01790 - pars_sym_tab_global->next_char_pos; 01791 if (len == 0) { 01792 #ifdef YYDEBUG 01793 /* fputs("SQL string ends\n", stderr); */ 01794 #endif 01795 *result = 0; 01796 01797 return; 01798 } 01799 01800 if (len > max_size) { 01801 len = max_size; 01802 } 01803 01804 #ifdef UNIV_SQL_DEBUG 01805 if (pars_print_lexed) { 01806 01807 if (len >= 5) { 01808 len = 5; 01809 } 01810 01811 fwrite(pars_sym_tab_global->sql_string + 01812 pars_sym_tab_global->next_char_pos, 01813 1, len, stderr); 01814 } 01815 #endif /* UNIV_SQL_DEBUG */ 01816 01817 ut_memcpy(buf, pars_sym_tab_global->sql_string + 01818 pars_sym_tab_global->next_char_pos, len); 01819 *result = len; 01820 01821 pars_sym_tab_global->next_char_pos += len; 01822 }
Here is the call graph for this function:

| if_node_t* pars_if_statement | ( | que_node_t * | cond, | |
| que_node_t * | stat_list, | |||
| que_node_t * | else_part | |||
| ) |
Definition at line 1248 of file pars0pars.c.
References if_node_struct::common, if_node_struct::cond, if_node_struct::else_part, if_node_struct::elsif_list, sym_tab_struct::heap, mem_heap_alloc(), NULL, pars_resolve_exp_variables_and_types(), pars_set_parent_in_list(), pars_sym_tab_global, QUE_NODE_ELSIF, que_node_get_next(), que_node_get_type(), QUE_NODE_IF, elsif_node_struct::stat_list, if_node_struct::stat_list, and que_common_struct::type.
Referenced by yyparse().
01250 : if-statement node */ 01251 que_node_t* cond, /* in: if-condition */ 01252 que_node_t* stat_list, /* in: statement list */ 01253 que_node_t* else_part) /* in: else-part statement list 01254 or elsif element list */ 01255 { 01256 if_node_t* node; 01257 elsif_node_t* elsif_node; 01258 01259 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(if_node_t)); 01260 01261 node->common.type = QUE_NODE_IF; 01262 01263 node->cond = cond; 01264 01265 pars_resolve_exp_variables_and_types(NULL, cond); 01266 01267 node->stat_list = stat_list; 01268 01269 if (else_part && (que_node_get_type(else_part) == QUE_NODE_ELSIF)) { 01270 01271 /* There is a list of elsif conditions */ 01272 01273 node->else_part = NULL; 01274 node->elsif_list = else_part; 01275 01276 elsif_node = else_part; 01277 01278 while (elsif_node) { 01279 pars_set_parent_in_list(elsif_node->stat_list, node); 01280 01281 elsif_node = que_node_get_next(elsif_node); 01282 } 01283 } else { 01284 node->else_part = else_part; 01285 node->elsif_list = NULL; 01286 01287 pars_set_parent_in_list(else_part, node); 01288 } 01289 01290 pars_set_parent_in_list(stat_list, node); 01291 01292 return(node); 01293 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_info_add_dulint_literal | ( | pars_info_t * | info, | |
| const char * | name, | |||
| dulint | val | |||
| ) |
Definition at line 2038 of file pars0pars.c.
References buf, DATA_FIXBINARY, pars_info_struct::heap, mach_write_to_8(), mem_heap_alloc(), and pars_info_add_literal().
Referenced by row_discard_tablespace_for_mysql(), and row_truncate_table_for_mysql().
02040 : info struct */ 02041 const char* name, /* in: name */ 02042 dulint val) /* in: value */ 02043 { 02044 byte* buf = mem_heap_alloc(info->heap, 8); 02045 02046 mach_write_to_8(buf, val); 02047 02048 pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0); 02049 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_info_add_function | ( | pars_info_t * | info, | |
| const char * | name, | |||
| pars_user_func_cb_t | func, | |||
| void * | arg | |||
| ) |
Definition at line 2055 of file pars0pars.c.
References pars_info_struct::funcs, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), mem_heap_alloc(), pars_info_get_user_func(), and ut_ad.
02057 : info struct */ 02058 const char* name, /* in: function name */ 02059 pars_user_func_cb_t func, /* in: function address */ 02060 void* arg) /* in: user-supplied argument */ 02061 { 02062 pars_user_func_t* puf; 02063 02064 ut_ad(!pars_info_get_user_func(info, name)); 02065 02066 puf = mem_heap_alloc(info->heap, sizeof(*puf)); 02067 02068 puf->name = name; 02069 puf->func = func; 02070 puf->arg = arg; 02071 02072 if (!info->funcs) { 02073 info->funcs = ib_vector_create(info->heap, 8); 02074 } 02075 02076 ib_vector_push(info->funcs, puf); 02077 }
Here is the call graph for this function:

| void pars_info_add_id | ( | pars_info_t * | info, | |
| const char * | name, | |||
| const char * | id | |||
| ) |
Definition at line 2083 of file pars0pars.c.
References pars_info_struct::bound_ids, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), mem_heap_alloc(), pars_info_get_bound_id(), and ut_ad.
02085 : info struct */ 02086 const char* name, /* in: name */ 02087 const char* id) /* in: id */ 02088 { 02089 pars_bound_id_t* bid; 02090 02091 ut_ad(!pars_info_get_bound_id(info, name)); 02092 02093 bid = mem_heap_alloc(info->heap, sizeof(*bid)); 02094 02095 bid->name = name; 02096 bid->id = id; 02097 02098 if (!info->bound_ids) { 02099 info->bound_ids = ib_vector_create(info->heap, 8); 02100 } 02101 02102 ib_vector_push(info->bound_ids, bid); 02103 }
Here is the call graph for this function:

| void pars_info_add_int4_literal | ( | pars_info_t * | info, | |
| const char * | name, | |||
| lint | val | |||
| ) |
Definition at line 2015 of file pars0pars.c.
References buf, DATA_INT, pars_info_struct::heap, mach_write_to_4(), mem_heap_alloc(), and pars_info_add_literal().
Referenced by dict_create_add_foreign_field_to_dictionary(), and dict_create_add_foreign_to_dictionary().
02017 : info struct */ 02018 const char* name, /* in: name */ 02019 lint val) /* in: value */ 02020 { 02021 byte* buf = mem_heap_alloc(info->heap, 4); 02022 02023 mach_write_to_4(buf, val); 02024 pars_info_add_literal(info, name, buf, 4, DATA_INT, 0); 02025 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_info_add_literal | ( | pars_info_t * | info, | |
| const char * | name, | |||
| const void * | address, | |||
| ulint | length, | |||
| ulint | type, | |||
| ulint | prtype | |||
| ) |
Definition at line 1960 of file pars0pars.c.
References pars_info_struct::bound_lits, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), mem_heap_alloc(), pars_info_get_bound_lit(), and ut_ad.
Referenced by pars_info_add_dulint_literal(), pars_info_add_int4_literal(), and pars_info_add_str_literal().
01962 : info struct */ 01963 const char* name, /* in: name */ 01964 const void* address, /* in: address */ 01965 ulint length, /* in: length of data */ 01966 ulint type, /* in: type, e.g. DATA_FIXBINARY */ 01967 ulint prtype) /* in: precise type, e.g. 01968 DATA_UNSIGNED */ 01969 { 01970 pars_bound_lit_t* pbl; 01971 01972 ut_ad(!pars_info_get_bound_lit(info, name)); 01973 01974 pbl = mem_heap_alloc(info->heap, sizeof(*pbl)); 01975 01976 pbl->name = name; 01977 pbl->address = address; 01978 pbl->length = length; 01979 pbl->type = type; 01980 pbl->prtype = prtype; 01981 01982 if (!info->bound_lits) { 01983 info->bound_lits = ib_vector_create(info->heap, 8); 01984 } 01985 01986 ib_vector_push(info->bound_lits, pbl); 01987 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_info_add_str_literal | ( | pars_info_t * | info, | |
| const char * | name, | |||
| const char * | str | |||
| ) |
Definition at line 1994 of file pars0pars.c.
References DATA_ENGLISH, DATA_VARCHAR, pars_info_add_literal(), and strlen().
Referenced by dict_create_add_foreign_field_to_dictionary(), dict_create_add_foreign_to_dictionary(), row_delete_constraint_low(), row_discard_tablespace_for_mysql(), row_drop_table_for_mysql(), and row_rename_table_for_mysql().
01996 : info struct */ 01997 const char* name, /* in: name */ 01998 const char* str) /* in: string */ 01999 { 02000 pars_info_add_literal(info, name, str, strlen(str), 02001 DATA_VARCHAR, DATA_ENGLISH); 02002 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pars_info_t* pars_info_create | ( | void | ) |
Definition at line 1925 of file pars0pars.c.
References info, mem_heap_alloc(), mem_heap_create, NULL, and TRUE.
Referenced by dict_create_add_foreign_field_to_dictionary(), dict_create_add_foreign_to_dictionary(), row_delete_constraint_low(), row_discard_tablespace_for_mysql(), row_drop_table_for_mysql(), row_rename_table_for_mysql(), and row_truncate_table_for_mysql().
01927 : info struct */ 01928 { 01929 pars_info_t* info; 01930 mem_heap_t* heap; 01931 01932 heap = mem_heap_create(512); 01933 01934 info = mem_heap_alloc(heap, sizeof(*info)); 01935 01936 info->heap = heap; 01937 info->funcs = NULL; 01938 info->bound_lits = NULL; 01939 info->bound_ids = NULL; 01940 info->graph_owns_us = TRUE; 01941 01942 return(info); 01943 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void pars_info_free | ( | pars_info_t * | info | ) |
Definition at line 1949 of file pars0pars.c.
References pars_info_struct::heap, and mem_heap_free.
Referenced by que_graph_free().
01951 : info struct */ 01952 { 01953 mem_heap_free(info->heap); 01954 }
Here is the caller graph for this function:

| pars_bound_id_t* pars_info_get_bound_id | ( | pars_info_t * | info, | |
| const char * | name | |||
| ) |
Definition at line 2171 of file pars0pars.c.
References pars_info_struct::bound_ids, ib_vector_get(), ib_vector_size(), NULL, and strcmp().
Referenced by pars_info_add_id(), and sym_tab_add_bound_id().
02173 : bound id, or NULL if not 02174 found */ 02175 pars_info_t* info, /* in: info struct */ 02176 const char* name) /* in: bound id name to find */ 02177 { 02178 ulint i; 02179 ib_vector_t* vec; 02180 02181 if (!info || !info->bound_ids) { 02182 return(NULL); 02183 } 02184 02185 vec = info->bound_ids; 02186 02187 for (i = 0; i < ib_vector_size(vec); i++) { 02188 pars_bound_id_t* bid = ib_vector_get(vec, i); 02189 02190 if (strcmp(bid->name, name) == 0) { 02191 return(bid); 02192 } 02193 } 02194 02195 return(NULL); 02196 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pars_bound_lit_t* pars_info_get_bound_lit | ( | pars_info_t * | info, | |
| const char * | name | |||
| ) |
Definition at line 2140 of file pars0pars.c.
References pars_info_struct::bound_lits, ib_vector_get(), ib_vector_size(), NULL, and strcmp().
Referenced by pars_info_add_literal(), and sym_tab_add_bound_lit().
02142 : bound literal, or NULL if 02143 not found */ 02144 pars_info_t* info, /* in: info struct */ 02145 const char* name) /* in: bound literal name to find */ 02146 { 02147 ulint i; 02148 ib_vector_t* vec; 02149 02150 if (!info || !info->bound_lits) { 02151 return(NULL); 02152 } 02153 02154 vec = info->bound_lits; 02155 02156 for (i = 0; i < ib_vector_size(vec); i++) { 02157 pars_bound_lit_t* pbl = ib_vector_get(vec, i); 02158 02159 if (strcmp(pbl->name, name) == 0) { 02160 return(pbl); 02161 } 02162 } 02163 02164 return(NULL); 02165 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pars_user_func_t* pars_info_get_user_func | ( | pars_info_t * | info, | |
| const char * | name | |||
| ) |
Definition at line 2109 of file pars0pars.c.
References pars_info_struct::funcs, ib_vector_get(), ib_vector_size(), NULL, and strcmp().
Referenced by pars_fetch_statement(), pars_function_declaration(), and pars_info_add_function().
02111 : user func, or NULL if not 02112 found */ 02113 pars_info_t* info, /* in: info struct */ 02114 const char* name) /* in: function name to find*/ 02115 { 02116 ulint i; 02117 ib_vector_t* vec; 02118 02119 if (!info || !info->funcs) { 02120 return(NULL); 02121 } 02122 02123 vec = info->funcs; 02124 02125 for (i = 0; i < ib_vector_size(vec); i++) { 02126 pars_user_func_t* puf = ib_vector_get(vec, i); 02127 02128 if (strcmp(puf->name, name) == 0) { 02129 return(puf); 02130 } 02131 } 02132 02133 return(NULL); 02134 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ins_node_t* pars_insert_statement | ( | sym_node_t * | table_sym, | |
| que_node_t * | values_list, | |||
| sel_node_t * | select | |||
| ) |
Definition at line 1049 of file pars0pars.c.
References sel_node_struct::common, dict_table_copy_types(), dict_table_get_n_cols(), dict_table_get_n_user_cols(), dtuple_create(), sym_tab_struct::heap, ins_node_create(), ins_node_set_new_row(), INS_SEARCHED, INS_VALUES, NULL, que_common_struct::parent, pars_resolve_exp_list_variables_and_types(), pars_retrieve_table_def(), pars_sym_tab_global, que_node_list_get_len(), ins_node_struct::select, sel_node_struct::select_list, ins_node_struct::table, sym_node_struct::table, ut_a, and ins_node_struct::values_list.
Referenced by yyparse().
01051 : update node in a query 01052 tree */ 01053 sym_node_t* table_sym, /* in: table name node */ 01054 que_node_t* values_list, /* in: value expression list or NULL */ 01055 sel_node_t* select) /* in: select condition or NULL */ 01056 { 01057 ins_node_t* node; 01058 dtuple_t* row; 01059 ulint ins_type; 01060 01061 ut_a(values_list || select); 01062 ut_a(!values_list || !select); 01063 01064 if (values_list) { 01065 ins_type = INS_VALUES; 01066 } else { 01067 ins_type = INS_SEARCHED; 01068 } 01069 01070 pars_retrieve_table_def(table_sym); 01071 01072 node = ins_node_create(ins_type, table_sym->table, 01073 pars_sym_tab_global->heap); 01074 01075 row = dtuple_create(pars_sym_tab_global->heap, 01076 dict_table_get_n_cols(node->table)); 01077 01078 dict_table_copy_types(row, table_sym->table); 01079 01080 ins_node_set_new_row(node, row); 01081 01082 node->select = select; 01083 01084 if (select) { 01085 select->common.parent = node; 01086 01087 ut_a(que_node_list_get_len(select->select_list) 01088 == dict_table_get_n_user_cols(table_sym->table)); 01089 } 01090 01091 node->values_list = values_list; 01092 01093 if (node->values_list) { 01094 pars_resolve_exp_list_variables_and_types(NULL, values_list); 01095 01096 ut_a(que_node_list_get_len(values_list) 01097 == dict_table_get_n_user_cols(table_sym->table)); 01098 } 01099 01100 return(node); 01101 }
Here is the call graph for this function:

Here is the caller graph for this function:

| func_node_t* pars_op | ( | int | func, | |
| que_node_t * | arg1, | |||
| que_node_t * | arg2 | |||
| ) |
Definition at line 180 of file pars0pars.c.
References NULL, pars_func_low(), and que_node_list_add_last().
Referenced by yyparse().
00182 : function node in a query tree */ 00183 int func, /* in: operator token code */ 00184 que_node_t* arg1, /* in: first argument */ 00185 que_node_t* arg2) /* in: second argument or NULL for an unary 00186 operator */ 00187 { 00188 que_node_list_add_last(NULL, arg1); 00189 00190 if (arg2) { 00191 que_node_list_add_last(arg1, arg2); 00192 } 00193 00194 return(pars_func_low(func, arg1)); 00195 }
Here is the call graph for this function:

Here is the caller graph for this function:

| open_node_t* pars_open_statement | ( | ulint | type, | |
| sym_node_t * | cursor | |||
| ) |
Definition at line 1495 of file pars0pars.c.
References sym_node_struct::alias, open_node_struct::common, sym_node_struct::cursor_def, open_node_struct::cursor_def, sym_tab_struct::heap, mem_heap_alloc(), NULL, open_node_struct::op_type, pars_resolve_exp_variables_and_types(), pars_sym_tab_global, QUE_NODE_OPEN, SYM_CURSOR, sym_node_struct::token_type, que_common_struct::type, and ut_a.
Referenced by yyparse().
01497 : fetch statement node */ 01498 ulint type, /* in: ROW_SEL_OPEN_CURSOR 01499 or ROW_SEL_CLOSE_CURSOR */ 01500 sym_node_t* cursor) /* in: cursor node */ 01501 { 01502 sym_node_t* cursor_decl; 01503 open_node_t* node; 01504 01505 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(open_node_t)); 01506 01507 node->common.type = QUE_NODE_OPEN; 01508 01509 pars_resolve_exp_variables_and_types(NULL, cursor); 01510 01511 cursor_decl = cursor->alias; 01512 01513 ut_a(cursor_decl->token_type == SYM_CURSOR); 01514 01515 node->op_type = type; 01516 node->cursor_def = cursor_decl->cursor_def; 01517 01518 return(node); 01519 }
Here is the call graph for this function:

Here is the caller graph for this function:

| order_node_t* pars_order_by | ( | sym_node_t * | column, | |
| pars_res_word_t * | asc | |||
| ) |
Definition at line 201 of file pars0pars.c.
References order_node_struct::asc, order_node_struct::column, order_node_struct::common, FALSE, sym_tab_struct::heap, mem_heap_alloc(), pars_asc_token, pars_desc_token, pars_sym_tab_global, QUE_NODE_ORDER, TRUE, que_common_struct::type, and ut_a.
Referenced by yyparse().
00203 : order-by node in a query tree */ 00204 sym_node_t* column, /* in: column name */ 00205 pars_res_word_t* asc) /* in: &pars_asc_token or pars_desc_token */ 00206 { 00207 order_node_t* node; 00208 00209 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(order_node_t)); 00210 00211 node->common.type = QUE_NODE_ORDER; 00212 00213 node->column = column; 00214 00215 if (asc == &pars_asc_token) { 00216 node->asc = TRUE; 00217 } else { 00218 ut_a(asc == &pars_desc_token); 00219 node->asc = FALSE; 00220 } 00221 00222 return(node); 00223 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sym_node_t* pars_parameter_declaration | ( | sym_node_t * | node, | |
| ulint | param_type, | |||
| pars_res_word_t * | type | |||
| ) |
Definition at line 1179 of file pars0pars.c.
References sym_node_struct::param_type, PARS_INPUT, PARS_OUTPUT, pars_variable_declaration(), and ut_a.
Referenced by yyparse().
01181 : symbol table node of type 01182 SYM_VAR */ 01183 sym_node_t* node, /* in: symbol table node allocated for the 01184 id of the parameter */ 01185 ulint param_type, 01186 /* in: PARS_INPUT or PARS_OUTPUT */ 01187 pars_res_word_t* type) /* in: pointer to a type token */ 01188 { 01189 ut_a((param_type == PARS_INPUT) || (param_type == PARS_OUTPUT)); 01190 01191 pars_variable_declaration(node, type); 01192 01193 node->param_type = param_type; 01194 01195 return(node); 01196 }
Here is the call graph for this function:

Here is the caller graph for this function:

| func_node_t* pars_procedure_call | ( | que_node_t * | res_word, | |
| que_node_t * | args | |||
| ) |
Definition at line 1423 of file pars0pars.c.
References NULL, pars_func(), and pars_resolve_exp_list_variables_and_types().
Referenced by yyparse().
01425 : function node */ 01426 que_node_t* res_word,/* in: procedure name reserved word */ 01427 que_node_t* args) /* in: argument list */ 01428 { 01429 func_node_t* node; 01430 01431 node = pars_func(res_word, args); 01432 01433 pars_resolve_exp_list_variables_and_types(NULL, args); 01434 01435 return(node); 01436 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_fork_t* pars_procedure_definition | ( | sym_node_t * | sym_node, | |
| sym_node_t * | param_list, | |||
| que_node_t * | stat_list | |||
| ) |
Definition at line 1716 of file pars0pars.c.
References que_thr_struct::child, proc_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), NULL, proc_node_struct::param_list, que_common_struct::parent, pars_set_parent_in_list(), pars_sym_tab_global, proc_node_struct::proc_id, que_fork_create(), QUE_FORK_PROCEDURE, QUE_NODE_PROC, que_thr_create(), sym_tab_struct::query_graph, sym_node_struct::resolved, proc_node_struct::stat_list, SYM_PROCEDURE_NAME, proc_node_struct::sym_tab, sym_node_struct::token_type, TRUE, que_fork_struct::trx, and que_common_struct::type.
Referenced by yyparse().
01718 : query fork node */ 01719 sym_node_t* sym_node, /* in: procedure id node in the symbol 01720 table */ 01721 sym_node_t* param_list, /* in: parameter declaration list */ 01722 que_node_t* stat_list) /* in: statement list */ 01723 { 01724 proc_node_t* node; 01725 que_fork_t* fork; 01726 que_thr_t* thr; 01727 mem_heap_t* heap; 01728 01729 heap = pars_sym_tab_global->heap; 01730 01731 fork = que_fork_create(NULL, NULL, QUE_FORK_PROCEDURE, heap); 01732 fork->trx = NULL; 01733 01734 thr = que_thr_create(fork, heap); 01735 01736 node = mem_heap_alloc(heap, sizeof(proc_node_t)); 01737 01738 node->common.type = QUE_NODE_PROC; 01739 node->common.parent = thr; 01740 01741 sym_node->token_type = SYM_PROCEDURE_NAME; 01742 sym_node->resolved = TRUE; 01743 01744 node->proc_id = sym_node; 01745 node->param_list = param_list; 01746 node->stat_list = stat_list; 01747 01748 pars_set_parent_in_list(stat_list, node); 01749 01750 node->sym_tab = pars_sym_tab_global; 01751 01752 thr->child = node; 01753 01754 pars_sym_tab_global->query_graph = fork; 01755 01756 return(fork); 01757 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_process_assign_list | ( | upd_node_t * | node | ) | [static] |
Definition at line 865 of file pars0pars.c.
References col_assign_node_struct::col, upd_node_struct::col_assign_list, sym_node_struct::col_no, upd_node_struct::columns, dict_index_get_nth_col_pos(), dict_index_get_nth_type(), dict_table_get_first_index(), dtype_is_fixed_size(), upd_field_struct::exp, upd_field_struct::field_no, sym_tab_struct::heap, NULL, opt_find_all_cols(), pars_resolve_exp_columns(), pars_resolve_exp_variables_and_types(), pars_sym_tab_global, que_node_get_next(), upd_node_struct::table, upd_node_struct::table_sym, TRUE, upd_create(), upd_field_set_field_no(), upd_get_nth_field(), UPD_NODE_NO_SIZE_CHANGE, upd_node_struct::update, and col_assign_node_struct::val.
Referenced by pars_update_statement().
00867 : update node */ 00868 { 00869 col_assign_node_t* col_assign_list; 00870 sym_node_t* table_sym; 00871 col_assign_node_t* assign_node; 00872 upd_field_t* upd_field; 00873 dict_index_t* clust_index; 00874 sym_node_t* col_sym; 00875 ulint changes_ord_field; 00876 ulint changes_field_size; 00877 ulint n_assigns; 00878 ulint i; 00879 00880 table_sym = node->table_sym; 00881 col_assign_list = node->col_assign_list; 00882 clust_index = dict_table_get_first_index(node->table); 00883 00884 assign_node = col_assign_list; 00885 n_assigns = 0; 00886 00887 while (assign_node) { 00888 pars_resolve_exp_columns(table_sym, assign_node->col); 00889 pars_resolve_exp_columns(table_sym, assign_node->val); 00890 pars_resolve_exp_variables_and_types(NULL, assign_node->val); 00891 00892 /* ut_a(dtype_get_mtype(dfield_get_type( 00893 que_node_get_val(assign_node->col))) 00894 == dtype_get_mtype(dfield_get_type( 00895 que_node_get_val(assign_node->val)))); */ 00896 00897 /* Add to the update node all the columns found in assignment 00898 values as columns to copy: therefore, TRUE */ 00899 00900 opt_find_all_cols(TRUE, clust_index, &(node->columns), NULL, 00901 assign_node->val); 00902 n_assigns++; 00903 00904 assign_node = que_node_get_next(assign_node); 00905 } 00906 00907 node->update = upd_create(n_assigns, pars_sym_tab_global->heap); 00908 00909 assign_node = col_assign_list; 00910 00911 changes_field_size = UPD_NODE_NO_SIZE_CHANGE; 00912 00913 for (i = 0; i < n_assigns; i++) { 00914 upd_field = upd_get_nth_field(node->update, i); 00915 00916 col_sym = assign_node->col; 00917 00918 upd_field_set_field_no(upd_field, 00919 dict_index_get_nth_col_pos(clust_index, 00920 col_sym->col_no), 00921 clust_index, NULL); 00922 upd_field->exp = assign_node->val; 00923 00924 if (!dtype_is_fixed_size( 00925 dict_index_get_nth_type(clust_index, 00926 upd_field->field_no))) { 00927 changes_field_size = 0; 00928 } 00929 00930 assign_node = que_node_get_next(assign_node); 00931 } 00932 00933 /* Find out if the update can modify an ordering field in any index */ 00934 00935 changes_ord_field = UPD_NODE_NO_ORD_CHANGE; 00936 00937 if (row_upd_changes_some_index_ord_field_binary(node->table, 00938 node->update)) { 00939 changes_ord_field = 0; 00940 } 00941 00942 node->cmpl_info = changes_ord_field | changes_field_size; 00943 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_resolve_exp_columns | ( | sym_node_t * | table_node, | |
| que_node_t * | exp_node | |||
| ) | [static] |
Definition at line 443 of file pars0pars.c.
References func_node_struct::args, sym_node_struct::col_no, sym_node_struct::common, dfield_set_type(), dict_col_get_type(), dict_table_get_n_cols(), dict_table_get_nth_col(), sym_node_struct::name, dict_col_struct::name, sym_node_struct::name_len, NULL, sym_node_struct::prefetch_buf, QUE_NODE_FUNC, que_node_get_next(), que_node_get_type(), QUE_NODE_SYMBOL, sym_node_struct::resolved, SYM_COLUMN, sym_node_struct::table, sym_node_struct::token_type, TRUE, ut_a, ut_memcmp(), ut_strlen(), and que_common_struct::val.
Referenced by pars_process_assign_list(), pars_resolve_exp_list_columns(), and pars_select_statement().
00445 : first node in a table list */ 00446 que_node_t* exp_node) /* in: expression */ 00447 { 00448 func_node_t* func_node; 00449 que_node_t* arg; 00450 sym_node_t* sym_node; 00451 dict_table_t* table; 00452 sym_node_t* t_node; 00453 dict_col_t* col; 00454 ulint n_cols; 00455 ulint i; 00456 00457 ut_a(exp_node); 00458 00459 if (que_node_get_type(exp_node) == QUE_NODE_FUNC) { 00460 func_node = exp_node; 00461 00462 arg = func_node->args; 00463 00464 while (arg) { 00465 pars_resolve_exp_columns(table_node, arg); 00466 00467 arg = que_node_get_next(arg); 00468 } 00469 00470 return; 00471 } 00472 00473 ut_a(que_node_get_type(exp_node) == QUE_NODE_SYMBOL); 00474 00475 sym_node = exp_node; 00476 00477 if (sym_node->resolved) { 00478 00479 return; 00480 } 00481 00482 /* Not resolved yet: look in the table list for a column with the 00483 same name */ 00484 00485 t_node = table_node; 00486 00487 while (t_node) { 00488 table = t_node->table; 00489 00490 n_cols = dict_table_get_n_cols(table); 00491 00492 for (i = 0; i < n_cols; i++) { 00493 col = dict_table_get_nth_col(table, i); 00494 00495 if ((sym_node->name_len == ut_strlen(col->name)) 00496 && (0 == ut_memcmp(sym_node->name, col->name, 00497 sym_node->name_len))) { 00498 /* Found */ 00499 sym_node->resolved = TRUE; 00500 sym_node->token_type = SYM_COLUMN; 00501 sym_node->table = table; 00502 sym_node->col_no = i; 00503 sym_node->prefetch_buf = NULL; 00504 00505 dfield_set_type(&(sym_node->common.val), 00506 dict_col_get_type(col)); 00507 00508 return; 00509 } 00510 } 00511 00512 t_node = que_node_get_next(t_node); 00513 } 00514 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_resolve_exp_list_columns | ( | sym_node_t * | table_node, | |
| que_node_t * | exp_node | |||
| ) | [static] |
Definition at line 520 of file pars0pars.c.
References pars_resolve_exp_columns(), and que_node_get_next().
Referenced by pars_select_statement().
00522 : first node in a table list */ 00523 que_node_t* exp_node) /* in: expression list first node, or 00524 NULL */ 00525 { 00526 while (exp_node) { 00527 pars_resolve_exp_columns(table_node, exp_node); 00528 00529 exp_node = que_node_get_next(exp_node); 00530 } 00531 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_resolve_exp_list_variables_and_types | ( | sel_node_t * | select_node, | |
| que_node_t * | exp_node | |||
| ) | [static] |
Definition at line 426 of file pars0pars.c.
References pars_resolve_exp_variables_and_types(), and que_node_get_next().
Referenced by pars_fetch_statement(), pars_insert_statement(), pars_procedure_call(), pars_select_list(), and pars_select_statement().
00428 : select node or NULL */ 00429 que_node_t* exp_node) /* in: expression list first node, or 00430 NULL */ 00431 { 00432 while (exp_node) { 00433 pars_resolve_exp_variables_and_types(select_node, exp_node); 00434 00435 exp_node = que_node_get_next(exp_node); 00436 } 00437 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_resolve_exp_variables_and_types | ( | sel_node_t * | select_node, | |
| que_node_t * | exp_node | |||
| ) | [static] |
Definition at line 335 of file pars0pars.c.
References sym_node_struct::alias, func_node_struct::args, sel_node_struct::copy_variables, dfield_set_type(), sym_node_struct::indirection, sym_node_struct::name, sym_node_struct::name_len, pars_resolve_func_data_type(), pars_sym_tab_global, QUE_NODE_FUNC, que_node_get_data_type(), que_node_get_next(), que_node_get_type(), que_node_get_val(), QUE_NODE_SYMBOL, sym_node_struct::resolved, SYM_CURSOR, SYM_FUNCTION, SYM_IMPLICIT_VAR, sym_tab_struct::sym_list, SYM_VAR, sym_node_struct::token_type, TRUE, ut_a, UT_LIST_ADD_LAST, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and ut_memcmp().
Referenced by pars_assignment_statement(), pars_elsif_element(), pars_fetch_statement(), pars_for_statement(), pars_if_statement(), pars_open_statement(), pars_process_assign_list(), pars_resolve_exp_list_variables_and_types(), pars_select_statement(), pars_update_statement(), and pars_while_statement().
00337 : select node or NULL; if 00338 this is not NULL then the variable 00339 sym nodes are added to the 00340 copy_variables list of select_node */ 00341 que_node_t* exp_node) /* in: expression */ 00342 { 00343 func_node_t* func_node; 00344 que_node_t* arg; 00345 sym_node_t* sym_node; 00346 sym_node_t* node; 00347 00348 ut_a(exp_node); 00349 00350 if (que_node_get_type(exp_node) == QUE_NODE_FUNC) { 00351 func_node = exp_node; 00352 00353 arg = func_node->args; 00354 00355 while (arg) { 00356 pars_resolve_exp_variables_and_types(select_node, arg); 00357 00358 arg = que_node_get_next(arg); 00359 } 00360 00361 pars_resolve_func_data_type(func_node); 00362 00363 return; 00364 } 00365 00366 ut_a(que_node_get_type(exp_node) == QUE_NODE_SYMBOL); 00367 00368 sym_node = exp_node; 00369 00370 if (sym_node->resolved) { 00371 00372 return; 00373 } 00374 00375 /* Not resolved yet: look in the symbol table for a variable 00376 or a cursor or a function with the same name */ 00377 00378 node = UT_LIST_GET_FIRST(pars_sym_tab_global->sym_list); 00379 00380 while (node) { 00381 if (node->resolved 00382 && ((node->token_type == SYM_VAR) 00383 || (node->token_type == SYM_CURSOR) 00384 || (node->token_type == SYM_FUNCTION)) 00385 && node->name 00386 && (sym_node->name_len == node->name_len) 00387 && (ut_memcmp(sym_node->name, node->name, 00388 node->name_len) == 0)) { 00389 00390 /* Found a variable or a cursor declared with 00391 the same name */ 00392 00393 break; 00394 } 00395 00396 node = UT_LIST_GET_NEXT(sym_list, node); 00397 } 00398 00399 if (!node) { 00400 fprintf(stderr, "PARSER ERROR: Unresolved identifier %s\n", 00401 sym_node->name); 00402 } 00403 00404 ut_a(node); 00405 00406 sym_node->resolved = TRUE; 00407 sym_node->token_type = SYM_IMPLICIT_VAR; 00408 sym_node->alias = node; 00409 sym_node->indirection = node; 00410 00411 if (select_node) { 00412 UT_LIST_ADD_LAST(col_var_list, select_node->copy_variables, 00413 sym_node); 00414 } 00415 00416 dfield_set_type(que_node_get_val(sym_node), 00417 que_node_get_data_type(node)); 00418 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_resolve_func_data_type | ( | func_node_t * | node | ) | [static] |
Definition at line 230 of file pars0pars.c.
References func_node_struct::args, DATA_BINARY, DATA_ENGLISH, DATA_INT, DATA_VARCHAR, dtype_copy(), dtype_get_mtype(), dtype_set(), func_node_struct::func, func, NULL, PARS_AND_TOKEN, PARS_BINARY_TO_NUMBER_TOKEN, PARS_CONCAT_TOKEN, PARS_COUNT_TOKEN, PARS_GE_TOKEN, PARS_INSTR_TOKEN, PARS_LE_TOKEN, PARS_LENGTH_TOKEN, PARS_NE_TOKEN, PARS_NOT_TOKEN, PARS_NOTFOUND_TOKEN, PARS_OR_TOKEN, PARS_RND_STR_TOKEN, PARS_RND_TOKEN, PARS_SUBSTR_TOKEN, PARS_SUM_TOKEN, PARS_SYSDATE_TOKEN, PARS_TO_BINARY_TOKEN, PARS_TO_CHAR_TOKEN, PARS_TO_NUMBER_TOKEN, QUE_NODE_FUNC, que_node_get_data_type(), que_node_get_type(), ut_a, and ut_error.
Referenced by pars_resolve_exp_variables_and_types().
00232 : function node */ 00233 { 00234 que_node_t* arg; 00235 ulint func; 00236 00237 ut_a(que_node_get_type(node) == QUE_NODE_FUNC); 00238 00239 arg = node->args; 00240 00241 func = node->func; 00242 00243 if ((func == PARS_SUM_TOKEN) 00244 || (func == '+') || (func == '-') || (func == '*') 00245 || (func == '/') || (func == '+')) { 00246 00247 /* Inherit the data type from the first argument (which must 00248 not be the SQL null literal whose type is DATA_ERROR) */ 00249 00250 dtype_copy(que_node_get_data_type(node), 00251 que_node_get_data_type(arg)); 00252 00253 ut_a(dtype_get_mtype(que_node_get_data_type(node)) 00254 == DATA_INT); 00255 } else if (func == PARS_COUNT_TOKEN) { 00256 ut_a(arg); 00257 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00258 00259 } else if (func == PARS_TO_CHAR_TOKEN) { 00260 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT); 00261 dtype_set(que_node_get_data_type(node), DATA_VARCHAR, 00262 DATA_ENGLISH, 0, 0); 00263 } else if (func == PARS_TO_BINARY_TOKEN) { 00264 if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) { 00265 dtype_set(que_node_get_data_type(node), DATA_VARCHAR, 00266 DATA_ENGLISH, 0, 0); 00267 } else { 00268 dtype_set(que_node_get_data_type(node), DATA_BINARY, 00269 0, 0, 0); 00270 } 00271 } else if (func == PARS_TO_NUMBER_TOKEN) { 00272 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) 00273 == DATA_VARCHAR); 00274 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00275 00276 } else if (func == PARS_BINARY_TO_NUMBER_TOKEN) { 00277 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) 00278 == DATA_VARCHAR); 00279 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00280 00281 } else if (func == PARS_LENGTH_TOKEN) { 00282 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) 00283 == DATA_VARCHAR); 00284 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00285 00286 } else if (func == PARS_INSTR_TOKEN) { 00287 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) 00288 == DATA_VARCHAR); 00289 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00290 00291 } else if (func == PARS_SYSDATE_TOKEN) { 00292 ut_a(arg == NULL); 00293 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00294 00295 } else if ((func == PARS_SUBSTR_TOKEN) 00296 || (func == PARS_CONCAT_TOKEN)) { 00297 00298 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) 00299 == DATA_VARCHAR); 00300 dtype_set(que_node_get_data_type(node), DATA_VARCHAR, 00301 DATA_ENGLISH, 0, 0); 00302 00303 } else if ((func == '>') || (func == '<') || (func == '=') 00304 || (func == PARS_GE_TOKEN) 00305 || (func == PARS_LE_TOKEN) 00306 || (func == PARS_NE_TOKEN) 00307 || (func == PARS_AND_TOKEN) 00308 || (func == PARS_OR_TOKEN) 00309 || (func == PARS_NOT_TOKEN) 00310 || (func == PARS_NOTFOUND_TOKEN)) { 00311 00312 /* We currently have no iboolean type: use integer type */ 00313 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00314 00315 } else if (func == PARS_RND_TOKEN) { 00316 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT); 00317 00318 dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0); 00319 00320 } else if (func == PARS_RND_STR_TOKEN) { 00321 ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT); 00322 00323 dtype_set(que_node_get_data_type(node), DATA_VARCHAR, 00324 DATA_ENGLISH, 0, 0); 00325 } else { 00326 ut_error; 00327 } 00328 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_retrieve_table_def | ( | sym_node_t * | sym_node | ) | [static] |
Definition at line 537 of file pars0pars.c.
References dict_table_get_low(), sym_node_struct::name, que_node_get_type(), QUE_NODE_SYMBOL, sym_node_struct::resolved, SYM_TABLE, sym_node_struct::table, sym_node_struct::token_type, TRUE, and ut_a.
Referenced by pars_insert_statement(), pars_retrieve_table_list_defs(), and pars_update_statement().
00539 : table node */ 00540 { 00541 const char* table_name; 00542 00543 ut_a(sym_node); 00544 ut_a(que_node_get_type(sym_node) == QUE_NODE_SYMBOL); 00545 00546 sym_node->resolved = TRUE; 00547 sym_node->token_type = SYM_TABLE; 00548 00549 table_name = (const char*) sym_node->name; 00550 00551 sym_node->table = dict_table_get_low(table_name); 00552 00553 ut_a(sym_node->table); 00554 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static ulint pars_retrieve_table_list_defs | ( | sym_node_t * | sym_node | ) | [static] |
Definition at line 560 of file pars0pars.c.
References count, NULL, pars_retrieve_table_def(), and que_node_get_next().
Referenced by pars_select_statement().
00562 : number of tables */ 00563 sym_node_t* sym_node) /* in: first table node in list */ 00564 { 00565 ulint count = 0; 00566 00567 if (sym_node == NULL) { 00568 00569 return(count); 00570 } 00571 00572 while (sym_node) { 00573 pars_retrieve_table_def(sym_node); 00574 00575 count++; 00576 00577 sym_node = que_node_get_next(sym_node); 00578 } 00579 00580 return(count); 00581 }
Here is the call graph for this function:

Here is the caller graph for this function:

| return_node_t* pars_return_statement | ( | void | ) |
Definition at line 1378 of file pars0pars.c.
References return_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_sym_tab_global, QUE_NODE_RETURN, and que_common_struct::type.
Referenced by yyparse().
01380 : return-statement node */ 01381 { 01382 return_node_t* node; 01383 01384 node = mem_heap_alloc(pars_sym_tab_global->heap, 01385 sizeof(return_node_t)); 01386 node->common.type = QUE_NODE_RETURN; 01387 01388 return(node); 01389 }
Here is the call graph for this function:

Here is the caller graph for this function:

| roll_node_t* pars_rollback_statement | ( | void | ) |
Definition at line 1557 of file pars0pars.c.
References sym_tab_struct::heap, pars_sym_tab_global, and roll_node_create().
Referenced by yyparse().
01559 { 01560 return(roll_node_create(pars_sym_tab_global->heap)); 01561 }
Here is the call graph for this function:

Here is the caller graph for this function:

| row_printf_node_t* pars_row_printf_statement | ( | sel_node_t * | sel_node | ) |
Definition at line 1525 of file pars0pars.c.
References sel_node_struct::common, row_printf_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), que_common_struct::parent, pars_sym_tab_global, QUE_NODE_ROW_PRINTF, row_printf_node_struct::sel_node, and que_common_struct::type.
Referenced by yyparse().
01527 : row_printf-statement node */ 01528 sel_node_t* sel_node) /* in: select node */ 01529 { 01530 row_printf_node_t* node; 01531 01532 node = mem_heap_alloc(pars_sym_tab_global->heap, 01533 sizeof(row_printf_node_t)); 01534 node->common.type = QUE_NODE_ROW_PRINTF; 01535 01536 node->sel_node = sel_node; 01537 01538 sel_node->common.parent = node; 01539 01540 return(node); 01541 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_select_all_columns | ( | sel_node_t * | select_node | ) | [static] |
Definition at line 587 of file pars0pars.c.
References dict_table_get_n_user_cols(), dict_table_get_nth_col(), dict_col_struct::name, NULL, pars_sym_tab_global, que_node_get_next(), que_node_list_add_last(), sel_node_struct::select_list, sym_tab_add_id(), sym_node_struct::table, sel_node_struct::table_list, and ut_strlen().
Referenced by pars_select_statement().
00589 : select node already containing 00590 the table list */ 00591 { 00592 sym_node_t* col_node; 00593 sym_node_t* table_node; 00594 dict_table_t* table; 00595 dict_col_t* col; 00596 ulint i; 00597 00598 select_node->select_list = NULL; 00599 00600 table_node = select_node->table_list; 00601 00602 while (table_node) { 00603 table = table_node->table; 00604 00605 for (i = 0; i < dict_table_get_n_user_cols(table); i++) { 00606 00607 col = dict_table_get_nth_col(table, i); 00608 00609 col_node = sym_tab_add_id(pars_sym_tab_global, 00610 (byte*)col->name, 00611 ut_strlen(col->name)); 00612 select_node->select_list 00613 = que_node_list_add_last( 00614 select_node->select_list, 00615 col_node); 00616 } 00617 00618 table_node = que_node_get_next(table_node); 00619 } 00620 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sel_node_t* pars_select_list | ( | que_node_t * | select_list, | |
| sym_node_t * | into_list | |||
| ) |
Definition at line 627 of file pars0pars.c.
References sym_tab_struct::heap, sel_node_struct::into_list, NULL, pars_resolve_exp_list_variables_and_types(), pars_sym_tab_global, sel_node_create(), and sel_node_struct::select_list.
Referenced by pars_update_statement(), and yyparse().
00629 : select node in a query 00630 tree */ 00631 que_node_t* select_list, /* in: select list */ 00632 sym_node_t* into_list) /* in: variables list or NULL */ 00633 { 00634 sel_node_t* node; 00635 00636 node = sel_node_create(pars_sym_tab_global->heap); 00637 00638 node->select_list = select_list; 00639 node->into_list = into_list; 00640 00641 pars_resolve_exp_list_variables_and_types(NULL, into_list); 00642 00643 return(node); 00644 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sel_node_t* pars_select_statement | ( | sel_node_t * | select_node, | |
| sym_node_t * | table_list, | |||
| que_node_t * | search_cond, | |||
| pars_res_word_t * | for_update, | |||
| pars_res_word_t * | lock_shared, | |||
| order_node_t * | order_by | |||
| ) |
Definition at line 693 of file pars0pars.c.
References sel_node_struct::can_get_updated, sel_node_struct::consistent_read, sel_node_struct::copy_variables, sel_node_struct::explicit_cursor, FALSE, sel_node_struct::into_list, LOCK_S, LOCK_X, sel_node_struct::n_tables, NULL, opt_search_plan(), order_by, sel_node_struct::order_by, pars_check_aggregate(), pars_resolve_exp_columns(), pars_resolve_exp_list_columns(), pars_resolve_exp_list_variables_and_types(), pars_resolve_exp_variables_and_types(), pars_retrieve_table_list_defs(), pars_select_all_columns(), pars_star_denoter, que_node_list_get_len(), sel_node_struct::read_view, sel_node_struct::row_lock_mode, sel_node_struct::search_cond, SEL_NODE_OPEN, sel_node_struct::select_list, sel_node_struct::set_x_locks, sel_node_struct::state, sel_node_struct::table_list, TRUE, ut_a, and UT_LIST_INIT.
Referenced by pars_update_statement(), and yyparse().
00695 : select node in a query 00696 tree */ 00697 sel_node_t* select_node, /* in: select node already containing 00698 the select list */ 00699 sym_node_t* table_list, /* in: table list */ 00700 que_node_t* search_cond, /* in: search condition or NULL */ 00701 pars_res_word_t* for_update, /* in: NULL or &pars_update_token */ 00702 pars_res_word_t* lock_shared, /* in: NULL or &pars_share_token */ 00703 order_node_t* order_by) /* in: NULL or an order-by node */ 00704 { 00705 select_node->state = SEL_NODE_OPEN; 00706 00707 select_node->table_list = table_list; 00708 select_node->n_tables = pars_retrieve_table_list_defs(table_list); 00709 00710 if (select_node->select_list == &pars_star_denoter) { 00711 00712 /* SELECT * FROM ... */ 00713 pars_select_all_columns(select_node); 00714 } 00715 00716 if (select_node->into_list) { 00717 ut_a(que_node_list_get_len(select_node->into_list) 00718 == que_node_list_get_len(select_node->select_list)); 00719 } 00720 00721 UT_LIST_INIT(select_node->copy_variables); 00722 00723 pars_resolve_exp_list_columns(table_list, select_node->select_list); 00724 pars_resolve_exp_list_variables_and_types(select_node, 00725 select_node->select_list); 00726 pars_check_aggregate(select_node); 00727 00728 select_node->search_cond = search_cond; 00729 00730 if (search_cond) { 00731 pars_resolve_exp_columns(table_list, search_cond); 00732 pars_resolve_exp_variables_and_types(select_node, search_cond); 00733 } 00734 00735 if (for_update) { 00736 ut_a(!lock_shared); 00737 00738 select_node->set_x_locks = TRUE; 00739 select_node->row_lock_mode = LOCK_X; 00740 00741 select_node->consistent_read = FALSE; 00742 select_node->read_view = NULL; 00743 } else if (lock_shared){ 00744 select_node->set_x_locks = FALSE; 00745 select_node->row_lock_mode = LOCK_S; 00746 00747 select_node->consistent_read = FALSE; 00748 select_node->read_view = NULL; 00749 } else { 00750 select_node->set_x_locks = FALSE; 00751 select_node->row_lock_mode = LOCK_S; 00752 00753 select_node->consistent_read = TRUE; 00754 } 00755 00756 select_node->order_by = order_by; 00757 00758 if (order_by) { 00759 pars_resolve_exp_columns(table_list, order_by->column); 00760 } 00761 00762 /* The final value of the following fields depend on the environment 00763 where the select statement appears: */ 00764 00765 select_node->can_get_updated = FALSE; 00766 select_node->explicit_cursor = NULL; 00767 00768 opt_search_plan(select_node); 00769 00770 return(select_node); 00771 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_set_dfield_type | ( | dfield_t * | dfield, | |
| pars_res_word_t * | type, | |||
| ulint | len, | |||
| ibool | is_unsigned, | |||
| ibool | is_not_null | |||
| ) | [static] |
Definition at line 1107 of file pars0pars.c.
References DATA_BINARY_TYPE, DATA_BLOB, DATA_ENGLISH, DATA_FIXBINARY, DATA_INT, DATA_NOT_NULL, DATA_UNSIGNED, DATA_VARCHAR, dfield_get_type(), dtype_set(), flags, pars_binary_token, pars_blob_token, pars_char_token, pars_int_token, ut_a, and ut_error.
Referenced by pars_column_def(), and pars_variable_declaration().
01109 : dfield */ 01110 pars_res_word_t* type, /* in: pointer to a type 01111 token */ 01112 ulint len, /* in: length, or 0 */ 01113 ibool is_unsigned, /* in: if TRUE, column is 01114 UNSIGNED. */ 01115 ibool is_not_null) /* in: if TRUE, column is 01116 NOT NULL. */ 01117 { 01118 ulint flags = 0; 01119 01120 if (is_not_null) { 01121 flags |= DATA_NOT_NULL; 01122 } 01123 01124 if (is_unsigned) { 01125 flags |= DATA_UNSIGNED; 01126 } 01127 01128 if (type == &pars_int_token) { 01129 ut_a(len == 0); 01130 01131 dtype_set(dfield_get_type(dfield), DATA_INT, flags, 4, 0); 01132 01133 } else if (type == &pars_char_token) { 01134 ut_a(len == 0); 01135 01136 dtype_set(dfield_get_type(dfield), DATA_VARCHAR, 01137 DATA_ENGLISH | flags, 0, 0); 01138 } else if (type == &pars_binary_token) { 01139 ut_a(len != 0); 01140 01141 dtype_set(dfield_get_type(dfield), DATA_FIXBINARY, 01142 DATA_BINARY_TYPE | flags, len, 0); 01143 } else if (type == &pars_blob_token) { 01144 ut_a(len == 0); 01145 01146 dtype_set(dfield_get_type(dfield), DATA_BLOB, 01147 DATA_BINARY_TYPE | flags, 0, 0); 01148 } else { 01149 ut_error; 01150 } 01151 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void pars_set_parent_in_list | ( | que_node_t * | node_list, | |
| que_node_t * | parent | |||
| ) | [static] |
Definition at line 1202 of file pars0pars.c.
References que_common_struct::parent, and que_node_get_next().
Referenced by pars_for_statement(), pars_if_statement(), pars_procedure_definition(), and pars_while_statement().
01204 : first node in a list */ 01205 que_node_t* parent) /* in: parent value to set in all 01206 nodes of the list */ 01207 { 01208 que_common_t* common; 01209 01210 common = node_list; 01211 01212 while (common) { 01213 common->parent = parent; 01214 01215 common = que_node_get_next(common); 01216 } 01217 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_t* pars_sql | ( | pars_info_t * | info, | |
| const char * | str | |||
| ) |
Definition at line 1844 of file pars0pars.c.
References dict_sys, que_fork_struct::info, sym_tab_struct::info, mem_heap_create, mem_heap_dup(), dict_sys_struct::mutex, sym_tab_struct::next_char_pos, pars_sym_tab_global, sym_tab_struct::query_graph, sym_node_struct::resolved, sym_tab_struct::sql_string, sym_tab_struct::string_len, strlen(), sym_tab_struct::sym_list, que_fork_struct::sym_tab, sym_tab_create(), ut_a, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and yyparse.
Referenced by que_eval_sql().
01846 : the query graph */ 01847 pars_info_t* info, /* in: extra information, or NULL */ 01848 const char* str) /* in: SQL string */ 01849 { 01850 sym_node_t* sym_node; 01851 mem_heap_t* heap; 01852 que_t* graph; 01853 01854 ut_ad(str); 01855 01856 heap = mem_heap_create(256); 01857 01858 #ifdef UNIV_SYNC_DEBUG 01859 /* Currently, the parser is not reentrant: */ 01860 ut_ad(mutex_own(&(dict_sys->mutex))); 01861 #endif /* UNIV_SYNC_DEBUG */ 01862 pars_sym_tab_global = sym_tab_create(heap); 01863 01864 pars_sym_tab_global->string_len = strlen(str); 01865 pars_sym_tab_global->sql_string = mem_heap_dup(heap, str, 01866 pars_sym_tab_global->string_len + 1); 01867 pars_sym_tab_global->next_char_pos = 0; 01868 pars_sym_tab_global->info = info; 01869 01870 yyparse(); 01871 01872 sym_node = UT_LIST_GET_FIRST(pars_sym_tab_global->sym_list); 01873 01874 while (sym_node) { 01875 ut_a(sym_node->resolved); 01876 01877 sym_node = UT_LIST_GET_NEXT(sym_list, sym_node); 01878 } 01879 01880 graph = pars_sym_tab_global->query_graph; 01881 01882 graph->sym_tab = pars_sym_tab_global; 01883 graph->info = info; 01884 01885 /* fprintf(stderr, "SQL graph size %lu\n", mem_heap_get_size(heap)); */ 01886 01887 return(graph); 01888 }
Here is the call graph for this function:

Here is the caller graph for this function:

| que_fork_t* pars_stored_procedure_call | ( | sym_node_t *sym_node | __attribute__((unused)) | ) |
Definition at line 1766 of file pars0pars.c.
References NULL, and ut_error.
01768 : query graph */ 01769 sym_node_t* sym_node __attribute__((unused))) 01770 /* in: stored procedure name */ 01771 { 01772 ut_error; 01773 return(NULL); 01774 }
| upd_node_t* pars_update_statement | ( | upd_node_t * | node, | |
| sym_node_t * | cursor_sym, | |||
| que_node_t * | search_cond | |||
| ) |
Definition at line 949 of file pars0pars.c.
References sym_node_struct::alias, BTR_MODIFY_LEAF, sel_node_struct::can_get_updated, upd_node_struct::cmpl_info, upd_node_struct::col_assign_list, upd_node_struct::columns, sel_node_struct::common, sel_node_struct::consistent_read, sym_node_struct::cursor_def, DICT_CLUSTERED, FALSE, upd_node_struct::has_clust_rec_x_lock, sel_node_struct::is_aggregate, upd_node_struct::is_delete, sel_node_struct::latch_mode, LOCK_X, sel_node_struct::n_tables, NULL, sel_node_struct::order_by, que_common_struct::parent, pars_process_assign_list(), pars_resolve_exp_variables_and_types(), pars_retrieve_table_def(), pars_select_list(), pars_select_statement(), pars_share_token, upd_node_struct::pcur, plan(), que_node_list_add_last(), sel_node_struct::row_lock_mode, upd_node_struct::searched_update, sel_node_get_nth_plan(), upd_node_struct::select, sel_node_struct::select_will_do_update, upd_node_struct::select_will_do_update, sel_node_struct::set_x_locks, upd_node_struct::state, sym_node_struct::table, upd_node_struct::table, upd_node_struct::table_sym, TRUE, UPD_NODE_NO_ORD_CHANGE, UPD_NODE_NO_SIZE_CHANGE, UPD_NODE_UPDATE_CLUSTERED, ut_a, and UT_LIST_INIT.
Referenced by yyparse().
00951 : update node in a query 00952 tree */ 00953 upd_node_t* node, /* in: update node */ 00954 sym_node_t* cursor_sym, /* in: pointer to a cursor entry in 00955 the symbol table or NULL */ 00956 que_node_t* search_cond) /* in: search condition or NULL */ 00957 { 00958 sym_node_t* table_sym; 00959 sel_node_t* sel_node; 00960 plan_t* plan; 00961 00962 table_sym = node->table_sym; 00963 00964 pars_retrieve_table_def(table_sym); 00965 node->table = table_sym->table; 00966 00967 UT_LIST_INIT(node->columns); 00968 00969 /* Make the single table node into a list of table nodes of length 1 */ 00970 00971 que_node_list_add_last(NULL, table_sym); 00972 00973 if (cursor_sym) { 00974 pars_resolve_exp_variables_and_types(NULL, cursor_sym); 00975 00976 sel_node = cursor_sym->alias->cursor_def; 00977 00978 node->searched_update = FALSE; 00979 } else { 00980 sel_node = pars_select_list(NULL, NULL); 00981 00982 pars_select_statement(sel_node, table_sym, search_cond, NULL, 00983 &pars_share_token, NULL); 00984 node->searched_update = TRUE; 00985 sel_node->common.parent = node; 00986 } 00987 00988 node->select = sel_node; 00989 00990 ut_a(!node->is_delete || (node->col_assign_list == NULL)); 00991 ut_a(node->is_delete || (node->col_assign_list != NULL)); 00992 00993 if (node->is_delete) { 00994 node->cmpl_info = 0; 00995 } else { 00996 pars_process_assign_list(node); 00997 } 00998 00999 if (node->searched_update) { 01000 node->has_clust_rec_x_lock = TRUE; 01001 sel_node->set_x_locks = TRUE; 01002 sel_node->row_lock_mode = LOCK_X; 01003 } else { 01004 node->has_clust_rec_x_lock = sel_node->set_x_locks; 01005 } 01006 01007 ut_a(sel_node->n_tables == 1); 01008 ut_a(sel_node->consistent_read == FALSE); 01009 ut_a(sel_node->order_by == NULL); 01010 ut_a(sel_node->is_aggregate == FALSE); 01011 01012 sel_node->can_get_updated = TRUE; 01013 01014 node->state = UPD_NODE_UPDATE_CLUSTERED; 01015 01016 plan = sel_node_get_nth_plan(sel_node, 0); 01017 01018 plan->no_prefetch = TRUE; 01019 01020 if (!((plan->index)->type & DICT_CLUSTERED)) { 01021 01022 plan->must_get_clust = TRUE; 01023 01024 node->pcur = &(plan->clust_pcur); 01025 } else { 01026 node->pcur = &(plan->pcur); 01027 } 01028 01029 if (!node->is_delete && node->searched_update 01030 && (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE) 01031 && (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { 01032 01033 /* The select node can perform the update in-place */ 01034 01035 ut_a(plan->asc); 01036 01037 node->select_will_do_update = TRUE; 01038 sel_node->select_will_do_update = TRUE; 01039 sel_node->latch_mode = BTR_MODIFY_LEAF; 01040 } 01041 01042 return(node); 01043 }
Here is the call graph for this function:

Here is the caller graph for this function:

| upd_node_t* pars_update_statement_start | ( | ibool | is_delete, | |
| sym_node_t * | table_sym, | |||
| col_assign_node_t * | col_assign_list | |||
| ) |
Definition at line 818 of file pars0pars.c.
References upd_node_struct::col_assign_list, sym_tab_struct::heap, upd_node_struct::is_delete, pars_sym_tab_global, upd_node_struct::table_sym, and upd_node_create().
Referenced by yyparse().
00820 : update node in a query 00821 tree */ 00822 ibool is_delete, /* in: TRUE if delete */ 00823 sym_node_t* table_sym, /* in: table name node */ 00824 col_assign_node_t* col_assign_list)/* in: column assignment list, NULL 00825 if delete */ 00826 { 00827 upd_node_t* node; 00828 00829 node = upd_node_create(pars_sym_tab_global->heap); 00830 00831 node->is_delete = is_delete; 00832 00833 node->table_sym = table_sym; 00834 node->col_assign_list = col_assign_list; 00835 00836 return(node); 00837 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sym_node_t* pars_variable_declaration | ( | sym_node_t * | node, | |
| pars_res_word_t * | type | |||
| ) |
Definition at line 1157 of file pars0pars.c.
References FALSE, sym_node_struct::param_type, PARS_NOT_PARAM, pars_set_dfield_type(), que_node_get_val(), sym_node_struct::resolved, SYM_VAR, sym_node_struct::token_type, and TRUE.
Referenced by pars_parameter_declaration(), and yyparse().
01159 : symbol table node of type 01160 SYM_VAR */ 01161 sym_node_t* node, /* in: symbol table node allocated for the 01162 id of the variable */ 01163 pars_res_word_t* type) /* in: pointer to a type token */ 01164 { 01165 node->resolved = TRUE; 01166 node->token_type = SYM_VAR; 01167 01168 node->param_type = PARS_NOT_PARAM; 01169 01170 pars_set_dfield_type(que_node_get_val(node), type, 0, FALSE, FALSE); 01171 01172 return(node); 01173 }
Here is the call graph for this function:

Here is the caller graph for this function:

| while_node_t* pars_while_statement | ( | que_node_t * | cond, | |
| que_node_t * | stat_list | |||
| ) |
Definition at line 1299 of file pars0pars.c.
References while_node_struct::common, while_node_struct::cond, sym_tab_struct::heap, mem_heap_alloc(), NULL, pars_resolve_exp_variables_and_types(), pars_set_parent_in_list(), pars_sym_tab_global, QUE_NODE_WHILE, while_node_struct::stat_list, and que_common_struct::type.
Referenced by yyparse().
01301 : while-statement node */ 01302 que_node_t* cond, /* in: while-condition */ 01303 que_node_t* stat_list) /* in: statement list */ 01304 { 01305 while_node_t* node; 01306 01307 node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(while_node_t)); 01308 01309 node->common.type = QUE_NODE_WHILE; 01310 01311 node->cond = cond; 01312 01313 pars_resolve_exp_variables_and_types(NULL, cond); 01314 01315 node->stat_list = stat_list; 01316 01317 pars_set_parent_in_list(stat_list, node); 01318 01319 return(node); 01320 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void yyerror | ( | const char *s | __attribute__((unused)) | ) |
| pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN} |
| pars_res_word_t pars_assert_token = {PARS_ASSERT_TOKEN} |
| pars_res_word_t pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN} |
| pars_res_word_t pars_binary_token = {PARS_BINARY_TOKEN} |
| pars_res_word_t pars_blob_token = {PARS_BLOB_TOKEN} |
| pars_res_word_t pars_char_token = {PARS_CHAR_TOKEN} |
| pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN} |
Definition at line 74 of file pars0pars.c.
| pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN} |
| pars_res_word_t pars_concat_token = {PARS_CONCAT_TOKEN} |
| pars_res_word_t pars_count_token = {PARS_COUNT_TOKEN} |
| pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN} |
| pars_res_word_t pars_distinct_token = {PARS_DISTINCT_TOKEN} |
| pars_res_word_t pars_float_token = {PARS_FLOAT_TOKEN} |
Definition at line 69 of file pars0pars.c.
| pars_res_word_t pars_instr_token = {PARS_INSTR_TOKEN} |
| pars_res_word_t pars_int_token = {PARS_INT_TOKEN} |
| pars_res_word_t pars_length_token = {PARS_LENGTH_TOKEN} |
| pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN} |
Definition at line 73 of file pars0pars.c.
| pars_res_word_t pars_printf_token = {PARS_PRINTF_TOKEN} |
| pars_res_word_t pars_replstr_token = {PARS_REPLSTR_TOKEN} |
| pars_res_word_t pars_rnd_str_token = {PARS_RND_STR_TOKEN} |
| pars_res_word_t pars_rnd_token = {PARS_RND_TOKEN} |
| pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN} |
| ulint pars_star_denoter = PARS_STAR_DENOTER |
| pars_res_word_t pars_substr_token = {PARS_SUBSTR_TOKEN} |
| pars_res_word_t pars_sum_token = {PARS_SUM_TOKEN} |
Definition at line 43 of file pars0pars.c.
Referenced by opt_clust_access(), opt_search_plan(), opt_search_plan_for_table(), pars_assignment_statement(), pars_column_assignment(), pars_commit_statement(), pars_create_index(), pars_create_table(), pars_elsif_element(), pars_exit_statement(), pars_fetch_statement(), pars_for_statement(), pars_func_low(), pars_function_declaration(), pars_get_lex_chars(), pars_if_statement(), pars_insert_statement(), pars_open_statement(), pars_order_by(), pars_procedure_definition(), pars_process_assign_list(), pars_resolve_exp_variables_and_types(), pars_return_statement(), pars_rollback_statement(), pars_row_printf_statement(), pars_select_all_columns(), pars_select_list(), pars_sql(), pars_update_statement_start(), pars_while_statement(), and yyparse().
| pars_res_word_t pars_sysdate_token = {PARS_SYSDATE_TOKEN} |
| pars_res_word_t pars_to_binary_token = {PARS_TO_BINARY_TOKEN} |
| pars_res_word_t pars_to_char_token = {PARS_TO_CHAR_TOKEN} |
| pars_res_word_t pars_to_number_token = {PARS_TO_NUMBER_TOKEN} |
| pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN} |
| pars_res_word_t pars_update_token = {PARS_UPDATE_TOKEN} |
1.4.7

