diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 425 |
1 files changed, 220 insertions, 205 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1cc9f17cd20..59c045029f4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -238,7 +238,7 @@ int LEX::case_stmt_action_when(Item *when, bool simple) return !MY_TEST(i) || - sphead->push_backpatch(thd, i, spcont->push_label(thd, empty_lex_str, 0)) || + sphead->push_backpatch(thd, i, spcont->push_label(thd, &empty_clex_str, 0)) || sphead->add_cont_backpatch(i) || sphead->add_instr(i); } @@ -320,7 +320,7 @@ LEX::set_system_variable(struct sys_var_with_base *tmp, @return TRUE if error, FALSE otherwise. */ -bool LEX::set_trigger_new_row(LEX_STRING *name, Item *val) +bool LEX::set_trigger_new_row(LEX_CSTRING *name, Item *val) { Item_trigger_field *trg_fld; sp_instr_set_trigger_field *sp_fld; @@ -336,7 +336,7 @@ bool LEX::set_trigger_new_row(LEX_STRING *name, Item *val) trg_fld= new (thd->mem_root) Item_trigger_field(thd, current_context(), Item_trigger_field::NEW_ROW, - name->str, UPDATE_ACL, FALSE); + name, UPDATE_ACL, FALSE); if (trg_fld == NULL) return TRUE; @@ -373,7 +373,7 @@ bool LEX::set_trigger_new_row(LEX_STRING *name, Item *val) @return An Item_splocal object representing the SP variable, or NULL on error. */ Item_splocal* -LEX::create_item_for_sp_var(LEX_STRING name, sp_variable *spvar, +LEX::create_item_for_sp_var(LEX_CSTRING *name, sp_variable *spvar, const char *start_in_q, const char *end_in_q) { Item_splocal *item; @@ -385,7 +385,7 @@ LEX::create_item_for_sp_var(LEX_STRING name, sp_variable *spvar, if (!spvar) { - my_error(ER_SP_UNDECLARED_VAR, MYF(0), name.str); + my_error(ER_SP_UNDECLARED_VAR, MYF(0), name->str); return NULL; } @@ -682,27 +682,28 @@ bool sp_create_assignment_instr(THD *thd, bool no_lookahead) return false; } -void LEX::add_key_to_list(LEX_STRING *field_name, +void LEX::add_key_to_list(LEX_CSTRING *field_name, enum Key::Keytype type, bool check_exists) { Key *key; MEM_ROOT *mem_root= thd->mem_root; key= new (mem_root) - Key(type, null_lex_str, HA_KEY_ALG_UNDEF, false, + Key(type, &null_clex_str, HA_KEY_ALG_UNDEF, false, DDL_options(check_exists ? DDL_options::OPT_IF_NOT_EXISTS : DDL_options::OPT_NONE)); - key->columns.push_back(new (mem_root) Key_part_spec(*field_name, 0), + key->columns.push_back(new (mem_root) Key_part_spec(field_name, 0), mem_root); alter_info.key_list.push_back(key, mem_root); } -void LEX::init_last_field(Column_definition *field, const char *field_name, - CHARSET_INFO *cs) +void LEX::init_last_field(Column_definition *field, + const LEX_CSTRING *field_name, + const CHARSET_INFO *cs) { last_field= field; - field->field_name= field_name; + field->field_name= *field_name; /* reset LEX fields that are used in Create_field::set_and_check() */ charset= cs; @@ -758,7 +759,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) 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; @@ -787,7 +788,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) 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; @@ -795,7 +796,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) 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; @@ -1607,7 +1608,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty opt_constraint constraint opt_ident sp_decl_ident - sp_block_label + sp_block_label opt_place opt_db %type <lex_string_with_metadata> TEXT_STRING @@ -1628,12 +1629,11 @@ 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 %type <const_simple_string> - opt_place + field_length opt_field_length opt_field_length_default_1 %type <string> text_string hex_or_bin_String opt_gconcat_separator @@ -2410,7 +2410,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 ; @@ -2446,7 +2446,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 @@ -2484,7 +2484,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())) @@ -2529,7 +2529,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 @@ -2539,7 +2539,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 @@ -2549,7 +2549,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 @@ -2696,7 +2696,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 { @@ -2899,12 +2900,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; } ; @@ -3003,7 +3004,7 @@ sp_fdparams: sp_param_name: ident { - if (!($$= Lex->sp_param_init($1))) + if (!($$= Lex->sp_param_init(&$1))) MYSQL_YYABORT; } ; @@ -3021,7 +3022,7 @@ sp_param_name_and_type: | sp_param_name ROW_SYM row_type_body { $$= $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, $3); $$->field_def.set_row_field_definitions($3); @@ -3108,13 +3109,13 @@ sp_decl: 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; } ; @@ -3122,18 +3123,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; } ; @@ -3146,7 +3147,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); } ; @@ -3164,8 +3165,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); } @@ -3222,7 +3223,7 @@ sp_decl_body: sp_decl_variable_list | sp_decl_ident 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; @@ -3249,7 +3250,7 @@ sp_decl_body: sp_pcontext *param_ctx= Lex->spcont; if (Lex->sp_block_finalize(thd)) MYSQL_YYABORT; - if (Lex->sp_declare_cursor(thd, $1, $6, param_ctx, true)) + if (Lex->sp_declare_cursor(thd, &$1, $6, param_ctx, true)) MYSQL_YYABORT; $$.vars= $$.conds= $$.hndlrs= 0; $$.curs= 1; @@ -3357,7 +3358,7 @@ sp_hcond: } | ident /* CONDITION name */ { - $$= Lex->spcont->find_condition($1, false); + $$= Lex->spcont->find_condition(&$1, false); if ($$ == NULL) my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); } @@ -3398,7 +3399,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_condition($1, false); + cond= lex->spcont->find_condition(&$1, false); if (cond == NULL) my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); if (cond->type != sp_condition_value::SQLSTATE) @@ -3574,7 +3575,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) @@ -3582,7 +3583,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; } @@ -3668,9 +3669,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 @@ -3680,9 +3681,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; } ; @@ -3817,7 +3818,7 @@ sp_proc_stmt_return: sp_proc_stmt_leave: LEAVE_SYM label_ident { - if (Lex->sp_leave_statement(thd, $2)) + if (Lex->sp_leave_statement(thd, &$2)) MYSQL_YYABORT; } ; @@ -3825,7 +3826,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; } ; @@ -3878,7 +3879,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; } ; @@ -3886,17 +3887,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; } ; @@ -3913,7 +3914,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); @@ -3931,7 +3932,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 */ @@ -3945,7 +3946,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 */ @@ -3965,7 +3966,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; @@ -3982,7 +3983,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 { @@ -4047,7 +4048,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 @@ -4156,14 +4157,14 @@ else_clause_opt: ; sp_opt_label: - /* Empty */ { $$= null_lex_str; } + /* Empty */ { $$= null_clex_str; } | label_ident { $$= $1; } ; sp_block_label: label_ident ':' { - if (Lex->spcont->block_label_declare($1)) + if (Lex->spcont->block_label_declare(&$1)) MYSQL_YYABORT; $$= $1; } @@ -4173,14 +4174,14 @@ sp_labeled_block: sp_block_label BEGIN_SYM { - Lex->sp_block_init(thd, $1); + Lex->sp_block_init(thd, &$1); } sp_decls sp_proc_stmts END sp_opt_label { - if (Lex->sp_block_finalize(thd, $4, $7)) + if (Lex->sp_block_finalize(thd, $4, &$7)) MYSQL_YYABORT; } ; @@ -4268,7 +4269,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; } ; @@ -4276,14 +4277,14 @@ pop_sp_loop_label: sp_labeled_control: label_ident ':' 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 { } | label_ident ':' 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); } @@ -4291,7 +4292,7 @@ sp_labeled_control: { } | label_ident ':' 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 @@ -4683,11 +4684,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]) @@ -4841,7 +4842,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")); @@ -5949,28 +5950,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 { } @@ -5979,7 +5980,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 { } @@ -5987,7 +5988,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 { } @@ -5995,7 +5996,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; @@ -6004,11 +6005,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, @@ -6054,7 +6055,7 @@ check_constraint: ; opt_constraint: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | constraint { $$= $1; } ; @@ -6075,7 +6076,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 @@ -6253,7 +6254,7 @@ field_type: 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 @@ -6791,14 +6792,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; @@ -7024,7 +7025,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; } @@ -7033,19 +7034,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; } ; @@ -7062,7 +7063,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; @@ -7268,7 +7269,7 @@ opt_ev_sql_stmt: ; ident_or_empty: - /* empty */ { $$= null_lex_str; } + /* empty */ { $$= null_clex_str; } | ident { $$= $1; } ; @@ -7553,7 +7554,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 @@ -7658,7 +7659,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; @@ -7773,15 +7774,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; } ; @@ -8655,7 +8657,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)) @@ -8684,7 +8686,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()); } @@ -8710,7 +8712,7 @@ remember_end: ; select_alias: - /* empty */ { $$=null_lex_str;} + /* empty */ { $$=null_clex_str;} | AS ident { $$=$2; } | AS TEXT_STRING_sys { $$=$2; } | ident { $$=$1; } @@ -10147,10 +10149,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 { @@ -10172,7 +10174,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); } } @@ -10200,7 +10202,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)) { @@ -10209,7 +10211,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)) { @@ -10561,7 +10563,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; } @@ -10583,7 +10585,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; @@ -10592,7 +10594,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; @@ -11296,7 +11298,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: @@ -11372,7 +11374,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; } @@ -11508,7 +11510,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; } ; @@ -11525,7 +11527,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; } @@ -11793,7 +11795,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))) @@ -11803,7 +11805,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))) @@ -11928,7 +11930,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)) @@ -11965,7 +11967,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()); } ; @@ -12008,22 +12010,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; } ; @@ -12123,12 +12125,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; @@ -12136,14 +12138,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; @@ -12627,7 +12629,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, @@ -12640,7 +12642,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, @@ -12761,7 +12763,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(); @@ -12784,7 +12786,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; } @@ -12792,7 +12794,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; } @@ -12800,7 +12802,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; } @@ -12808,7 +12810,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; } @@ -12816,7 +12818,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; } @@ -12848,8 +12850,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; } @@ -12876,8 +12878,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; } @@ -13006,7 +13008,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; } @@ -13124,8 +13126,8 @@ opt_storage: ; opt_db: - /* empty */ { $$= 0; } - | from_or_in ident { $$= $2.str; } + /* empty */ { $$= null_clex_str; } + | from_or_in ident { $$= $2; } ; opt_full: @@ -13340,7 +13342,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; } @@ -13678,7 +13680,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; } @@ -13710,7 +13712,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); @@ -13720,8 +13722,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, @@ -13819,7 +13824,7 @@ 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; @@ -14013,7 +14018,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(); @@ -14040,13 +14045,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))); } ; @@ -14054,7 +14059,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; } @@ -14076,7 +14081,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++; @@ -14088,7 +14093,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++; @@ -14103,7 +14108,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; @@ -14112,7 +14117,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))) @@ -14123,7 +14128,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; } @@ -14132,7 +14137,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 @@ -14141,12 +14146,12 @@ simple_ident_q: 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; } ; @@ -14176,20 +14181,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; } @@ -14198,13 +14203,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; } @@ -14213,8 +14218,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; } @@ -14239,9 +14244,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; } } ; @@ -14253,9 +14261,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; } } ; @@ -14267,10 +14278,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; + } } ; @@ -14281,10 +14295,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; } } ; @@ -14292,7 +14309,7 @@ TEXT_STRING_filesystem: ident: IDENT_sys { - (LEX_STRING &)$$= $1; + (LEX_CSTRING &)$$= $1; $$.m_pos= (char *) YYLIP->get_tok_start_prev(); } | keyword @@ -14308,7 +14325,7 @@ ident: ident_with_tok_start: IDENT_sys { - (LEX_STRING &)$$= $1; + (LEX_CSTRING &)$$= $1; $$.m_pos= (char *) YYLIP->get_tok_start(); } | keyword @@ -14343,7 +14360,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, @@ -14370,7 +14387,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 { @@ -14386,8 +14403,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; } ; @@ -14992,14 +15009,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 @@ -15012,7 +15029,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); @@ -15050,15 +15067,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 @@ -15135,12 +15148,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 @@ -15167,7 +15180,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; @@ -15185,7 +15198,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; @@ -15210,15 +15223,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; } ; @@ -15377,7 +15390,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; } ; @@ -15565,13 +15578,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, @@ -15781,7 +15794,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 { @@ -16376,7 +16389,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); @@ -16498,7 +16512,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)) @@ -16547,7 +16561,8 @@ sf_tail: RETURNS_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); } type_with_opt_collate /* $8 */ @@ -16698,7 +16713,7 @@ install: { LEX *lex= Lex; lex->sql_command= SQLCOM_INSTALL_PLUGIN; - lex->comment= null_lex_str; + lex->comment= null_clex_str; lex->ident= $3; } ; @@ -16714,7 +16729,7 @@ uninstall: { LEX *lex= Lex; lex->sql_command= SQLCOM_UNINSTALL_PLUGIN; - lex->comment= null_lex_str; + lex->comment= null_clex_str; lex->ident= $3; } ; |