diff options
Diffstat (limited to 'sql/sql_yacc_ora.yy')
-rw-r--r-- | sql/sql_yacc_ora.yy | 468 |
1 files changed, 241 insertions, 227 deletions
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index aa76dabff1f..77ced40ed5f 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -168,7 +168,7 @@ void ORAerror(THD *thd, const char *s) uint sp_instr_addr; /* structs */ - LEX_STRING lex_str; + LEX_CSTRING lex_str; LEX_SYMBOL symbol; Lex_string_with_metadata_st lex_string_with_metadata; struct sys_var_with_base variable; @@ -183,7 +183,7 @@ void ORAerror(THD *thd, const char *s) Lex_for_loop_bounds_st for_loop_bounds; struct { - LEX_STRING name; + LEX_CSTRING name; uint offset; } sp_cursor_name_and_offset; @@ -202,7 +202,7 @@ void ORAerror(THD *thd, const char *s) LEX *lex; sp_assignment_lex *assignment_lex; class sp_lex_cursor *sp_cursor_stmt; - LEX_STRING *lex_str_ptr; + LEX_CSTRING *lex_str_ptr; LEX_USER *lex_user; List<Condition_information_item> *cond_info_list; List<DYNCALL_CREATE_DEF> *dyncol_def_list; @@ -210,7 +210,7 @@ void ORAerror(THD *thd, const char *s) List<sp_assignment_lex> *sp_assignment_lex_list; List<Statement_information_item> *stmt_info_list; List<String> *string_list; - List<LEX_STRING> *lex_str_list; + List<LEX_CSTRING> *lex_str_list; Statement_information_item *stmt_info_item; String *string; TABLE_LIST *table_list; @@ -1024,7 +1024,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); label_declaration_oracle labels_declaration_oracle ident_directly_assignable sp_decl_ident - sp_block_label + sp_block_label opt_place opt_db %type <lex_string_with_metadata> TEXT_STRING @@ -1045,15 +1045,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); optionally_qualified_column_ident %type <simple_string> - remember_name remember_end opt_db remember_tok_start + remember_name remember_end remember_tok_start wild_and_where - field_length opt_field_length opt_field_length_default_1 colon_with_pos - opt_field_length_default_sp_param_char - opt_field_length_default_sp_param_varchar %type <const_simple_string> - opt_place + field_length opt_field_length opt_field_length_default_1 + opt_field_length_default_sp_param_varchar + opt_field_length_default_sp_param_char %type <string> text_string hex_or_bin_String opt_gconcat_separator @@ -1864,7 +1863,7 @@ optional_connection_name: /* empty */ { LEX *lex= thd->lex; - lex->mi.connection_name= null_lex_str; + lex->mi.connection_name= null_clex_str; } | connection_name ; @@ -1900,7 +1899,7 @@ create: */ lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; lex->create_info.default_table_charset= NULL; - lex->name= null_lex_str; + lex->name= null_clex_str; lex->create_last_non_select_table= lex->last_table(); } create_body @@ -1938,7 +1937,7 @@ create: */ lex->alter_info.reset(); lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; - lex->name= null_lex_str; + lex->name= null_clex_str; lex->create_last_non_select_table= lex->last_table(); if (!(lex->create_info.seq_create_info= new (thd->mem_root) sequence_definition())) @@ -1983,7 +1982,7 @@ create: { if (Lex->add_create_index_prepare($8)) MYSQL_YYABORT; - if (Lex->add_create_index($2, $5, $6, $1 | $4)) + if (Lex->add_create_index($2, &$5, $6, $1 | $4)) MYSQL_YYABORT; } '(' key_list ')' normal_key_options @@ -1993,7 +1992,7 @@ create: { if (Lex->add_create_index_prepare($7)) MYSQL_YYABORT; - if (Lex->add_create_index($2, $5, HA_KEY_ALG_UNDEF, $1 | $4)) + if (Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, $1 | $4)) MYSQL_YYABORT; } '(' key_list ')' fulltext_key_options @@ -2003,7 +2002,7 @@ create: { if (Lex->add_create_index_prepare($7)) MYSQL_YYABORT; - if (Lex->add_create_index($2, $5, HA_KEY_ALG_UNDEF, $1 | $4)) + if (Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, $1 | $4)) MYSQL_YYABORT; } '(' key_list ')' spatial_key_options @@ -2150,7 +2149,8 @@ server_option: { MYSQL_YYABORT_UNLESS(Lex->server_options.host.str == 0); Lex->server_options.host= $2; - my_casedn_str(system_charset_info, Lex->server_options.host.str); + my_casedn_str(system_charset_info, + (char*) Lex->server_options.host.str); } | DATABASE TEXT_STRING_sys { @@ -2353,12 +2353,12 @@ clear_privileges: sp_name: ident '.' ident { - if (!($$= Lex->make_sp_name(thd, $1, $3))) + if (!($$= Lex->make_sp_name(thd, &$1, &$3))) MYSQL_YYABORT; } | ident { - if (!($$= Lex->make_sp_name(thd, $1))) + if (!($$= Lex->make_sp_name(thd, &$1))) MYSQL_YYABORT; } ; @@ -2462,7 +2462,7 @@ sp_fdparams: sp_param_name: ident { - if (!($$= Lex->sp_param_init($1))) + if (!($$= Lex->sp_param_init(&$1))) MYSQL_YYABORT; } ; @@ -2480,7 +2480,7 @@ sp_param_name_and_type: | sp_param_name field_type_row { $$= $1; - $$->field_def.field_name= $$->name.str; + $$->field_def.field_name= $$->name; Lex->sphead->fill_spvar_definition(thd, &$$->field_def); Lex->sphead->row_fill_field_definitions(thd, $2); $$->field_def.set_row_field_definitions($2); @@ -2512,7 +2512,7 @@ sp_pdparam: | sp_param_name sp_opt_inout field_type_row { $1->mode= $2; - $1->field_def.field_name= $1->name.str; + $1->field_def.field_name= $1->name; Lex->sphead->fill_spvar_definition(thd, &$1->field_def); Lex->sphead->row_fill_field_definitions(thd, $3); $1->field_def.set_row_field_definitions($3); @@ -2635,13 +2635,13 @@ opt_sp_decl_handler_list: qualified_column_ident: sp_decl_ident '.' ident { - if (!($$= new (thd->mem_root) Qualified_column_ident($1, $3))) + if (!($$= new (thd->mem_root) Qualified_column_ident(&$1, &$3))) MYSQL_YYABORT; } | sp_decl_ident '.' ident '.' ident { if (!($$= new (thd->mem_root) Qualified_column_ident(thd, - $1, $3, $5))) + &$1, &$3, &$5))) MYSQL_YYABORT; } ; @@ -2649,18 +2649,18 @@ qualified_column_ident: optionally_qualified_column_ident: sp_decl_ident { - if (!($$= new (thd->mem_root) Qualified_column_ident($1))) + if (!($$= new (thd->mem_root) Qualified_column_ident(&$1))) MYSQL_YYABORT; } | sp_decl_ident '.' ident { - if (!($$= new (thd->mem_root) Qualified_column_ident($1, $3))) + if (!($$= new (thd->mem_root) Qualified_column_ident(&$1, &$3))) MYSQL_YYABORT; } | sp_decl_ident '.' ident '.' ident { if (!($$= new (thd->mem_root) Qualified_column_ident(thd, - $1, $3, $5))) + &$1, &$3, &$5))) MYSQL_YYABORT; } ; @@ -2673,7 +2673,7 @@ row_field_name: my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str)); if (!($$= new (thd->mem_root) Spvar_definition())) MYSQL_YYABORT; - Lex->init_last_field($$, $1.str, thd->variables.collation_database); + Lex->init_last_field($$, &$1, thd->variables.collation_database); } ; @@ -2691,8 +2691,8 @@ row_field_definition_list: | row_field_definition_list ',' row_field_definition { uint unused; - if ($1->find_row_field_by_name($3->field_name, &unused)) - my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name)); + if ($1->find_row_field_by_name(&$3->field_name, &unused)) + my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name.str)); $$= $1; $$->push_back($3, thd->mem_root); } @@ -2746,7 +2746,7 @@ sp_decl_non_handler: } | ident_directly_assignable CONDITION_SYM FOR_SYM sp_cond { - if (Lex->spcont->declare_condition(thd, $1, $4)) + if (Lex->spcont->declare_condition(thd, &$1, $4)) MYSQL_YYABORT; $$.vars= $$.hndlrs= $$.curs= 0; $$.conds= 1; @@ -2756,7 +2756,7 @@ sp_decl_non_handler: sp_condition_value *spcond= new (thd->mem_root) sp_condition_value_user_defined(); if (!spcond || - Lex->spcont->declare_condition(thd, $1, spcond)) + Lex->spcont->declare_condition(thd, &$1, spcond)) MYSQL_YYABORT; $$.vars= $$.hndlrs= $$.curs= 0; $$.conds= 1; @@ -2771,7 +2771,7 @@ sp_decl_non_handler: sp_pcontext *param_ctx= Lex->spcont; if (Lex->sp_block_finalize(thd)) MYSQL_YYABORT; - if (Lex->sp_declare_cursor(thd, $2, $6, param_ctx, false)) + if (Lex->sp_declare_cursor(thd, &$2, $6, param_ctx, false)) MYSQL_YYABORT; $$.vars= $$.conds= $$.hndlrs= 0; $$.curs= 1; @@ -2894,7 +2894,7 @@ sp_hcond: } | ident /* CONDITION name */ { - $$= Lex->spcont->find_declared_or_predefined_condition($1); + $$= Lex->spcont->find_declared_or_predefined_condition(&$1); if ($$ == NULL) my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); } @@ -2949,7 +2949,7 @@ signal_value: /* SIGNAL foo cannot be used outside of stored programs */ if (lex->spcont == NULL) my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); - cond= lex->spcont->find_declared_or_predefined_condition($1); + cond= lex->spcont->find_declared_or_predefined_condition(&$1); if (cond == NULL) my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); if (!cond->has_sql_state()) @@ -3125,7 +3125,7 @@ simple_target_specification: ident { Lex_input_stream *lip= &thd->m_parser_state->m_lip; - $$= thd->lex->create_item_for_sp_var($1, NULL, + $$= thd->lex->create_item_for_sp_var(&$1, NULL, lip->get_tok_start(), lip->get_ptr()); if ($$ == NULL) @@ -3133,7 +3133,7 @@ simple_target_specification: } | '@' ident_or_text { - $$= new (thd->mem_root) Item_func_get_user_var(thd, $2); + $$= new (thd->mem_root) Item_func_get_user_var(thd, &$2); if ($$ == NULL) MYSQL_YYABORT; } @@ -3232,9 +3232,9 @@ sp_decl_idents: LEX *lex= Lex; sp_pcontext *spc= lex->spcont; - if (spc->find_variable($1, TRUE)) + if (spc->find_variable(&$1, TRUE)) my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $1.str)); - spc->add_variable(thd, $1); + spc->add_variable(thd, &$1); $$= 1; } | sp_decl_idents ',' ident @@ -3244,9 +3244,9 @@ sp_decl_idents: LEX *lex= Lex; sp_pcontext *spc= lex->spcont; - if (spc->find_variable($3, TRUE)) + if (spc->find_variable(&$3, TRUE)) my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $3.str)); - spc->add_variable(thd, $3); + spc->add_variable(thd, &$3); $$= $1 + 1; } ; @@ -3306,7 +3306,7 @@ sp_statement: { // Direct procedure call (without the CALL keyword) LEX *lex = Lex; - if (!(lex->spname= lex->make_sp_name(thd, $1))) + if (!(lex->spname= lex->make_sp_name(thd, &$1))) MYSQL_YYABORT; lex->sql_command= SQLCOM_CALL; lex->value_list.empty(); @@ -3316,7 +3316,7 @@ sp_statement: | ident_directly_assignable '.' ident { LEX *lex = Lex; - if (!(lex->spname= lex->make_sp_name(thd, $1, $3))) + if (!(lex->spname= lex->make_sp_name(thd, &$1, &$3))) MYSQL_YYABORT; lex->sql_command= SQLCOM_CALL; lex->value_list.empty(); @@ -3430,7 +3430,7 @@ sp_proc_stmt_exit: } | EXIT_SYM label_ident { - if (Lex->sp_exit_statement(thd, $2, NULL)) + if (Lex->sp_exit_statement(thd, &$2, NULL)) MYSQL_YYABORT; } | EXIT_SYM WHEN_SYM reset_lex_expr @@ -3441,7 +3441,7 @@ sp_proc_stmt_exit: } | EXIT_SYM label_ident WHEN_SYM reset_lex_expr { - if (Lex->sp_exit_statement(thd, $2, $4) || + if (Lex->sp_exit_statement(thd, &$2, $4) || Lex->sphead->restore_lex(thd)) MYSQL_YYABORT; } @@ -3455,7 +3455,7 @@ sp_proc_stmt_continue: } | CONTINUE_SYM label_ident { - if (Lex->sp_continue_statement(thd, $2, NULL)) + if (Lex->sp_continue_statement(thd, &$2, NULL)) MYSQL_YYABORT; } | CONTINUE_SYM WHEN_SYM reset_lex_expr @@ -3466,7 +3466,7 @@ sp_proc_stmt_continue: } | CONTINUE_SYM label_ident WHEN_SYM reset_lex_expr { - if (Lex->sp_continue_statement(thd, $2, $4) || + if (Lex->sp_continue_statement(thd, &$2, $4) || Lex->sphead->restore_lex(thd)) MYSQL_YYABORT; } @@ -3476,7 +3476,7 @@ sp_proc_stmt_continue: sp_proc_stmt_leave: LEAVE_SYM label_ident { - if (Lex->sp_leave_statement(thd, $2)) + if (Lex->sp_leave_statement(thd, &$2)) MYSQL_YYABORT; } ; @@ -3484,7 +3484,7 @@ sp_proc_stmt_leave: sp_proc_stmt_iterate: ITERATE_SYM label_ident { - if (Lex->sp_iterate_statement(thd, $2)) + if (Lex->sp_iterate_statement(thd, &$2)) MYSQL_YYABORT; } ; @@ -3492,7 +3492,7 @@ sp_proc_stmt_iterate: sp_proc_stmt_goto: GOTO_SYM label_ident { - if (Lex->sp_goto_statement(thd, $2)) + if (Lex->sp_goto_statement(thd, &$2)) MYSQL_YYABORT; } ; @@ -3562,7 +3562,7 @@ opt_parenthesized_cursor_actual_parameters: sp_proc_stmt_open: OPEN_SYM ident opt_parenthesized_cursor_actual_parameters { - if (Lex->sp_open_cursor(thd, $2, $3)) + if (Lex->sp_open_cursor(thd, &$2, $3)) MYSQL_YYABORT; } ; @@ -3570,17 +3570,17 @@ sp_proc_stmt_open: sp_proc_stmt_fetch_head: FETCH_SYM ident INTO { - if (Lex->sp_add_cfetch(thd, $2)) + if (Lex->sp_add_cfetch(thd, &$2)) MYSQL_YYABORT; } | FETCH_SYM FROM ident INTO { - if (Lex->sp_add_cfetch(thd, $3)) + if (Lex->sp_add_cfetch(thd, &$3)) MYSQL_YYABORT; } | FETCH_SYM NEXT_SYM FROM ident INTO { - if (Lex->sp_add_cfetch(thd, $4)) + if (Lex->sp_add_cfetch(thd, &$4)) MYSQL_YYABORT; } ; @@ -3597,7 +3597,7 @@ sp_proc_stmt_close: uint offset; sp_instr_cclose *i; - if (! lex->spcont->find_cursor($2, &offset, false)) + if (! lex->spcont->find_cursor(&$2, &offset, false)) my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str)); i= new (thd->mem_root) sp_instr_cclose(sp->instructions(), lex->spcont, offset); @@ -3615,7 +3615,7 @@ sp_fetch_list: sp_pcontext *spc= lex->spcont; sp_variable *spv; - if (!spc || !(spv = spc->find_variable($1, false))) + if (!spc || !(spv = spc->find_variable(&$1, false))) my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str)); /* An SP local variable */ @@ -3629,7 +3629,7 @@ sp_fetch_list: sp_pcontext *spc= lex->spcont; sp_variable *spv; - if (!spc || !(spv = spc->find_variable($3, false))) + if (!spc || !(spv = spc->find_variable(&$3, false))) my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str)); /* An SP local variable */ @@ -3649,7 +3649,7 @@ sp_if: sp_instr_jump_if_not *i= new (thd->mem_root) sp_instr_jump_if_not(ip, ctx, $2, lex); if (i == NULL || - sp->push_backpatch(thd, i, ctx->push_label(thd, empty_lex_str, 0)) || + sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0)) || sp->add_cont_backpatch(i) || sp->add_instr(i)) MYSQL_YYABORT; @@ -3666,7 +3666,7 @@ sp_if: sp->add_instr(i)) MYSQL_YYABORT; sp->backpatch(ctx->pop_label()); - sp->push_backpatch(thd, i, ctx->push_label(thd, empty_lex_str, 0)); + sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0)); } sp_elseifs { @@ -3731,7 +3731,7 @@ case_stmt_specification: BACKPATCH: Creating target label for the jump to after END CASE (instruction 12 in the example) */ - Lex->spcont->push_label(thd, empty_lex_str, Lex->sphead->instructions()); + Lex->spcont->push_label(thd, &empty_clex_str, Lex->sphead->instructions()); } case_stmt_body else_clause_opt @@ -3840,14 +3840,14 @@ else_clause_opt: ; sp_opt_label: - /* Empty */ { $$= null_lex_str; } + /* Empty */ { $$= null_clex_str; } | label_ident { $$= $1; } ; sp_block_label: labels_declaration_oracle { - if (Lex->spcont->block_label_declare($1)) + if (Lex->spcont->block_label_declare(&$1)) MYSQL_YYABORT; $$= $1; } @@ -3857,7 +3857,7 @@ sp_labeled_block: sp_block_label BEGIN_SYM { - Lex->sp_block_init(thd, $1); + Lex->sp_block_init(thd, &$1); if (Lex->sp_block_with_exceptions_finalize_declarations(thd)) MYSQL_YYABORT; } @@ -3865,13 +3865,13 @@ sp_labeled_block: END sp_opt_label { - if (Lex->sp_block_finalize(thd, Lex_spblock($4), $6)) + if (Lex->sp_block_finalize(thd, Lex_spblock($4), &$6)) MYSQL_YYABORT; } | sp_block_label DECLARE_SYM { - Lex->sp_block_init(thd, $1); + Lex->sp_block_init(thd, &$1); } sp_decl_body_list { @@ -3884,7 +3884,7 @@ sp_labeled_block: sp_opt_label { $4.hndlrs+= $7.hndlrs; - if (Lex->sp_block_finalize(thd, $4, $9)) + if (Lex->sp_block_finalize(thd, $4, &$9)) MYSQL_YYABORT; } ; @@ -4003,7 +4003,7 @@ opt_sp_for_loop_direction: sp_for_loop_index_and_bounds: ident_directly_assignable sp_for_loop_bounds { - if (Lex->sp_for_loop_declarations(thd, &$$, $1, $2)) + if (Lex->sp_for_loop_declarations(thd, &$$, &$1, $2)) MYSQL_YYABORT; } ; @@ -4028,8 +4028,8 @@ sp_for_loop_bounds: { Item *item; DBUG_ASSERT(Lex->sphead); - LEX_STRING name= {C_STRING_WITH_LEN("[implicit_cursor]") }; - if (Lex->sp_declare_cursor(thd, name, $4, NULL, true)) + LEX_CSTRING name= {STRING_WITH_LEN("[implicit_cursor]") }; + if (Lex->sp_declare_cursor(thd, &name, $4, NULL, true)) MYSQL_YYABORT; if (!($$.m_index= new (thd->mem_root) sp_assignment_lex(thd, thd->lex))) MYSQL_YYABORT; @@ -4037,7 +4037,7 @@ sp_for_loop_bounds: Lex->sphead->reset_lex(thd, $$.m_index); if (!(item= new (thd->mem_root) Item_field(thd, Lex->current_context(), - NullS, NullS, name.str))) + NullS, NullS, &name))) MYSQL_YYABORT; $$.m_index->set_item_and_free_list(item, NULL); if (Lex->sphead->restore_lex(thd)) @@ -4101,7 +4101,7 @@ repeat_body: pop_sp_loop_label: sp_opt_label { - if (Lex->sp_pop_loop_label(thd, $1)) + if (Lex->sp_pop_loop_label(thd, &$1)) MYSQL_YYABORT; } ; @@ -4109,14 +4109,14 @@ pop_sp_loop_label: sp_labeled_control: labels_declaration_oracle LOOP_SYM { - if (Lex->sp_push_loop_label(thd, $1)) + if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; } loop_body pop_sp_loop_label { } | labels_declaration_oracle WHILE_SYM { - if (Lex->sp_push_loop_label(thd, $1)) + if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; Lex->sphead->reset_lex(thd); } @@ -4129,7 +4129,7 @@ sp_labeled_control: } sp_for_loop_index_and_bounds { - if (Lex->sp_push_loop_label(thd, $1)) // The inner WHILE block + if (Lex->sp_push_loop_label(thd, &$1)) // The inner WHILE block MYSQL_YYABORT; if (Lex->sp_for_loop_condition_test(thd, $4)) MYSQL_YYABORT; @@ -4150,7 +4150,7 @@ sp_labeled_control: } | labels_declaration_oracle REPEAT_SYM { - if (Lex->sp_push_loop_label(thd, $1)) + if (Lex->sp_push_loop_label(thd, &$1)) MYSQL_YYABORT; } repeat_body pop_sp_loop_label @@ -4568,11 +4568,11 @@ size_number: ulonglong number; uint text_shift_number= 0; longlong prefix_number; - char *start_ptr= $1.str; + const char *start_ptr= $1.str; uint str_len= $1.length; - char *end_ptr= start_ptr + str_len; + const char *end_ptr= start_ptr + str_len; int error; - prefix_number= my_strtoll10(start_ptr, &end_ptr, &error); + prefix_number= my_strtoll10(start_ptr, (char**) &end_ptr, &error); if ((start_ptr + str_len - 1) == end_ptr) { switch (end_ptr[0]) @@ -4726,7 +4726,7 @@ have_partitioning: /* empty */ { #ifdef WITH_PARTITION_STORAGE_ENGINE - LEX_STRING partition_name={C_STRING_WITH_LEN("partition")}; + LEX_CSTRING partition_name={STRING_WITH_LEN("partition")}; if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN)) my_yyabort_error((ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-partition")); @@ -5834,28 +5834,28 @@ key_def: key_or_index opt_if_not_exists opt_ident opt_USING_key_algorithm { Lex->option_list= NULL; - if (Lex->add_key(Key::MULTIPLE, $3, $4, $2)) + if (Lex->add_key(Key::MULTIPLE, &$3, $4, $2)) MYSQL_YYABORT; } '(' key_list ')' normal_key_options { } | key_or_index opt_if_not_exists ident TYPE_SYM btree_or_rtree { Lex->option_list= NULL; - if (Lex->add_key(Key::MULTIPLE, $3, $5, $2)) + if (Lex->add_key(Key::MULTIPLE, &$3, $5, $2)) MYSQL_YYABORT; } '(' key_list ')' normal_key_options { } | fulltext opt_key_or_index opt_if_not_exists opt_ident { Lex->option_list= NULL; - if (Lex->add_key($1, $4, HA_KEY_ALG_UNDEF, $3)) + if (Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3)) MYSQL_YYABORT; } '(' key_list ')' fulltext_key_options { } | spatial opt_key_or_index opt_if_not_exists opt_ident { Lex->option_list= NULL; - if (Lex->add_key($1, $4, HA_KEY_ALG_UNDEF, $3)) + if (Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3)) MYSQL_YYABORT; } '(' key_list ')' spatial_key_options { } @@ -5864,7 +5864,7 @@ key_def: opt_USING_key_algorithm { Lex->option_list= NULL; - if (Lex->add_key($2, $4.str ? $4 : $1, $5, $3)) + if (Lex->add_key($2, $4.str ? &$4 : &$1, $5, $3)) MYSQL_YYABORT; } '(' key_list ')' normal_key_options { } @@ -5872,7 +5872,7 @@ key_def: TYPE_SYM btree_or_rtree { Lex->option_list= NULL; - if (Lex->add_key($2, $4.str ? $4 : $1, $6, $3)) + if (Lex->add_key($2, $4.str ? &$4 : &$1, $6, $3)) MYSQL_YYABORT; } '(' key_list ')' normal_key_options { } @@ -5880,7 +5880,7 @@ key_def: { if (Lex->check_add_key($4) || !(Lex->last_key= (new (thd->mem_root) - Key(Key::MULTIPLE, $1.str ? $1 : $5, + Key(Key::MULTIPLE, $1.str ? &$1 : &$5, HA_KEY_ALG_UNDEF, true, $4)))) MYSQL_YYABORT; Lex->option_list= NULL; @@ -5889,11 +5889,11 @@ key_def: { LEX *lex=Lex; Key *key= (new (thd->mem_root) - Foreign_key($5.str ? $5 : $1, - lex->last_key->columns, - $10->db, - $10->table, - lex->ref_list, + Foreign_key($5.str ? &$5 : &$1, + &lex->last_key->columns, + &$10->db, + &$10->table, + &lex->ref_list, lex->fk_delete_opt, lex->fk_update_opt, lex->fk_match_option, @@ -5939,7 +5939,7 @@ check_constraint: ; opt_constraint: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | constraint { $$= $1; } ; @@ -5960,7 +5960,7 @@ field_spec: if (!f) MYSQL_YYABORT; - lex->init_last_field(f, $1.str, NULL); + lex->init_last_field(f, &$1, NULL); $<create_field>$= f; } field_type_or_serial opt_check_constraint @@ -6156,7 +6156,7 @@ field_type_numeric: ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err); if (err || tmp_length > PRECISION_FOR_DOUBLE) my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0), - Lex->last_field->field_name)); + Lex->last_field->field_name.str)); if (tmp_length > PRECISION_FOR_FLOAT) $$.set(MYSQL_TYPE_DOUBLE); else @@ -6810,14 +6810,14 @@ opt_ref_list: ref_list: ref_list ',' ident { - Key_part_spec *key= new (thd->mem_root) Key_part_spec($3, 0); + Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$3, 0); if (key == NULL) MYSQL_YYABORT; Lex->ref_list.push_back(key, thd->mem_root); } | ident { - Key_part_spec *key= new (thd->mem_root) Key_part_spec($1, 0); + Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$1, 0); if (key == NULL) MYSQL_YYABORT; LEX *lex= Lex; @@ -7043,7 +7043,7 @@ key_list: key_part: ident { - $$= new (thd->mem_root) Key_part_spec($1, 0); + $$= new (thd->mem_root) Key_part_spec(&$1, 0); if ($$ == NULL) MYSQL_YYABORT; } @@ -7052,19 +7052,19 @@ key_part: int key_part_len= atoi($3.str); if (!key_part_len) my_yyabort_error((ER_KEY_PART_0, MYF(0), $1.str)); - $$= new (thd->mem_root) Key_part_spec($1, (uint) key_part_len); + $$= new (thd->mem_root) Key_part_spec(&$1, (uint) key_part_len); if ($$ == NULL) MYSQL_YYABORT; } ; opt_ident: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | field_ident { $$= $1; } ; opt_component: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | '.' ident { $$= $2; } ; @@ -7081,7 +7081,7 @@ string_list: alter: ALTER { - Lex->name= null_lex_str; + Lex->name= null_clex_str; Lex->table_type= TABLE_TYPE_UNKNOWN; Lex->sql_command= SQLCOM_ALTER_TABLE; Lex->duplicates= DUP_ERROR; @@ -7287,7 +7287,7 @@ opt_ev_sql_stmt: ; ident_or_empty: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | ident { $$= $1; } ; @@ -7572,7 +7572,7 @@ alter_list_item: { Lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN; Lex->create_last_non_select_table= Lex->last_table(); - $5->change= $4.str; + $5->change= $4; $5->after= $6; } | MODIFY_SYM opt_column opt_if_exists_table_element @@ -7677,7 +7677,7 @@ alter_list_item: MYSQL_YYABORT; } if (check_table_name($3->table.str,$3->table.length, FALSE) || - ($3->db.str && check_db_name(&$3->db))) + ($3->db.str && check_db_name((LEX_STRING*) &$3->db))) my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str)); lex->name= $3->table; lex->alter_info.flags|= Alter_info::ALTER_RENAME; @@ -7792,15 +7792,16 @@ opt_restrict: ; opt_place: - /* empty */ { $$= NULL; } + /* empty */ { $$= null_clex_str; } | AFTER_SYM ident { - $$= $2.str; + $$= $2; Lex->alter_info.flags |= Alter_info::ALTER_COLUMN_ORDER; } | FIRST_SYM { - $$= first_keyword; + $$.str= first_keyword; + $$.length= 5; /* Length of "first" */ Lex->alter_info.flags |= Alter_info::ALTER_COLUMN_ORDER; } ; @@ -8674,7 +8675,7 @@ select_item_list: { Item *item= new (thd->mem_root) Item_field(thd, &thd->lex->current_select->context, - NULL, NULL, "*"); + NULL, NULL, &star_clex_str); if (item == NULL) MYSQL_YYABORT; if (add_item_to_list(thd, item)) @@ -8703,7 +8704,7 @@ select_item: $2->is_autogenerated_name= FALSE; $2->set_name(thd, $4.str, $4.length, system_charset_info); } - else if (!$2->name) + else if (!$2->name.str || $2->name.str == item_empty_name) { $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); } @@ -8736,7 +8737,7 @@ remember_end: ; select_alias: - /* empty */ { $$=null_lex_str;} + /* empty */ { $$=null_clex_str;} | AS ident { $$=$2; } | AS TEXT_STRING_sys { $$=$2; } | ident { $$=$1; } @@ -9247,7 +9248,7 @@ sp_cursor_name_and_offset: LEX *lex= Lex; $$.name= $1; if (!lex->spcont || - !lex->spcont->find_cursor($1, &$$.offset, false)) + !lex->spcont->find_cursor(&$1, &$$.offset, false)) my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $1.str)); } ; @@ -9256,25 +9257,25 @@ explicit_cursor_attr: sp_cursor_name_and_offset '%' ISOPEN_SYM { if (!($$= new (thd->mem_root) - Item_func_cursor_isopen(thd, $1.name, $1.offset))) + Item_func_cursor_isopen(thd, &$1.name, $1.offset))) MYSQL_YYABORT; } | sp_cursor_name_and_offset '%' FOUND_SYM { if (!($$= new (thd->mem_root) - Item_func_cursor_found(thd, $1.name, $1.offset))) + Item_func_cursor_found(thd, &$1.name, $1.offset))) MYSQL_YYABORT; } | sp_cursor_name_and_offset '%' NOTFOUND_SYM { if (!($$= new (thd->mem_root) - Item_func_cursor_notfound(thd, $1.name, $1.offset))) + Item_func_cursor_notfound(thd, &$1.name, $1.offset))) MYSQL_YYABORT; } | sp_cursor_name_and_offset '%' ROWCOUNT_SYM { if (!($$= new (thd->mem_root) - Item_func_cursor_rowcount(thd, $1.name, $1.offset))) + Item_func_cursor_rowcount(thd, &$1.name, $1.offset))) MYSQL_YYABORT; } ; @@ -10239,10 +10240,10 @@ function_call_generic: This will be revised with WL#2128 (SQL PATH) */ - builder= find_native_function_builder(thd, $1); + builder= find_native_function_builder(thd, &$1); if (builder) { - item= builder->create_func(thd, $1, $4); + item= builder->create_func(thd, &$1, $4); } else { @@ -10264,7 +10265,7 @@ function_call_generic: { builder= find_qualified_function_builder(thd); DBUG_ASSERT(builder); - item= builder->create_func(thd, $1, $4); + item= builder->create_func(thd, &$1, $4); } } @@ -10292,7 +10293,7 @@ function_call_generic: version() (a vendor can specify any schema). */ - if (!$1.str || check_db_name(&$1)) + if (!$1.str || check_db_name((LEX_STRING*) &$1)) my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str)); if (check_routine_name(&$3)) { @@ -10301,7 +10302,7 @@ function_call_generic: builder= find_qualified_function_builder(thd); DBUG_ASSERT(builder); - item= builder->create_with_db(thd, $1, $3, true, $5); + item= builder->create_with_db(thd, &$1, &$3, true, $5); if (! ($$= item)) { @@ -10653,7 +10654,7 @@ simple_window_func: window_name: ident { - $$= (LEX_STRING *) thd->memdup(&$1, sizeof(LEX_STRING)); + $$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); if ($$ == NULL) MYSQL_YYABORT; } @@ -10675,7 +10676,7 @@ variable_aux: ident_or_text SET_VAR expr { Item_func_set_user_var *item; - $$= item= new (thd->mem_root) Item_func_set_user_var(thd, $1, $3); + $$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3); if ($$ == NULL) MYSQL_YYABORT; LEX *lex= Lex; @@ -10684,7 +10685,7 @@ variable_aux: } | ident_or_text { - $$= new (thd->mem_root) Item_func_get_user_var(thd, $1); + $$= new (thd->mem_root) Item_func_get_user_var(thd, &$1); if ($$ == NULL) MYSQL_YYABORT; LEX *lex= Lex; @@ -11414,7 +11415,7 @@ key_usage_element: ident { Select->add_index_hint(thd, $1.str, $1.length); } | PRIMARY_SYM - { Select->add_index_hint(thd, (char *)"PRIMARY", 7); } + { Select->add_index_hint(thd, "PRIMARY", 7); } ; key_usage_list: @@ -11490,7 +11491,7 @@ opt_table_alias: /* empty */ { $$=0; } | table_alias ident { - $$= (LEX_STRING*) thd->memdup(&$2,sizeof(LEX_STRING)); + $$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING)); if ($$ == NULL) MYSQL_YYABORT; } @@ -11626,7 +11627,7 @@ window_def: if (Select->add_window_def(thd, $1, lex->win_ref, Select->group_list, Select->order_list, - lex->win_frame )) + lex->win_frame)) MYSQL_YYABORT; } ; @@ -11643,7 +11644,7 @@ opt_window_ref: /* empty */ {} | ident { - thd->lex->win_ref= (LEX_STRING *) thd->memdup(&$1, sizeof(LEX_STRING)); + thd->lex->win_ref= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); if (thd->lex->win_ref == NULL) MYSQL_YYABORT; } @@ -11911,7 +11912,7 @@ limit_option: { LEX *lex= thd->lex; Lex_input_stream *lip= & thd->m_parser_state->m_lip; - if (!($$= lex->create_item_limit(thd, $1, + if (!($$= lex->create_item_limit(thd, &$1, $1.m_pos - lex->substatement_query(thd), lip->get_tok_end() - $1.m_pos))) @@ -11921,7 +11922,7 @@ limit_option: { LEX *lex= thd->lex; Lex_input_stream *lip= & thd->m_parser_state->m_lip; - if (!($$= lex->create_item_limit(thd, $1, $3, + if (!($$= lex->create_item_limit(thd, &$1, &$3, $1.m_pos - lex->substatement_query(thd), lip->get_ptr() - $1.m_pos))) @@ -12046,7 +12047,7 @@ procedure_clause: lex->proc_list.next= &lex->proc_list.first; Item_field *item= new (thd->mem_root) Item_field(thd, &lex->current_select->context, - NULL, NULL, $2.str); + NULL, NULL, &$2); if (item == NULL) MYSQL_YYABORT; if (add_proc_to_list(thd, item)) @@ -12083,7 +12084,7 @@ procedure_item: { if (add_proc_to_list(thd, $2)) MYSQL_YYABORT; - if (!$2->name) + if (!$2->name.str || $2->name.str == item_empty_name) $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); } ; @@ -12126,22 +12127,22 @@ select_var_ident: select_outvar select_outvar: '@' ident_or_text { - $$ = Lex->result ? new (thd->mem_root) my_var_user($2) : NULL; + $$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL; } | ident_or_text { sp_variable *t; - if (!Lex->spcont || !(t= Lex->spcont->find_variable($1, false))) + if (!Lex->spcont || !(t= Lex->spcont->find_variable(&$1, false))) my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str)); $$ = Lex->result ? (new (thd->mem_root) - my_var_sp($1, t->offset, t->type_handler(), + my_var_sp(&$1, t->offset, t->type_handler(), Lex->sphead)) : NULL; } | ident '.' ident { - if (!($$= Lex->create_outvar(thd, $1, $3))) + if (!($$= Lex->create_outvar(thd, &$1, &$3))) MYSQL_YYABORT; } ; @@ -12241,12 +12242,12 @@ drop: { LEX *lex= thd->lex; sp_name *spname; - if ($4.str && check_db_name(&$4)) + if ($4.str && check_db_name((LEX_STRING*) &$4)) my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str)); if (lex->sphead) my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION")); lex->set_command(SQLCOM_DROP_FUNCTION, $3); - spname= new (thd->mem_root) sp_name($4, $6, true); + spname= new (thd->mem_root) sp_name(&$4, &$6, true); if (spname == NULL) MYSQL_YYABORT; lex->spname= spname; @@ -12254,14 +12255,14 @@ drop: | DROP FUNCTION_SYM opt_if_exists ident { LEX *lex= thd->lex; - LEX_STRING db= {0, 0}; + LEX_CSTRING db= {0, 0}; sp_name *spname; if (lex->sphead) my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION")); if (thd->db && lex->copy_db_to(&db.str, &db.length)) MYSQL_YYABORT; lex->set_command(SQLCOM_DROP_FUNCTION, $3); - spname= new (thd->mem_root) sp_name(db, $4, false); + spname= new (thd->mem_root) sp_name(&db, &$4, false); if (spname == NULL) MYSQL_YYABORT; lex->spname= spname; @@ -12745,7 +12746,7 @@ table_wild_list: table_wild_one: ident opt_wild { - Table_ident *ti= new (thd->mem_root) Table_ident($1); + Table_ident *ti= new (thd->mem_root) Table_ident(&$1); if (ti == NULL) MYSQL_YYABORT; if (!Select->add_table_to_list(thd, @@ -12758,7 +12759,7 @@ table_wild_one: } | ident '.' ident opt_wild { - Table_ident *ti= new (thd->mem_root) Table_ident(thd, $1, $3, 0); + Table_ident *ti= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); if (ti == NULL) MYSQL_YYABORT; if (!Select->add_table_to_list(thd, @@ -12886,7 +12887,7 @@ show: { LEX *lex=Lex; lex->wild=0; - lex->ident=null_lex_str; + lex->ident= null_clex_str; mysql_init_select(lex); lex->current_select->parsing_place= SELECT_LIST; lex->create_info.init(); @@ -12909,7 +12910,7 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_TABLES; - lex->select_lex.db= $3; + lex->select_lex.db= $3.str; if (prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES)) MYSQL_YYABORT; } @@ -12917,7 +12918,7 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_TRIGGERS; - lex->select_lex.db= $3; + lex->select_lex.db= $3.str; if (prepare_schema_table(thd, lex, 0, SCH_TRIGGERS)) MYSQL_YYABORT; } @@ -12925,7 +12926,7 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_EVENTS; - lex->select_lex.db= $2; + lex->select_lex.db= $2.str; if (prepare_schema_table(thd, lex, 0, SCH_EVENTS)) MYSQL_YYABORT; } @@ -12933,7 +12934,7 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_TABLE_STATUS; - lex->select_lex.db= $3; + lex->select_lex.db= $3.str; if (prepare_schema_table(thd, lex, 0, SCH_TABLES)) MYSQL_YYABORT; } @@ -12941,7 +12942,7 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_OPEN_TABLES; - lex->select_lex.db= $3; + lex->select_lex.db= $3.str; if (prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES)) MYSQL_YYABORT; } @@ -12973,8 +12974,8 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_FIELDS; - if ($5) - $4->change_db($5); + if ($5.str) + $4->change_db(&$5); if (prepare_schema_table(thd, lex, $4, SCH_COLUMNS)) MYSQL_YYABORT; } @@ -13001,8 +13002,8 @@ show_param: { LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_KEYS; - if ($4) - $3->change_db($4); + if ($4.str) + $3->change_db(&$4); if (prepare_schema_table(thd, lex, $3, SCH_STATISTICS)) MYSQL_YYABORT; } @@ -13131,7 +13132,7 @@ show_param: | SLAVE STATUS_SYM { LEX *lex= thd->lex; - lex->mi.connection_name= null_lex_str; + lex->mi.connection_name= null_clex_str; lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; lex->verbose= 0; } @@ -13249,8 +13250,8 @@ opt_storage: ; opt_db: - /* empty */ { $$= 0; } - | from_or_in ident { $$= $2.str; } + /* empty */ { $$= null_clex_str; } + | from_or_in ident { $$= $2; } ; opt_full: @@ -13465,7 +13466,7 @@ flush_option: | LOGS_SYM { Lex->type|= REFRESH_LOG; - Lex->relay_log_connection_name= empty_lex_str; + Lex->relay_log_connection_name= empty_clex_str; } | STATUS_SYM { Lex->type|= REFRESH_STATUS; } @@ -13803,7 +13804,7 @@ field_or_var: simple_ident_nospvar {$$= $1;} | '@' ident_or_text { - $$= new (thd->mem_root) Item_user_var_as_out_param(thd, $2); + $$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2); if ($$ == NULL) MYSQL_YYABORT; } @@ -13835,7 +13836,7 @@ load_data_set_elem: text_literal: TEXT_STRING { - LEX_STRING tmp; + LEX_CSTRING tmp; CHARSET_INFO *cs_con= thd->variables.collation_connection; CHARSET_INFO *cs_cli= thd->variables.character_set_client; uint repertoire= $1.repertoire(cs_cli); @@ -13845,8 +13846,11 @@ text_literal: tmp= $1; else { - if (thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli)) + LEX_STRING to; + if (thd->convert_string(&to, cs_con, $1.str, $1.length, cs_cli)) MYSQL_YYABORT; + tmp.str= to.str; + tmp.length= to.length; } $$= new (thd->mem_root) Item_string(thd, tmp.str, tmp.length, cs_con, @@ -13944,20 +13948,20 @@ hex_or_bin_String: param_marker: PARAM_MARKER { - if (!($$= Lex->add_placeholder(thd, (char *) "?", + if (!($$= Lex->add_placeholder(thd, ¶m_clex_str, YYLIP->get_tok_start(), YYLIP->get_tok_start() + 1))) MYSQL_YYABORT; } | colon_with_pos ident { - if (!($$= Lex->add_placeholder(thd, NULL, + if (!($$= Lex->add_placeholder(thd, &null_clex_str, $1, YYLIP->get_tok_end()))) MYSQL_YYABORT; } | colon_with_pos NUM { - if (!($$= Lex->add_placeholder(thd, NULL, + if (!($$= Lex->add_placeholder(thd, &null_clex_str, $1, YYLIP->get_ptr()))) MYSQL_YYABORT; } @@ -14150,7 +14154,7 @@ with_list_element: query_name opt_with_column_list { - $2= new List<LEX_STRING> (Lex->with_column_list); + $2= new List<LEX_CSTRING> (Lex->with_column_list); if ($2 == NULL) MYSQL_YYABORT; Lex->with_column_list.empty(); @@ -14177,13 +14181,13 @@ opt_with_column_list: with_column_list: ident { - Lex->with_column_list.push_back((LEX_STRING*) - thd->memdup(&$1, sizeof(LEX_STRING))); + Lex->with_column_list.push_back((LEX_CSTRING*) + thd->memdup(&$1, sizeof(LEX_CSTRING))); } | with_column_list ',' ident { - Lex->with_column_list.push_back((LEX_STRING*) - thd->memdup(&$3, sizeof(LEX_STRING))); + Lex->with_column_list.push_back((LEX_CSTRING*) + thd->memdup(&$3, sizeof(LEX_CSTRING))); } ; @@ -14191,7 +14195,7 @@ with_column_list: query_name: ident { - $$= (LEX_STRING *) thd->memdup(&$1, sizeof(LEX_STRING)); + $$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); if ($$ == NULL) MYSQL_YYABORT; } @@ -14213,7 +14217,7 @@ table_wild: { SELECT_LEX *sel= Select; $$= new (thd->mem_root) Item_field(thd, Lex->current_context(), - NullS, $1.str, "*"); + NullS, $1.str, &star_clex_str); if ($$ == NULL) MYSQL_YYABORT; sel->with_wild++; @@ -14225,7 +14229,7 @@ table_wild: NullS : $1.str; $$= new (thd->mem_root) Item_field(thd, Lex->current_context(), schema, - $3.str,"*"); + $3.str, &star_clex_str); if ($$ == NULL) MYSQL_YYABORT; sel->with_wild++; @@ -14240,7 +14244,7 @@ simple_ident: ident { Lex_input_stream *lip= YYLIP; - if (!($$= Lex->create_item_ident(thd, $1, + if (!($$= Lex->create_item_ident(thd, &$1, lip->get_tok_start_prev(), lip->get_tok_end()))) MYSQL_YYABORT; @@ -14249,7 +14253,7 @@ simple_ident: | ident '.' ident { LEX *lex= thd->lex; - if (!($$= lex->create_item_ident(thd, $1, $3, + if (!($$= lex->create_item_ident(thd, &$1, &$3, $1.m_pos - lex->substatement_query(thd), YYLIP->get_tok_end() - $1.m_pos))) @@ -14260,7 +14264,7 @@ simple_ident: simple_ident_nospvar: ident { - if (!($$= Lex->create_item_ident_nosp(thd, $1))) + if (!($$= Lex->create_item_ident_nosp(thd, &$1))) MYSQL_YYABORT; } | simple_ident_q { $$= $1; } @@ -14269,7 +14273,7 @@ simple_ident_nospvar: simple_ident_q: ident '.' ident { - if (!($$= Lex->create_item_ident_nospvar(thd, $1, $3))) + if (!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3))) MYSQL_YYABORT; } | simple_ident_q2 @@ -14279,11 +14283,11 @@ simple_ident_q2: colon_with_pos ident '.' ident { LEX *lex= Lex; - if (lex->is_trigger_new_or_old_reference($2)) + if (lex->is_trigger_new_or_old_reference(&$2)) { bool new_row= ($2.str[0]=='N' || $2.str[0]=='n'); if (!($$= Lex->create_and_link_Item_trigger_field(thd, - $4.str, + &$4, new_row))) MYSQL_YYABORT; } @@ -14295,12 +14299,12 @@ simple_ident_q2: } | '.' ident '.' ident { - if (!($$= Lex->create_item_ident(thd, null_lex_str, $2, $4))) + if (!($$= Lex->create_item_ident(thd, &null_clex_str, &$2, &$4))) MYSQL_YYABORT; } | ident '.' ident '.' ident { - if (!($$= Lex->create_item_ident(thd, $1, $3, $5))) + if (!($$= Lex->create_item_ident(thd, &$1, &$3, &$5))) MYSQL_YYABORT; } ; @@ -14330,20 +14334,20 @@ field_ident: table_ident: ident { - $$= new (thd->mem_root) Table_ident($1); + $$= new (thd->mem_root) Table_ident(&$1); if ($$ == NULL) MYSQL_YYABORT; } | ident '.' ident { - $$= new (thd->mem_root) Table_ident(thd, $1, $3, 0); + $$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); if ($$ == NULL) MYSQL_YYABORT; } | '.' ident { /* For Delphi */ - $$= new (thd->mem_root) Table_ident($2); + $$= new (thd->mem_root) Table_ident(&$2); if ($$ == NULL) MYSQL_YYABORT; } @@ -14352,13 +14356,13 @@ table_ident: table_ident_opt_wild: ident opt_wild { - $$= new (thd->mem_root) Table_ident($1); + $$= new (thd->mem_root) Table_ident(&$1); if ($$ == NULL) MYSQL_YYABORT; } | ident '.' ident opt_wild { - $$= new (thd->mem_root) Table_ident(thd, $1, $3, 0); + $$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); if ($$ == NULL) MYSQL_YYABORT; } @@ -14367,8 +14371,8 @@ table_ident_opt_wild: table_ident_nodb: ident { - LEX_STRING db={(char*) any_db,3}; - $$= new (thd->mem_root) Table_ident(thd, db, $1, 0); + LEX_CSTRING db={(char*) any_db,3}; + $$= new (thd->mem_root) Table_ident(thd, &db, &$1, 0); if ($$ == NULL) MYSQL_YYABORT; } @@ -14393,9 +14397,12 @@ IDENT_sys: } else { - if (thd->convert_with_error(system_charset_info, &$$, + LEX_STRING to; + if (thd->convert_with_error(system_charset_info, &to, thd->charset(), $1.str, $1.length)) MYSQL_YYABORT; + $$.str= to.str; + $$.length= to.length; } } ; @@ -14407,9 +14414,12 @@ TEXT_STRING_sys: $$= $1; else { - if (thd->convert_string(&$$, system_charset_info, + LEX_STRING to; + if (thd->convert_string(&to, system_charset_info, $1.str, $1.length, thd->charset())) MYSQL_YYABORT; + $$.str= to.str; + $$.length= to.length; } } ; @@ -14421,10 +14431,13 @@ TEXT_STRING_literal: $$= $1; else { - if (thd->convert_string(&$$, thd->variables.collation_connection, + LEX_STRING to; + if (thd->convert_string(&to, thd->variables.collation_connection, $1.str, $1.length, thd->charset())) MYSQL_YYABORT; - } + $$.str= to.str; + $$.length= to.length; + } } ; @@ -14435,10 +14448,13 @@ TEXT_STRING_filesystem: $$= $1; else { - if (thd->convert_string(&$$, + LEX_STRING to; + if (thd->convert_string(&to, thd->variables.character_set_filesystem, $1.str, $1.length, thd->charset())) MYSQL_YYABORT; + $$.str= to.str; + $$.length= to.length; } } ; @@ -14446,7 +14462,7 @@ TEXT_STRING_filesystem: ident: IDENT_sys { - (LEX_STRING &)$$= $1; + (LEX_CSTRING &)$$= $1; $$.m_pos= (char *) YYLIP->get_tok_start_prev(); } | keyword @@ -14462,7 +14478,7 @@ ident: ident_with_tok_start: IDENT_sys { - (LEX_STRING &)$$= $1; + (LEX_CSTRING &)$$= $1; $$.m_pos= (char *) YYLIP->get_tok_start(); } | keyword @@ -14512,7 +14528,7 @@ labels_declaration_oracle: label_declaration_oracle: SHIFT_LEFT label_ident SHIFT_RIGHT { - if (Lex->sp_push_goto_label(thd, $2)) + if (Lex->sp_push_goto_label(thd, &$2)) MYSQL_YYABORT; $$= $2; } @@ -14530,7 +14546,7 @@ user_maybe_role: if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) MYSQL_YYABORT; $$->user = $1; - $$->host= null_lex_str; // User or Role, see get_current_user() + $$->host= null_clex_str; // User or Role, see get_current_user() $$->reset_auth(); if (check_string_char_length(&$$->user, ER_USERNAME, @@ -14557,7 +14573,7 @@ user_maybe_role: It's OK to use in-place lowercase as long as the character set is utf8. */ - my_casedn_str(system_charset_info, $$->host.str); + my_casedn_str(system_charset_info, (char*) $$->host.str); } else { @@ -14573,8 +14589,8 @@ user_maybe_role: if (!($$=(LEX_USER*)thd->calloc(sizeof(LEX_USER)))) MYSQL_YYABORT; $$->user= current_user; - $$->plugin= empty_lex_str; - $$->auth= empty_lex_str; + $$->plugin= empty_clex_str; + $$->auth= empty_clex_str; } ; @@ -15125,7 +15141,7 @@ set_assign: { LEX *lex= Lex; DBUG_ASSERT(lex->var_list.is_empty()); - if (lex->set_variable($1, $3, $6) || + if (lex->set_variable(&$1, &$3, $6) || lex->sphead->restore_lex(thd)) MYSQL_YYABORT; } @@ -15266,14 +15282,14 @@ option_value_no_option_type: ident equal set_expr_or_default { struct sys_var_with_base var; - if (Lex->init_internal_variable(&var, $1) || + if (Lex->init_internal_variable(&var, &$1) || Lex->set_variable(&var, $3)) MYSQL_YYABORT; } | ident '.' ident equal set_expr_or_default { DBUG_ASSERT(Lex->var_list.is_empty()); - if (Lex->set_variable($1, $3, $5)) + if (Lex->set_variable(&$1, &$3, $5)) MYSQL_YYABORT; } | DEFAULT '.' ident equal set_expr_or_default @@ -15286,7 +15302,7 @@ option_value_no_option_type: | '@' ident_or_text equal expr { Item_func_set_user_var *item; - item= new (thd->mem_root) Item_func_set_user_var(thd, $2, $4); + item= new (thd->mem_root) Item_func_set_user_var(thd, &$2, $4); if (item == NULL) MYSQL_YYABORT; set_var_user *var= new (thd->mem_root) set_var_user(item); @@ -15324,15 +15340,11 @@ option_value_no_option_type: { LEX *lex= Lex; sp_pcontext *spc= lex->spcont; - LEX_STRING names; - - names.str= (char *)"names"; - names.length= 5; - if (spc && spc->find_variable(names, false)) + LEX_CSTRING names= { STRING_WITH_LEN("names") }; + if (spc && spc->find_variable(&names, false)) my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); else thd->parse_error(); - MYSQL_YYABORT; } | NAMES_SYM charset_name_or_default opt_collate @@ -15409,12 +15421,12 @@ option_value_no_option_type: internal_variable_name: ident { - if (Lex->init_internal_variable(&$$, $1)) + if (Lex->init_internal_variable(&$$, &$1)) MYSQL_YYABORT; } | ident '.' ident { - if (Lex->init_internal_variable(&$$, $1, $3)) + if (Lex->init_internal_variable(&$$, &$1, &$3)) MYSQL_YYABORT; } | DEFAULT '.' ident @@ -15428,7 +15440,7 @@ internal_variable_name: internal_variable_name_directly_assignable: ident_directly_assignable { - if (Lex->init_internal_variable(&$$, $1)) + if (Lex->init_internal_variable(&$$, &$1)) MYSQL_YYABORT; } | DEFAULT '.' ident @@ -15438,12 +15450,12 @@ internal_variable_name_directly_assignable: } | colon_with_pos ident_directly_assignable '.' ident { - if (!Lex->is_trigger_new_or_old_reference($2)) + if (!Lex->is_trigger_new_or_old_reference(&$2)) { thd->parse_error(); MYSQL_YYABORT; } - if (Lex->init_internal_variable(&$$, $2, $4)) + if (Lex->init_internal_variable(&$$, &$2, &$4)) MYSQL_YYABORT; } ; @@ -15465,7 +15477,7 @@ transaction_access_mode: set_var *var= (new (thd->mem_root) set_var(thd, lex->option_type, find_sys_var(thd, "tx_read_only"), - &null_lex_str, + &null_clex_str, item)); if (var == NULL) MYSQL_YYABORT; @@ -15483,7 +15495,7 @@ isolation_level: set_var *var= (new (thd->mem_root) set_var(thd, lex->option_type, find_sys_var(thd, "tx_isolation"), - &null_lex_str, + &null_clex_str, item)); if (var == NULL) MYSQL_YYABORT; @@ -15508,15 +15520,15 @@ opt_for_user: { LEX *lex= thd->lex; sp_pcontext *spc= lex->spcont; - LEX_STRING pw= { C_STRING_WITH_LEN("password") }; + LEX_CSTRING pw= { STRING_WITH_LEN("password") }; - if (spc && spc->find_variable(pw, false)) + if (spc && spc->find_variable(&pw, false)) my_yyabort_error((ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str)); if (!(lex->definer= (LEX_USER*) thd->calloc(sizeof(LEX_USER)))) MYSQL_YYABORT; lex->definer->user= current_user; - lex->definer->plugin= empty_lex_str; - lex->definer->auth= empty_lex_str; + lex->definer->plugin= empty_clex_str; + lex->definer->auth= empty_clex_str; } | FOR_SYM user equal { Lex->definer= $2; } ; @@ -15675,7 +15687,7 @@ handler: ; handler_read_or_scan: - handler_scan_function { Lex->ident= null_lex_str; } + handler_scan_function { Lex->ident= null_clex_str; } | ident handler_rkey_function { Lex->ident= $1; } ; @@ -15863,13 +15875,13 @@ grant_role: CHARSET_INFO *cs= system_charset_info; /* trim end spaces (as they'll be lost in mysql.user anyway) */ $1.length= cs->cset->lengthsp(cs, $1.str, $1.length); - $1.str[$1.length] = '\0'; + ((char*) $1.str)[$1.length] = '\0'; if ($1.length == 0) my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) MYSQL_YYABORT; - $$->user = $1; - $$->host= empty_lex_str; + $$->user= $1; + $$->host= empty_clex_str; $$->reset_auth(); if (check_string_char_length(&$$->user, ER_USERNAME, @@ -16079,7 +16091,7 @@ grant_user: { $$= $1; $1->plugin= $4; - $1->auth= empty_lex_str; + $1->auth= empty_clex_str; } | user IDENTIFIED_SYM via_or_with ident_or_text using_or_as TEXT_STRING_sys { @@ -16665,7 +16677,8 @@ view_select: void *create_view_select= thd->memdup(lex->create_view_select.str, len); lex->create_view_select.length= len; lex->create_view_select.str= (char *) create_view_select; - trim_whitespace(thd->charset(), &lex->create_view_select, + trim_whitespace(thd->charset(), + &lex->create_view_select, ¬_used); lex->parsing_options.allows_variable= TRUE; lex->current_select->set_with_clause($2); @@ -16789,7 +16802,7 @@ trigger_tail: lex->query_tables can be wiped out. */ if (!lex->select_lex.add_table_to_list(thd, $11, - (LEX_STRING*) 0, + (LEX_CSTRING*) 0, TL_OPTION_UPDATING, TL_READ_NO_INSERT, MDL_SHARED_NO_WRITE)) @@ -16838,7 +16851,8 @@ sf_tail: RETURN_SYM /* $6 */ { /* $7 */ LEX *lex= Lex; - lex->init_last_field(&lex->sphead->m_return_field_def, NULL, + lex->init_last_field(&lex->sphead->m_return_field_def, + &empty_clex_str, thd->variables.collation_database); } sp_param_type_with_opt_collate /* $8 */ @@ -17019,7 +17033,7 @@ install: { LEX *lex= Lex; lex->sql_command= SQLCOM_INSTALL_PLUGIN; - lex->comment= null_lex_str; + lex->comment= null_clex_str; lex->ident= $3; } ; @@ -17035,7 +17049,7 @@ uninstall: { LEX *lex= Lex; lex->sql_command= SQLCOM_UNINSTALL_PLUGIN; - lex->comment= null_lex_str; + lex->comment= null_clex_str; lex->ident= $3; } ; |