diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index 482f95140..f6a0760d7 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -2367,10 +2367,7 @@ int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table) thd->lex->sql_command == SQLCOM_LOAD)) return HA_ERR_END_OF_FILE; - if ((thd->lex->sql_command == SQLCOM_UPDATE) || - (thd->lex->sql_command == SQLCOM_DELETE) || - (thd->lex->sql_command == SQLCOM_DELETE_MULTI) || - ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI) && !isForeignTableUpdate(thd))) + if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd))) return HA_ERR_END_OF_FILE; // @bug 2547 @@ -2463,10 +2460,7 @@ int ha_mcs_impl_rnd_end(TABLE* table, bool is_pushdown_hand) if ( (thd->lex)->sql_command == SQLCOM_ALTER_TABLE ) return rc; - if ((thd->lex->sql_command == SQLCOM_UPDATE) || - (thd->lex->sql_command == SQLCOM_DELETE) || - (thd->lex->sql_command == SQLCOM_DELETE_MULTI) || - ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI) && !isForeignTableUpdate(thd))) + if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd))) return rc; if (!ci) @@ -4312,10 +4306,7 @@ int ha_mcs_impl_group_by_next(TABLE* table) { THD* thd = current_thd; - if ((thd->lex->sql_command == SQLCOM_UPDATE) || - (thd->lex->sql_command == SQLCOM_DELETE) || - (thd->lex->sql_command == SQLCOM_DELETE_MULTI) || - (thd->lex->sql_command == SQLCOM_UPDATE_MULTI && !isForeignTableUpdate(thd))) + if (isUpdateOrDeleteStatement(thd->lex->sql_command, !isForeignTableUpdate(thd))) return HA_ERR_END_OF_FILE; if (get_fe_conn_info_ptr() == nullptr) diff --git a/dbcon/mysql/ha_mcs_impl_if.h b/dbcon/mysql/ha_mcs_impl_if.h index b0f3106f7..c9470cd17 100644 --- a/dbcon/mysql/ha_mcs_impl_if.h +++ b/dbcon/mysql/ha_mcs_impl_if.h @@ -411,10 +411,10 @@ bool buildEqualityPredicate(execplan::ReturnedColumn* lhs, const std::vector& itemList, bool isInSubs = false); -inline bool isUpdateStatement(const enum_sql_command& command) +inline bool isUpdateStatement(const enum_sql_command& command, const bool isMCSTableUpdate = true) { return (command == SQLCOM_UPDATE) || - (command == SQLCOM_UPDATE_MULTI); + (command == SQLCOM_UPDATE_MULTI && isMCSTableUpdate); } inline bool isDeleteStatement(const enum_sql_command& command) @@ -423,9 +423,9 @@ inline bool isDeleteStatement(const enum_sql_command& command) (command == SQLCOM_DELETE_MULTI); } -inline bool isUpdateOrDeleteStatement(const enum_sql_command& command) +inline bool isUpdateOrDeleteStatement(const enum_sql_command& command, const bool isMCSTableUpdate = true) { - return isUpdateStatement(command) || + return isUpdateStatement(command, isMCSTableUpdate) || isDeleteStatement(command); }