diff options
author | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2007-12-01 19:55:06 +0100 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2007-12-01 19:55:06 +0100 |
commit | 58f10e554aa2ce340e853be1006e1f411f89f09d (patch) | |
tree | aaa884036bc8a904f4d1b5f375f6d3c7376393e3 /sql/sql_plugin.cc | |
parent | 54ad7d88d03c940330510e0870e4bce17327a952 (diff) | |
download | mariadb-git-58f10e554aa2ce340e853be1006e1f411f89f09d.tar.gz |
Bug#31177: Server variables can't be set to their current values
5.1+ specific fixes (plugins etc.)
include/my_getopt.h:
make both ull and ll global
mysql-test/r/index_merge_myisam.result:
we throw warnings to the client, yea, verily
mysql-test/r/innodb.result:
we throw warnings to the client, yea, verily
mysql-test/r/variables.result:
we throw warnings to the client, yea, verily
mysql-test/t/variables.test:
correct result, is multiple of variable's block_size now
mysys/my_getopt.c:
export getopt_ll_limit_value(), check for integer wrap-around
in it, same as in ull variant. Only print warnings to reporter
when caller didn't ask for diagnostics, otherwise assume caller
will handle any warnings (id est, throw them client-wards)
sql/mysqld.cc:
correct signedness of "concurrent-insert"
sql/sql_plugin.cc:
Throw sys-var out-of-range warnings client-wards for
plugins, too.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2af528f6699..07bf313067a 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1874,11 +1874,20 @@ err: static int check_func_int(THD *thd, struct st_mysql_sys_var *var, void *save, st_mysql_value *value) { + bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); plugin_opt_set_limits(&options, var); - *(int *)save= (int) getopt_ull_limit_value(tmp, &options); + *(int *)save= (int) getopt_ull_limit_value(tmp, &options, &fixed); + if (fixed) + { + char buf[22]; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), var->name, + ullstr(tmp, buf)); + } return (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES) && (*(int *)save != (int) tmp); } @@ -1887,24 +1896,42 @@ static int check_func_int(THD *thd, struct st_mysql_sys_var *var, static int check_func_long(THD *thd, struct st_mysql_sys_var *var, void *save, st_mysql_value *value) { + bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); plugin_opt_set_limits(&options, var); - *(long *)save= (long) getopt_ull_limit_value(tmp, &options); + *(long *)save= (long) getopt_ull_limit_value(tmp, &options, &fixed); + if (fixed) + { + char buf[22]; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), var->name, + ullstr(tmp, buf)); + } return (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES) && (*(long *)save != (long) tmp); } static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var, - void *save, st_mysql_value *value) + void *save, st_mysql_value *value) { + bool fixed; long long tmp; struct my_option options; value->val_int(value, &tmp); plugin_opt_set_limits(&options, var); - *(ulonglong *)save= getopt_ull_limit_value(tmp, &options); + *(ulonglong *)save= getopt_ull_limit_value(tmp, &options, &fixed); + if (fixed) + { + char buf[22]; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), var->name, + ullstr(tmp, buf)); + } return (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES) && (*(long long *)save != tmp); } |