summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.(none)>2007-10-04 12:34:00 +0400
committerunknown <kaa@polly.(none)>2007-10-04 12:34:00 +0400
commit78348d4ed10a3a77870d956ad861c3fdcadd96a5 (patch)
treee84ac095560faabf900d89f9cf86b80c1815e1aa /sql/set_var.cc
parent2b8748ca6e35c95fb9b8a6f0b55227f7c1da3a0f (diff)
downloadmariadb-git-78348d4ed10a3a77870d956ad861c3fdcadd96a5.tar.gz
Issue a warning if a user sets an option or a variable to a value that is greater than a defined maximum for the option/variable.
This is for bug #29446 "Specifying a myisam_sort_buffer > 4GB on 64 bit machines not possible". Support for myisam_sort_buffer_size > 4 GB on 64-bit Windows will be looked at later in 5.2. mysql-test/r/variables.result: Fixed the test. mysql-test/t/variables.test: Fixed the test. mysys/my_getopt.c: Print a warning to the error log if a user sets an option to a value greater than the option's maximum value. sql/set_var.cc: Issue an SQL warning if a user assignes a value greater than the variable's maximum value.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index e1246617d84..5c76019efc6 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1532,16 +1532,31 @@ bool sys_var_thd_ulong::check(THD *thd, set_var *var)
bool sys_var_thd_ulong::update(THD *thd, set_var *var)
{
ulonglong tmp= var->save_result.ulonglong_value;
+ char buf[22];
+ bool truncated= false;
/* Don't use bigger value than given with --maximum-variable-name=.. */
if ((ulong) tmp > max_system_variables.*offset)
+ {
+ truncated= true;
+ llstr(tmp, buf);
tmp= max_system_variables.*offset;
+ }
#if SIZEOF_LONG == 4
/* Avoid overflows on 32 bit systems */
if (tmp > (ulonglong) ~(ulong) 0)
+ {
+ truncated= true;
+ llstr(tmp, buf);
tmp= ((ulonglong) ~(ulong) 0);
+ }
#endif
+ if (truncated)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER(ER_TRUNCATED_WRONG_VALUE), name,
+ buf);
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);