From 60116981dc252ef1ab40c3ba0d02c44265864824 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 20 Sep 2024 08:48:52 +0200 Subject: [PATCH] sql/handler: referenced_by_foreign_key() returns bool The method was declared to return an unsigned integer, but it is really a boolean (and used as such by all callers). --- sql/ha_partition.h | 2 +- sql/handler.h | 2 +- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/handler/ha_innodb.h | 2 +- storage/mroonga/ha_mroonga.cpp | 12 ++++++------ storage/mroonga/ha_mroonga.hpp | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 6ed2f1ae3261d..c6a708aa933ff 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1465,7 +1465,7 @@ class ha_partition final :public handler virtual int get_foreign_key_list(THD *thd, List *f_key_list) - virtual uint referenced_by_foreign_key() + virtual bool referenced_by_foreign_key() */ bool can_switch_engines() override; /* diff --git a/sql/handler.h b/sql/handler.h index 3361a67c9a60b..d2556b292ddbd 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4552,7 +4552,7 @@ class handler :public Sql_alloc virtual int get_parent_foreign_key_list(const THD *thd, List *f_key_list) { return 0; } - virtual uint referenced_by_foreign_key() { return 0;} + virtual bool referenced_by_foreign_key() { return false;} virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c8ef77c3dbab0..ee0ada293cbdc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15640,7 +15640,7 @@ delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update. @return > 0 if referenced by a FOREIGN KEY */ -uint ha_innobase::referenced_by_foreign_key() +bool ha_innobase::referenced_by_foreign_key() { dict_sys.freeze(SRW_LOCK_CALL); const bool empty= m_prebuilt->table->referenced_set.empty(); diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 295d7d997a74f..83a555d82183b 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -219,7 +219,7 @@ class ha_innobase final : public handler bool can_switch_engines() override; - uint referenced_by_foreign_key() override; + bool referenced_by_foreign_key() override; void free_foreign_key_create_info(char* str) override { my_free(str); } diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index f1be6475b1b69..87f91d2a8ea5c 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -16846,10 +16846,10 @@ int ha_mroonga::get_parent_foreign_key_list(const THD *thd, DBUG_RETURN(res); } -uint ha_mroonga::wrapper_referenced_by_foreign_key() +bool ha_mroonga::wrapper_referenced_by_foreign_key() { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); res = wrap_handler->referenced_by_foreign_key(); @@ -16858,17 +16858,17 @@ uint ha_mroonga::wrapper_referenced_by_foreign_key() DBUG_RETURN(res); } -uint ha_mroonga::storage_referenced_by_foreign_key() +bool ha_mroonga::storage_referenced_by_foreign_key() { MRN_DBUG_ENTER_METHOD(); - uint res = handler::referenced_by_foreign_key(); + bool res = handler::referenced_by_foreign_key(); DBUG_RETURN(res); } -uint ha_mroonga::referenced_by_foreign_key() +bool ha_mroonga::referenced_by_foreign_key() { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; if (share->wrapper_mode) { res = wrapper_referenced_by_foreign_key(); diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index ea34394f8cb27..bd40afdec9c73 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -620,7 +620,7 @@ class ha_mroonga: public handler bool can_switch_engines() mrn_override; int get_foreign_key_list(const THD *thd, List *f_key_list) mrn_override; int get_parent_foreign_key_list(const THD *thd, List *f_key_list) mrn_override; - uint referenced_by_foreign_key() mrn_override; + bool referenced_by_foreign_key() mrn_override; void init_table_handle_for_HANDLER() mrn_override; void free_foreign_key_create_info(char* str) mrn_override; #ifdef MRN_HAVE_HA_REBIND_PSI @@ -1274,8 +1274,8 @@ class ha_mroonga: public handler int storage_get_foreign_key_list(const THD *thd, List *f_key_list); int wrapper_get_parent_foreign_key_list(const THD *thd, List *f_key_list); int storage_get_parent_foreign_key_list(const THD *thd, List *f_key_list); - uint wrapper_referenced_by_foreign_key(); - uint storage_referenced_by_foreign_key(); + bool wrapper_referenced_by_foreign_key(); + bool storage_referenced_by_foreign_key(); void wrapper_init_table_handle_for_HANDLER(); void storage_init_table_handle_for_HANDLER(); void wrapper_free_foreign_key_create_info(char* str);