diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-03-13 16:12:54 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-03-13 16:12:54 +0400 |
commit | bc902a2bfc46add0708896c07621e3707f66d95f (patch) | |
tree | 5deb81037569c9a1cb32ad6cb988ad7ab86d9d5f /sql/handler.h | |
parent | 702fdc52fa02c5f20004d169ad48494122d8ffed (diff) | |
download | mariadb-git-bc902a2bfc46add0708896c07621e3707f66d95f.tar.gz |
MDEV-7387 [PATCH] Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
A contribution from Daniel Black, with minor additional enhancements.
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h index 4222270e9c4..2e219d5f3cc 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1637,6 +1637,33 @@ struct HA_CREATE_INFO bool table_was_deleted; bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; } + bool check_conflicting_charset_declarations(CHARSET_INFO *cs); + bool add_table_option_default_charset(CHARSET_INFO *cs) + { + // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT; + if (check_conflicting_charset_declarations(cs)) + return true; + default_table_charset= cs; + used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; + return false; + } + bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs) + { + /* + cs cannot be NULL, as sql_yacc.yy translates + CONVERT TO CHARACTER SET DEFAULT + to + CONVERT TO CHARACTER SET <character-set-of-the-current-database> + TODO: Should't we postpone resolution of DEFAULT until the + character set of the table owner database is loaded from its db.opt? + */ + DBUG_ASSERT(cs); + if (check_conflicting_charset_declarations(cs)) + return true; + table_charset= default_table_charset= cs; + used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET); + return false; + } }; |