summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-12 16:36:46 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-12 16:36:46 +0300
commitd28686ada6f72035f23b83960e63599f50fbc38d (patch)
treec7295d08ffa9f27d7f8b19b5741b286acaa40b9b /sql/item_func.cc
parent9d26f3dabb8299149af99faafa52398cce44e610 (diff)
parent60c04be6599597548ad07ce11e1d7d4004a7cc9c (diff)
downloadmariadb-git-d28686ada6f72035f23b83960e63599f50fbc38d.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 88f36cf1e98..10ac0f74644 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1235,17 +1235,22 @@ bool Item_func_minus::fix_length_and_dec()
if (Item_func_minus::type_handler()->Item_func_minus_fix_length_and_dec(this))
DBUG_RETURN(TRUE);
DBUG_PRINT("info", ("Type: %s", type_handler()->name().ptr()));
- 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;
DBUG_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();