Fix charset bugs

This commit is contained in:
xianyu-w
2023-05-26 13:41:07 +00:00
committed by ob-robot
parent d9e3c7357d
commit 7b653160ff
4 changed files with 40 additions and 16 deletions

View File

@ -772,11 +772,18 @@ expr opt_as column_label
if (0 == $3->str_len_) {
alias_name_node->str_value_ = NULL;
alias_name_node->str_len_ = 0;
alias_name_node->sql_str_off_ = $3->sql_str_off_;
} else if (result->is_not_utf8_connection_) {
alias_name_node->str_value_ = parse_str_convert_utf8(result->charset_info_, $3->str_value_,
result->malloc_pool_, &(alias_name_node->str_len_),
&(result->extra_errno_));
if (OB_PARSER_ERR_ILLEGAL_NAME == result->extra_errno_) {
yyerror(NULL, result, "alias '%s' is illegal\n", $3->str_value_);
YYABORT_UNEXPECTED;
}
} else {
dup_node_string($3, alias_name_node, result->malloc_pool_);
alias_name_node->sql_str_off_ = $3->sql_str_off_;
}
alias_name_node->sql_str_off_ = $3->sql_str_off_;
malloc_non_terminal_node(alias_node, result->malloc_pool_, T_ALIAS, 2, $1, alias_name_node);
malloc_non_terminal_node($$, result->malloc_pool_, T_EXPR_WITH_ALIAS, 1, alias_node);
@ -9988,6 +9995,14 @@ expr %prec LOWER_PARENS
if (NULL == $3->str_value_) {
alias_name_node->str_value_ = NULL;
alias_name_node->str_len_ = 0;
} else if (result->is_not_utf8_connection_) {
alias_name_node->str_value_ = parse_str_convert_utf8(result->charset_info_, $3->str_value_,
result->malloc_pool_, &(alias_name_node->str_len_),
&(result->extra_errno_));
if (OB_PARSER_ERR_ILLEGAL_NAME == result->extra_errno_) {
yyerror(NULL, result, "alias '%s' is illegal\n", $3->str_value_);
YYABORT_UNEXPECTED;
}
} else {
dup_node_string($3, alias_name_node, result->malloc_pool_);
}