List:Commits« Previous MessageNext Message »
From:holyfoot Date:March 3 2006 1:40pm
Subject:bk commit into 5.0 tree (holyfoot:1.2100)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2100 06/03/03 16:39:58 holyfoot@deer.(none) +3 -0
  buf 15480 (Warning message contains junk)
  error message here expected the null-terminating line

  sql/field.cc
    1.301 06/03/03 16:38:34 holyfoot@stripped +12 -13
    now we make a copy of the value in 'buff', add terminating \0
    and send it to the push_warning

  mysql-test/t/type_newdecimal.test
    1.35 06/03/03 16:38:34 holyfoot@stripped +9 -0
    testcase added

  mysql-test/r/type_newdecimal.result
    1.38 06/03/03 16:38:34 holyfoot@stripped +8 -0
    result fixed

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	holyfoot
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-5.0.15480

--- 1.300/sql/field.cc	Mon Feb 27 16:50:29 2006
+++ 1.301/sql/field.cc	Fri Mar  3 16:38:34 2006
@@ -2410,15 +2410,21 @@
 
   if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
                       ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
-                      from, length, charset,  &decimal_value)) &&
-      table->in_use->abort_on_warning)
+                      from, length, charset,  &decimal_value)))
   {
-    push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_ERROR,
+    char buff[MYSQL_ERRMSG_SIZE];
+    strmake(buff, from, min(length, sizeof(buff)-1));
+    push_warning_printf(table->in_use,
+                        table->in_use->abort_on_warning ?
+                          MYSQL_ERROR::WARN_LEVEL_ERROR :
+                          MYSQL_ERROR::WARN_LEVEL_WARN,
                         ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
                         ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
-                        "decimal", from, field_name,
+                        "decimal", buff, field_name,
                         (ulong) table->in_use->row_count);
-    DBUG_RETURN(err);
+    if (table->in_use->abort_on_warning)
+      DBUG_RETURN(err);
+    my_decimal_set_zero(&decimal_value);
   }
 
   switch (err) {
@@ -2429,14 +2435,7 @@
     set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
     set_value_on_overflow(&decimal_value, decimal_value.sign());
     break;
-  case E_DEC_BAD_NUM:
-    push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
-                        ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
-                        ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
-                        "decimal", from, field_name,
-                        (ulong) table->in_use->row_count);
-    my_decimal_set_zero(&decimal_value);
-    break;
+  default:;
   }
 
 #ifndef DBUG_OFF

--- 1.37/mysql-test/r/type_newdecimal.result	Tue Nov 29 16:42:38 2005
+++ 1.38/mysql-test/r/type_newdecimal.result	Fri Mar  3 16:38:34 2006
@@ -1397,3 +1397,11 @@
 9999999999999999999999999999999999999999999999999999999999999999
 9999999999999999999999999999999999999999999999999999999999999999
 drop table t1;
+CREATE TABLE t1(c DECIMAL(64, 2));
+INSERT INTO t1 VALUES (REPEAT('a', 100));
+Warnings:
+Warning	1366	Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for column 'c' at row 1
+SHOW WARNINGS;
+Level	Code	Message
+Warning	1366	Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for column 'c' at row 1
+DROP TABLE t1;

--- 1.34/mysql-test/t/type_newdecimal.test	Tue Nov 29 16:42:38 2005
+++ 1.35/mysql-test/t/type_newdecimal.test	Fri Mar  3 16:38:34 2006
@@ -1085,3 +1085,12 @@
 insert into t1 values(1e100);
 select * from t1;
 drop table t1;
+
+#
+# Bug #15480 (Warning message contains junk)
+#
+CREATE TABLE t1(c DECIMAL(64, 2));
+INSERT INTO t1 VALUES (REPEAT('a', 100));
+SHOW WARNINGS;
+DROP TABLE t1;
+
Thread
bk commit into 5.0 tree (holyfoot:1.2100)holyfoot3 Mar