diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-02-15 01:39:37 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-03-16 21:11:21 +0530 |
commit | e15a5ca9e89153db7cc9ce978bb789a4038b7c25 (patch) | |
tree | 9c33fb2d815210f032e887af5da0f28c9d8c5301 /sql/sys_vars.cc | |
parent | a1542f8a57390bbad916ddfd335e1c751ffb3de5 (diff) | |
download | mariadb-git-e15a5ca9e89153db7cc9ce978bb789a4038b7c25.tar.gz |
MDEV-8334: Rename utf8 to utf8mb310.6-rucha-mdev-8334
This patch changes the main name of 3 byte character set from utf8 to
utf8mb3. New old_mode UTF8_IS_UTF8MB3 is added and set TRUE by default,
so that utf8 would mean utf8mb3. If not set, utf8 would mean utf8mb4.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index a75066271d9..2917dc517d0 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -760,8 +760,11 @@ static bool check_charset(sys_var *self, THD *thd, set_var *var) { ErrConvString err(res); /* Get utf8 '\0' terminated string */ if (!(var->save_result.ptr= get_charset_by_csname(err.ptr(), - MY_CS_PRIMARY, - MYF(0))) && + MY_CS_PRIMARY, + thd->variables.old_behavior & + OLD_MODE_UTF8_IS_UTF8MB3 ? + MYF(MY_UTF8_IS_UTF8MB3) : + MYF(0))) && !(var->save_result.ptr= get_old_charset_by_name(err.ptr()))) { my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr()); @@ -885,7 +888,11 @@ static bool check_collation_not_null(sys_var *self, THD *thd, set_var *var) else { ErrConvString err(res); /* Get utf8 '\0'-terminated string */ - if (!(var->save_result.ptr= get_charset_by_name(err.ptr(), MYF(0)))) + if (!(var->save_result.ptr= get_charset_by_name(err.ptr(), + thd->variables.old_behavior & + OLD_MODE_UTF8_IS_UTF8MB3 ? + MYF(MY_UTF8_IS_UTF8MB3) : + MYF(0)))) { my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr()); return true; @@ -3694,6 +3701,7 @@ static const char *old_mode_names[]= "NO_DUP_KEY_WARNINGS_WITH_IGNORE", "NO_PROGRESS_INFO", "ZERO_DATE_TIME_CAST", + "UTF8_IS_UTF8MB3", 0 }; @@ -3705,7 +3713,7 @@ static Sys_var_set Sys_old_behavior( "old_mode", "Used to emulate old behavior from earlier MariaDB or MySQL versions", SESSION_VAR(old_behavior), CMD_LINE(REQUIRED_ARG), - old_mode_names, DEFAULT(0)); + old_mode_names, DEFAULT(OLD_MODE_UTF8_IS_UTF8MB3)); #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #define SSL_OPT(X) CMD_LINE(REQUIRED_ARG,X) |