summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-10 09:25:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-10 09:25:20 +0300
commitda9201dd5bfbd5df68612c33e2b087705d44bec7 (patch)
treed6ea900e9f024c0836ca69f001557ac653cfb22a /sql/item_func.cc
parentaabd1c8fcbd19b9b0ec0fddea7071d815a984b12 (diff)
parent879c9ddce7fd89f06f538e380016b408e4f2a2f4 (diff)
downloadmariadb-git-da9201dd5bfbd5df68612c33e2b087705d44bec7.tar.gz
Merge 10.2 into 10.3
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 6a5cfeac118..53ea77db0c8 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1338,17 +1338,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();