From 5282d0dce163f73691c2ca9a1a5a951fa47563b2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 23 Feb 2018 11:40:24 +0100 Subject: [PATCH] cleanup: use enum, not uint, for enum variables --- sql/sql_class.h | 6 ++++-- storage/innobase/handler/handler0alter.cc | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 9f2185cfbd7..e5f9328703f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -362,11 +362,13 @@ public: LEX_CSTRING ref_db; LEX_CSTRING ref_table; List ref_columns; - uint delete_opt, update_opt, match_opt; + enum enum_fk_option delete_opt, update_opt; + enum fk_match_opt match_opt; Foreign_key(const LEX_CSTRING *name_arg, List *cols, const LEX_CSTRING *ref_db_arg, const LEX_CSTRING *ref_table_arg, List *ref_cols, - uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg, + enum_fk_option delete_opt_arg, enum_fk_option update_opt_arg, + fk_match_opt match_opt_arg, DDL_options ddl_options) :Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols, NULL, ddl_options), diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 5519d8304b9..bbc3d8b95b9 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1383,7 +1383,6 @@ innobase_set_foreign_key_option( ut_ad(!foreign->type); switch (fk_key->delete_opt) { - // JAN: TODO: ? MySQL 5.7 used enum fk_option directly from sql_lex.h case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: @@ -1395,6 +1394,8 @@ innobase_set_foreign_key_option( case FK_OPTION_SET_NULL: foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; break; + case FK_OPTION_UNDEF: + DBUG_ASSERT(0); } switch (fk_key->update_opt) { @@ -1409,6 +1410,8 @@ innobase_set_foreign_key_option( case FK_OPTION_SET_NULL: foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; break; + case FK_OPTION_UNDEF: + DBUG_ASSERT(0); } return(innobase_check_fk_option(foreign));