diff options
-rw-r--r-- | libmysql/libmysql.c | 4 | ||||
-rw-r--r-- | myisam/mi_check.c | 4 | ||||
-rw-r--r-- | mysql-test/r/func_math.result | 6 | ||||
-rw-r--r-- | mysql-test/t/func_math.test | 8 | ||||
-rw-r--r-- | sql/item_func.cc | 3 |
5 files changed, 21 insertions, 4 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index f86435712dc..f2d77d495c9 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2112,8 +2112,8 @@ static my_bool mysql_reconnect(MYSQL *mysql) { /* Allow reconnect next time */ mysql->server_status&= ~SERVER_STATUS_IN_TRANS; - mysql->net.last_errno=CR_SERVER_GONE_ERROR; - strmov(mysql->net.last_error,ER(mysql->net.last_errno)); + mysql->net.last_errno= CR_SERVER_GONE_ERROR; + strmov(mysql->net.last_error, ER(mysql->net.last_errno)); DBUG_RETURN(1); } mysql_init(&tmp_mysql); diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 8581f79c99d..61c98eb526f 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -112,7 +112,9 @@ int chk_status(MI_CHECK *param, register MI_INFO *info) /* Don't count this as a real warning, as check can correct this ! */ uint save=param->warning_printed; mi_check_print_warning(param, - "%d clients is using or hasn't closed the table properly", + share->state.open_count==1 ? + "%d client is using or hasn't closed the table properly" : + "%d clients are using or haven't closed the table properly", share->state.open_count); /* If this will be fixed by the check, forget the warning */ if (param->testflag & T_UPDATE_STATE) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 46ad7a14e25..1b6a0d43738 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -59,3 +59,9 @@ ASIN(0.8+0.2) SELECT ASIN(1.2-0.2); ASIN(1.2-0.2) 1.570796 +floor(log(4)/log(2)) +2 +floor(log(8)/log(2)) +3 +floor(log(16)/log(2)) +4 diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 2de692d4389..7057b0ca412 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -28,3 +28,11 @@ SELECT ACOS(0.2*5.0); SELECT ACOS(0.5*2.0); SELECT ASIN(0.8+0.2); SELECT ASIN(1.2-0.2); + +# +# Bug #3051 FLOOR returns invalid +# + +select floor(log(4)/log(2)); +select floor(log(8)/log(2)); +select floor(log(16)/log(2)); diff --git a/sql/item_func.cc b/sql/item_func.cc index 656dff63609..2d69e29991a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -667,7 +667,8 @@ longlong Item_func_ceiling::val_int() longlong Item_func_floor::val_int() { - double value=args[0]->val(); + // the volatile's for BUG #3051 to calm optimizer down (because of gcc's bug) + volatile double value=args[0]->val(); null_value=args[0]->null_value; return (longlong) floor(value); } |