From 381fb617d398cb9588d5c95a0ec94b1351c4eb1e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sun, 15 Jun 2008 18:01:07 +0500 Subject: [PATCH 1/2] Bug #35934 mysql_upgrade calls mysqlcheck with insufficient parameters. Parameters added to the mysqlcheck call to fix table/database names. client/mysql_upgrade.c: Bug #35934 mysql_upgrade calls mysqlcheck with insufficient parameters. --fix-db-names and --fix-table-names added to the mysqlcheck call --- client/mysql_upgrade.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 6c5ca039a41..088115ec3ac 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -652,6 +652,8 @@ static int run_mysqlcheck_upgrade(void) "--check-upgrade", "--all-databases", "--auto-repair", + "--fix-db-names", + "--fix-table-names", NULL); } From 91f0c94c23eb9b48421d9590662666de9e4c75d5 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Wed, 3 Dec 2008 19:15:39 +0300 Subject: [PATCH 2/2] Fix for bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on windows. Visual Studio does not take into account some x86 hardware limitations which leads to incorrect results when converting large DOUBLE values to BIGINT UNSIGNED ones. Fixed by adding a workaround for double->ulonglong conversion on Windows. include/config-win.h: Added double2ulonglong(double) function implementing a workaround for broken double->ulonglong conversion on Windows/x86. include/my_global.h: Define double2ulonglong() as a simple typecast for anything but Windows. mysql-test/r/type_float.result: Added a test case for bug #27483. mysql-test/t/type_float.test: Added a test case for bug #27483. --- include/config-win.h | 9 +++++++++ include/my_global.h | 3 +++ mysql-test/r/type_float.result | 13 +++++++++++++ mysql-test/t/type_float.test | 17 +++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/include/config-win.h b/include/config-win.h index 2628095a181..eba699159c7 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -245,6 +245,15 @@ inline double ulonglong2double(ulonglong value) #define my_off_t2double(A) ulonglong2double(A) #endif /* _WIN64 */ +inline ulonglong double2ulonglong(double d) +{ + double t= d - (double) 0x8000000000000000ULL; + + if (t >= 0) + return ((ulonglong) t) + 0x8000000000000000ULL; + return (ulonglong) d; +} + #if SIZEOF_OFF_T > 4 #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) #define tell(A) _telli64(A) diff --git a/include/my_global.h b/include/my_global.h index e474b620d27..845ae042a42 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -713,6 +713,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) #endif +#ifndef double2ulonglong +#define double2ulonglong(A) ((ulonglong) (double) (A)) +#endif #endif #ifndef offsetof diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index f1075604ca9..e7f17bd75a7 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -392,4 +392,17 @@ f1 + 0e0 1.0000000150475e+30 -1.0000000150475e+30 drop table t1; +create table t1(d double, u bigint unsigned); +insert into t1(d) values (9.2233720368547777e+18), +(9.223372036854779e18), +(9.22337203685479e18), +(1.84e19); +update t1 set u = d; +select * from t1; +d u +9.22337203685478e+18 9223372036854775808 +9.22337203685478e+18 9223372036854779904 +9.22337203685479e+18 9223372036854790144 +1.84e+19 18400000000000000000 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 9aa8c00d24a..b23755b44fb 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -252,4 +252,21 @@ insert into t1 values (2e30), (-2e30); select f1 + 0e0 from t1; drop table t1; +# +# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on +# windows. +# + +create table t1(d double, u bigint unsigned); + +insert into t1(d) values (9.2233720368547777e+18), + (9.223372036854779e18), + (9.22337203685479e18), + (1.84e19); + +update t1 set u = d; +select * from t1; + +drop table t1; + --echo End of 5.0 tests