diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index d11b56f2aad..5deeccc9265 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1423,17 +1423,22 @@ bool Item_func_minus::fix_length_and_dec() { if (Item_num_op::fix_length_and_dec()) return TRUE; - m_sql_mode_dependency= Item_func::value_depends_on_sql_mode(); - if (unsigned_flag) - { - m_sql_mode_dependency|= Sql_mode_dependency(0,MODE_NO_UNSIGNED_SUBTRACTION); - if (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION) - unsigned_flag= false; - } + if ((m_depends_on_sql_mode_no_unsigned_subtraction= unsigned_flag) && + (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION)) + unsigned_flag= false; return FALSE; } +Sql_mode_dependency Item_func_minus::value_depends_on_sql_mode() const +{ + Sql_mode_dependency dep= Item_func_additive_op::value_depends_on_sql_mode(); + if (m_depends_on_sql_mode_no_unsigned_subtraction) + dep|= Sql_mode_dependency(0, MODE_NO_UNSIGNED_SUBTRACTION); + return dep; +} + + double Item_func_minus::real_op() { double value= args[0]->val_real() - args[1]->val_real(); |