1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-12659 Add THD::make_string_literal()

This commit is contained in:
Alexander Barkov
2017-05-02 12:58:25 +04:00
parent 85b73e2254
commit 07143a7393
4 changed files with 36 additions and 42 deletions

View File

@ -2352,6 +2352,26 @@ bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
}
Item_string *THD::make_string_literal(const char *str, size_t length,
uint repertoire)
{
if (!charset_is_collation_connection &&
(repertoire != MY_REPERTOIRE_ASCII ||
!my_charset_is_ascii_based(variables.collation_connection)))
{
LEX_STRING to;
if (convert_string(&to, variables.collation_connection,
str, length, variables.character_set_client))
return NULL;
str= to.str;
length= to.length;
}
return new (mem_root) Item_string(this, str, length,
variables.collation_connection,
DERIVATION_COERCIBLE, repertoire);
}
/*
Update some cache variables when character set changes
*/