support set names/charset and variables in one sql

This commit is contained in:
st0
2021-11-09 10:48:59 +08:00
committed by LINxiansheng
parent fa9b5fdfc0
commit 878c594b56
31 changed files with 21749 additions and 21858 deletions

View File

@ -401,7 +401,6 @@ END_P SET_VAR DELIMITER
%type <node> zone_action upgrade_action
%type <node> opt_index_name opt_key_or_index opt_index_options opt_primary opt_all
%type <node> charset_key database_key charset_name charset_name_or_default collation_name databases_or_schemas trans_param_name trans_param_value
%type <node> set_names_stmt set_charset_stmt
%type <node> charset_introducer complex_string_literal literal number_literal now_or_signed_literal signed_literal
%type <node> create_tablegroup_stmt drop_tablegroup_stmt alter_tablegroup_stmt default_tablegroup
%type <node> set_transaction_stmt transaction_characteristics transaction_access_mode isolation_level
@ -520,8 +519,6 @@ stmt:
| create_resource_stmt { $$ = $1; check_question_mark($$, result); }
| alter_resource_stmt { $$ = $1; check_question_mark($$, result); }
| drop_resource_stmt { $$ = $1; check_question_mark($$, result); }
| set_names_stmt { $$ = $1; check_question_mark($$, result); }
| set_charset_stmt { $$ = $1; check_question_mark($$, result); }
| create_tablegroup_stmt { $$ = $1; check_question_mark($$, result); }
| drop_tablegroup_stmt { $$ = $1; check_question_mark($$, result); }
| alter_tablegroup_stmt { $$ = $1; check_question_mark($$, result); }
@ -10718,6 +10715,15 @@ USER_VARIABLE to_or_eq expr
malloc_non_terminal_node($$, result->malloc_pool_, T_VAR_VAL, 2, $1, $3);
$$->value_ = 2;
}
| NAMES charset_name_or_default opt_collation
{
malloc_non_terminal_node($$, result->malloc_pool_, T_SET_NAMES, 2, $2, $3);
}
| charset_key charset_name_or_default
{
(void)($1);
malloc_non_terminal_node($$, result->malloc_pool_, T_SET_CHARSET, 1, $2);
}
;
sys_var_and_val:
@ -13022,23 +13028,6 @@ BEGI
}
;
////////////////////////////////////////////////////////////////
/* SET NAMES 'charset_name' [COLLATE 'collation_name'] */
set_names_stmt:
SET NAMES charset_name_or_default opt_collation
{
malloc_non_terminal_node($$, result->malloc_pool_, T_SET_NAMES, 2, $3, $4);
};
////////////////////////////////////////////////////////////////
/* SET CHARACTER SET charset_name */
set_charset_stmt:
SET charset_key charset_name_or_default
{
(void)($2);
malloc_non_terminal_node($$, result->malloc_pool_, T_SET_CHARSET, 1, $3);
};
//////////////////////////////
set_transaction_stmt:
SET TRANSACTION transaction_characteristics

File diff suppressed because it is too large Load Diff

View File

@ -371,6 +371,7 @@ const char* get_type_name(int type)
case T_FUN_SYS_QUARTER : return "T_FUN_SYS_QUARTER";
case T_FUN_SYS_BIT_LENGTH : return "T_FUN_SYS_BIT_LENGTH";
case T_FUN_SYS_PI : return "T_FUN_SYS_PI";
case T_FUN_SYS_DEGREES : return "T_FUN_SYS_DEGREES";
case T_FUN_SYS_EXPORT_SET : return "T_FUN_SYS_EXPORT_SET";
case T_FUN_SYS_INET6NTOA : return "T_FUN_SYS_INET6NTOA";
case T_FUN_SYS_INET6ATON : return "T_FUN_SYS_INET6ATON";
@ -379,8 +380,8 @@ const char* get_type_name(int type)
case T_FUN_SYS_IS_IPV4_MAPPED : return "T_FUN_SYS_IS_IPV4_MAPPED";
case T_FUN_SYS_IS_IPV4_COMPAT : return "T_FUN_SYS_IS_IPV4_COMPAT";
case T_FUN_SYS_INETATON : return "T_FUN_SYS_INETATON";
case T_FUN_SYS_CRC32 : return "T_FUN_SYS_CRC32";
case T_FUN_SYS_WEIGHT_STRING : return "T_FUN_SYS_WEIGHT_STRING";
case T_FUN_SYS_CRC32 : return "T_FUN_SYS_CRC32";
case T_MYSQL_ONLY_SYS_MAX_OP : return "T_MYSQL_ONLY_SYS_MAX_OP";
case T_FUN_SYS_CONNECT_BY_PATH : return "T_FUN_SYS_CONNECT_BY_PATH";
case T_FUN_SYS_SYSTIMESTAMP : return "T_FUN_SYS_SYSTIMESTAMP";