summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2018-06-20 17:14:04 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2018-06-20 17:14:04 +0400
commit621caad3ca007f84ae3d9216b8a23219b334347e (patch)
treea675a25703b3b4bae5a7b7153382a5d567b99e1a /sql/set_var.cc
parentd79bf0009a17f0020203003a97ce7e83449aeb3a (diff)
downloadmariadb-git-621caad3ca007f84ae3d9216b8a23219b334347e.tar.gz
MDEV-11917 enum/set command-line options aren't respecting max-*
settings.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index e96e636e3d3..77036fd0f5a 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -452,6 +452,22 @@ void sys_var::do_deprecated_warning(THD *thd)
@retval true on error, false otherwise (warning or ok)
*/
+
+
+bool throw_bounds_warning(THD *thd, const char *name,const char *v)
+{
+ if (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES)
+ {
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, v);
+ return true;
+ }
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), name, v);
+ return false;
+}
+
+
bool throw_bounds_warning(THD *thd, const char *name,
bool fixed, bool is_unsigned, longlong v)
{
@@ -469,9 +485,7 @@ bool throw_bounds_warning(THD *thd, const char *name,
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buf);
return true;
}
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), name, buf);
+ return throw_bounds_warning(thd, name, buf);
}
return false;
}
@@ -489,9 +503,7 @@ bool throw_bounds_warning(THD *thd, const char *name, bool fixed, double v)
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buf);
return true;
}
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), name, buf);
+ return throw_bounds_warning(thd, name, buf);
}
return false;
}