From 59a39534b5178a47ef495c3398aec2905bbbf3ab Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2005 18:30:40 +0200 Subject: [PATCH] After merge fixes mysql-test/r/strict.result: Update tests after merge mysql-test/t/strict.test: Update tests after merge (We can't handle 2.2E-307) anymore as this is out of range with the new method to calculate double sql/item_sum.h: After merge fix use my_strtoll10 instead of my_strtonll --- mysql-test/r/strict.result | 12 +++++++----- mysql-test/t/strict.test | 4 ++-- sql/item_sum.h | 14 ++++++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 69e4b082422..c28ea0fce02 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -852,8 +852,8 @@ NULL NULL 3.40282e+38 0 DROP TABLE t1; CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED); -INSERT INTO t1 VALUES (-2.2E-307,0),(+1.7E+308,+1.7E+308); -INSERT INTO t1 VALUES ('-2.2E-307',0),('+1.7E+308','+1.7E+308'); +INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308); +INSERT INTO t1 VALUES ('-2.2E-307',0),('-2E-307',0),('+1.7E+308','+1.7E+308'); INSERT INTO t1 (col1) VALUES (-2.2E-330); INSERT INTO t1 (col1) VALUES (+1.7E+309); Got one of the listed errors @@ -864,7 +864,7 @@ ERROR 22003: Out of range value adjusted for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.2E-3'); ERROR 22003: Out of range value adjusted for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 2 +ERROR 22003: Out of range value adjusted for column 'col1' at row 3 UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -890,9 +890,11 @@ Warning 1264 Out of range value adjusted for column 'col2' at row 1 Warning 1264 Out of range value adjusted for column 'col2' at row 1 SELECT * FROM t1; col1 col2 --2.2e-307 0 +0 0 +1e-303 0 1.7e+308 1.7e+308 --2.2e-307 0 +0 0 +-2e-307 0 1.7e+308 1.7e+308 0 NULL 2 NULL diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index d8833f6f914..d3928a623f4 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -828,8 +828,8 @@ DROP TABLE t1; # Test INSERT with DOUBLE CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED); -INSERT INTO t1 VALUES (-2.2E-307,0),(+1.7E+308,+1.7E+308); -INSERT INTO t1 VALUES ('-2.2E-307',0),('+1.7E+308','+1.7E+308'); +INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308); +INSERT INTO t1 VALUES ('-2.2E-307',0),('-2E-307',0),('+1.7E+308','+1.7E+308'); # We don't give warnings for underflow INSERT INTO t1 (col1) VALUES (-2.2E-330); --error 1367,1264 diff --git a/sql/item_sum.h b/sql/item_sum.h index c3eae176b1f..eca2ae188db 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -691,7 +691,6 @@ public: { int err_not_used; char *end_not_used; - char *end_not_used; String *res; res=val_str(&str_value); return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(), @@ -700,9 +699,16 @@ public: longlong val_int() { int err_not_used; - String *res; res=val_str(&str_value); - return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10, - (char**) 0, &err_not_used) : (longlong) 0; + char *end; + String *res; + longlong value; + CHARSET_INFO *cs; + + if (!(res= val_str(&str_value))) + return 0; /* Null value */ + cs= res->charset(); + end= (char*) res->ptr()+res->length(); + return cs->cset->my_strtoll10(cs, res->ptr(), &end, &err_not_used); } my_decimal *val_decimal(my_decimal *dec); enum Item_result result_type () const { return STRING_RESULT; }