From ceec63f18aa0c2e4ee9c5f667cca3f1ffdeda15d Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 16 Mar 2004 16:35:47 +0100 Subject: [PATCH 1/2] EOVERFLOW moved to my_base.h - it is used not only in strtod.c error message corrected --- include/my_base.h | 5 +++++ mysql-test/r/variables.result | 10 +++++----- mysql-test/t/variables.test | 10 +++++----- sql/item_func.cc | 6 ------ sql/sql_yacc.yy | 10 ++++++++-- strings/strtod.c | 4 ---- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/my_base.h b/include/my_base.h index 89b46de520f..e2b6d010d69 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -28,6 +28,11 @@ #include #include #include + +#ifndef EOVERFLOW +#define EOVERFLOW 84 +#endif + #ifdef MSDOS #include /* Neaded for sopen() */ #endif diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index c56ccc3641a..0e1babf258b 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -407,12 +407,12 @@ select @a, @b; @a @b 2 1 set @@global.global.key_buffer_size= 1; -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1 set GLOBAL global.key_buffer_size= 1; -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1 SELECT @@global.global.key_buffer_size; -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1 SELECT @@global.session.key_buffer_size; -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1 SELECT @@global.local.key_buffer_size; -ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 78fab3afe42..1ad171f94f6 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -289,13 +289,13 @@ select @a, @b; # # Bug#2586:Disallow global/session/local as structured var. instance names # ---error 1149 +--error 1064 set @@global.global.key_buffer_size= 1; ---error 1149 +--error 1064 set GLOBAL global.key_buffer_size= 1; ---error 1149 +--error 1064 SELECT @@global.global.key_buffer_size; ---error 1149 +--error 1064 SELECT @@global.session.key_buffer_size; ---error 1149 +--error 1064 SELECT @@global.local.key_buffer_size; diff --git a/sql/item_func.cc b/sql/item_func.cc index 88c2bf824c6..ae44bc552d3 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2967,12 +2967,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name, (uint) strlen(server_version), system_charset_info); - if (name.str && component.str && check_reserved_words(&name)) - { - net_printf(thd, ER_SYNTAX_ERROR); - return 0; - } - Item *item; sys_var *var; char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0f9147b7834..a625040d4e2 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2508,7 +2508,7 @@ simple_expr: $$= new Item_func_set_collation($1, new Item_string($3.str, $3.length, - YYTHD->charset())); + YYTHD->charset())); } | literal | param_marker @@ -2524,6 +2524,12 @@ simple_expr: } | '@' '@' opt_var_ident_type ident_or_text opt_component { + + if ($4.str && $5.str && check_reserved_words(&$4)) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } if (!($$= get_system_var(YYTHD, (enum_var_type) $3, $4, $5))) YYABORT; } @@ -5036,7 +5042,7 @@ internal_variable_name: { if (check_reserved_words(&$1)) { - net_printf(YYTHD, ER_SYNTAX_ERROR); + yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; } sys_var *tmp=find_sys_var($3.str, $3.length); diff --git a/strings/strtod.c b/strings/strtod.c index aa0f7aa4336..bc8105b8040 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -29,10 +29,6 @@ #include "my_base.h" /* Includes errno.h */ #include "m_ctype.h" -#ifndef EOVERFLOW -#define EOVERFLOW 84 -#endif - static double scaler10[] = { 1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90 }; From 7dde35ae19cbd381948f3fc3cee2399721f7bf04 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Tue, 16 Mar 2004 16:35:49 +0100 Subject: [PATCH 2/2] warnings removed --- sql/field.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index c4aef133e6d..cd761004ad6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -107,7 +107,7 @@ bool test_if_int(const char *str, int length, const char *int_end, return 1; } - +#ifdef NOT_USED static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) { cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct @@ -159,7 +159,7 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) } return 1; } - +#endif static inline uint field_length_without_space(const char *ptr, uint length) { @@ -2273,7 +2273,7 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs) int err; char *end; double nr= my_strntod(cs,(char*) from,len,&end,&err); - if (!err && (!current_thd->count_cuted_fields || end-from==len)) + if (!err && (!current_thd->count_cuted_fields || end-from==(int)len)) { return Field_float::store(nr); } @@ -2570,8 +2570,8 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs) { int err; char *end; - double nr= my_strntod(cs,(char*) from,len,&end,&err); - if (!err && (!current_thd->count_cuted_fields || end-from==len)) + double nr= my_strntod(cs,(char*) from,len,&end,&err); + if (!err && (!current_thd->count_cuted_fields || end-from==(int)len)) { return Field_double::store(nr); }