summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy86
1 files changed, 69 insertions, 17 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0fed9186dd2..169a7e1a7ca 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5536,7 +5536,9 @@ versioning_option:
default_charset:
opt_default charset opt_equal charset_name_or_default
{
- if (unlikely(Lex->create_info.add_table_option_default_charset($4)))
+ Character_set_collations_used used(thd);
+ if (unlikely(Lex->create_info.add_table_option_default_charset(
+ &used, thd->variables.character_set_collations, $4)))
MYSQL_YYABORT;
}
;
@@ -5544,8 +5546,10 @@ default_charset:
default_collation:
opt_default COLLATE_SYM opt_equal collation_name_or_default
{
+ Character_set_collations_used used(thd);
Table_specification_st *cinfo= &Lex->create_info;
- if (unlikely(cinfo->add_table_option_default_collation($4)))
+ if (unlikely(cinfo->add_table_option_default_collation(
+ &used, thd->variables.character_set_collations, $4)))
MYSQL_YYABORT;
}
;
@@ -5797,10 +5801,14 @@ field_type_or_serial:
}
field_def
{
+ Character_set_collations_used used(thd);
auto tmp= $1.charset_collation_attrs();
- if (tmp.merge_column_charset_clause_and_collate_clause($3))
+ if (tmp.merge_column_charset_clause_and_collate_clause(
+ &used, thd->variables.character_set_collations, $3))
MYSQL_YYABORT;
- Lex->last_field->set_charset_collation_attrs(tmp);
+ Lex->last_field->set_charset_collation_attrs(
+ &used, thd->variables.character_set_collations,
+ tmp);
}
| SERIAL_SYM
{
@@ -5838,7 +5846,9 @@ field_def:
| attribute_list compressed_deprecated_column_attribute { $$= $1; }
| attribute_list compressed_deprecated_column_attribute attribute_list
{
- if (($$= $1).merge_column_collate_clause_and_collate_clause($3))
+ Character_set_collations_used used(thd);
+ if (($$= $1).merge_column_collate_clause_and_collate_clause(
+ &used, thd->variables.character_set_collations, $3))
MYSQL_YYABORT;
}
| opt_generated_always AS virtual_column_func
@@ -6318,8 +6328,10 @@ opt_precision:
attribute_list:
attribute_list attribute
{
- if (($$= $1).merge_column_collate_clause_and_collate_clause($2))
- MYSQL_YYABORT;
+ Character_set_collations_used used(thd);
+ if (($$= $1).merge_column_collate_clause_and_collate_clause(
+ &used, thd->variables.character_set_collations, $2))
+ MYSQL_YYABORT;
}
| attribute
;
@@ -6546,11 +6558,19 @@ binary:
}
| charset_or_alias COLLATE_SYM DEFAULT
{
- $$.set_charset_collate_default(Lex_exact_charset($1));
+ Character_set_collations_used used(thd);
+ $$.set_charset_collate_default(
+ &used,
+ thd->variables.character_set_collations,
+ Lex_exact_charset($1));
}
| charset_or_alias COLLATE_SYM collation_name
{
- if ($3.merge_exact_charset(Lex_exact_charset($1)))
+ Character_set_collations_used used(thd);
+ if ($3.merge_exact_charset(
+ &used,
+ thd->variables.character_set_collations,
+ Lex_exact_charset($1)))
MYSQL_YYABORT;
$$= Lex_exact_charset_extended_collation_attrs($3);
}
@@ -7630,13 +7650,17 @@ alter_list_item:
}
| CONVERT_SYM TO_SYM charset charset_name_or_default
{
- if (Lex->add_alter_list_item_convert_to_charset($4))
+ Character_set_collations_used used(thd);
+ if (Lex->add_alter_list_item_convert_to_charset(
+ &used, thd->variables.character_set_collations, $4))
MYSQL_YYABORT;
}
| CONVERT_SYM TO_SYM charset charset_name_or_default
COLLATE_SYM collation_name_or_default
{
- if (Lex->add_alter_list_item_convert_to_charset($4, $6))
+ Character_set_collations_used used(thd);
+ if (Lex->add_alter_list_item_convert_to_charset(
+ &used, thd->variables.character_set_collations, $4, $6))
MYSQL_YYABORT;
}
| create_table_options_space_separated
@@ -9507,7 +9531,10 @@ temporal_dyncol_type:
string_dyncol_type:
char opt_binary
{
- if ($$.set(DYN_COL_STRING, $2, thd->variables.collation_connection))
+ Character_set_collations_used used(thd);
+ if ($$.set(DYN_COL_STRING, &used,
+ thd->variables.character_set_collations,
+ $2, thd->variables.collation_connection))
MYSQL_YYABORT;
}
| nchar
@@ -9686,6 +9713,9 @@ column_default_non_parenthesized_expr:
}
| CONVERT_SYM '(' expr USING charset_name ')'
{
+ Character_set_collations_used used(thd);
+ $5= thd->variables.character_set_collations.
+ get_collation_for_charset(&used, $5);
$$= new (thd->mem_root) Item_func_conv_charset(thd, $3, $5);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -9838,6 +9868,9 @@ function_call_keyword:
}
| CHAR_SYM '(' expr_list USING charset_name ')'
{
+ Character_set_collations_used used(thd);
+ $5= thd->variables.character_set_collations.
+ get_collation_for_charset(&used, $5);
$$= new (thd->mem_root) Item_func_char(thd, *$3, $5);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
@@ -11128,19 +11161,25 @@ cast_type:
{ $$.set(&type_handler_long_blob, $2, &my_charset_bin); }
| CHAR_SYM opt_field_length opt_binary
{
- if ($$.set(&type_handler_long_blob, $2, $3,
+ Character_set_collations_used used(thd);
+ if ($$.set(&type_handler_long_blob,
+ $2, &used, thd->variables.character_set_collations, $3,
thd->variables.collation_connection))
MYSQL_YYABORT;
}
| VARCHAR field_length opt_binary
{
- if ($$.set(&type_handler_long_blob, $2, $3,
+ Character_set_collations_used used(thd);
+ if ($$.set(&type_handler_long_blob,
+ $2, &used, thd->variables.character_set_collations, $3,
thd->variables.collation_connection))
MYSQL_YYABORT;
}
| VARCHAR2_ORACLE_SYM field_length opt_binary
{
- if ($$.set(&type_handler_long_blob, $2, $3,
+ Character_set_collations_used used(thd);
+ if ($$.set(&type_handler_long_blob,
+ $2, &used, thd->variables.character_set_collations, $3,
thd->variables.collation_connection))
MYSQL_YYABORT;
}
@@ -14791,6 +14830,9 @@ text_literal:
}
| UNDERSCORE_CHARSET TEXT_STRING
{
+ Character_set_collations_used used(thd);
+ $1= thd->variables.character_set_collations.
+ get_collation_for_charset(&used, $1);
if (unlikely(!($$= thd->make_string_literal_charset($2, $1))))
MYSQL_YYABORT;
}
@@ -14930,6 +14972,9 @@ literal:
Item_string_with_introducer *item_str;
LEX_CSTRING tmp;
$2->get_value(&tmp);
+ Character_set_collations_used used(thd);
+ $1= thd->variables.character_set_collations.
+ get_collation_for_charset(&used, $1);
/*
Pass NULL as name. Name will be set in the "select_item" rule and
will include the introducer and the original hex/bin notation.
@@ -16646,7 +16691,12 @@ option_value_no_option_type:
{
CHARSET_INFO *def= global_system_variables.character_set_client;
Lex_exact_charset_opt_extended_collate tmp($2 ? $2 : def, false);
- if (Lex->set_names($1.pos(), tmp, yychar == YYEMPTY))
+ Lex_extended_collation_st cl;
+ cl.set_collate_default();
+ Character_set_collations_used used(thd);
+ if (tmp.merge_collation(&used, thd->variables.
+ character_set_collations, cl) ||
+ Lex->set_names($1.pos(), tmp, yychar == YYEMPTY))
MYSQL_YYABORT;
}
| NAMES_SYM charset_name_or_default
@@ -16654,7 +16704,9 @@ option_value_no_option_type:
{
CHARSET_INFO *def= global_system_variables.character_set_client;
Lex_exact_charset_opt_extended_collate tmp($2 ? $2 : def, false);
- if (tmp.merge_collation($4) ||
+ Character_set_collations_used used(thd);
+ if (tmp.merge_collation(&used, thd->variables.
+ character_set_collations, $4) ||
Lex->set_names($1.pos(), tmp, yychar == YYEMPTY))
MYSQL_YYABORT;
}