diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-05-02 12:58:25 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-05-02 12:58:25 +0400 |
commit | 07143a73935494056d187bd9da0a5097715d952c (patch) | |
tree | 5a572c1880219b929df2902ed5036209c6a3d2a4 /sql/sql_class.cc | |
parent | 85b73e2254359823515536075e7e20738a732ec1 (diff) | |
download | mariadb-git-07143a73935494056d187bd9da0a5097715d952c.tar.gz |
MDEV-12659 Add THD::make_string_literal()
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index f61e1f0885e..8793dd9b409 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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 */ |