1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-15714 Remove the use of STRING_ITEM from the parser

This commit is contained in:
Alexander Barkov
2018-03-29 11:26:37 +04:00
parent b81a403e69
commit 2a13b3db50
6 changed files with 95 additions and 87 deletions

View File

@ -2495,8 +2495,8 @@ bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
}
Item *THD::make_string_literal(const char *str, size_t length,
uint repertoire)
Item_basic_constant *
THD::make_string_literal(const char *str, size_t length, uint repertoire)
{
if (!length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
return new (mem_root) Item_null(this, 0, variables.collation_connection);
@ -2517,7 +2517,8 @@ Item *THD::make_string_literal(const char *str, size_t length,
}
Item *THD::make_string_literal_nchar(const Lex_string_with_metadata_st &str)
Item_basic_constant *
THD::make_string_literal_nchar(const Lex_string_with_metadata_st &str)
{
DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
if (!str.length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
@ -2530,8 +2531,9 @@ Item *THD::make_string_literal_nchar(const Lex_string_with_metadata_st &str)
}
Item *THD::make_string_literal_charset(const Lex_string_with_metadata_st &str,
CHARSET_INFO *cs)
Item_basic_constant *
THD::make_string_literal_charset(const Lex_string_with_metadata_st &str,
CHARSET_INFO *cs)
{
if (!str.length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
return new (mem_root) Item_null(this, 0, cs);
@ -2540,34 +2542,6 @@ Item *THD::make_string_literal_charset(const Lex_string_with_metadata_st &str,
}
Item *THD::make_string_literal_concat(Item *item, const LEX_CSTRING &str)
{
if (item->type() == Item::NULL_ITEM)
{
DBUG_ASSERT(variables.sql_mode & MODE_EMPTY_STRING_IS_NULL);
if (str.length)
{
CHARSET_INFO *cs= variables.collation_connection;
uint repertoire= my_string_repertoire(cs, str.str, str.length);
return new (mem_root) Item_string(this, str.str, (uint)str.length, cs,
DERIVATION_COERCIBLE, repertoire);
}
return item;
}
DBUG_ASSERT(item->type() == Item::STRING_ITEM);
DBUG_ASSERT(item->basic_const_item());
static_cast<Item_string*>(item)->append(str.str, (uint)str.length);
if (!(item->collation.repertoire & MY_REPERTOIRE_EXTENDED))
{
// If the string has been pure ASCII so far, check the new part.
CHARSET_INFO *cs= variables.collation_connection;
item->collation.repertoire|= my_string_repertoire(cs, str.str, str.length);
}
return item;
}
/*
Update some cache variables when character set changes
*/