MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:ramil Date:July 26 2005 7:18am
Subject:bk commit into 5.0 tree (ramil:1.1891) BUG#11546
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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.1891 05/07/26 12:18:35 ramil@stripped +3 -0
  a fix (bug #11546: Bad error message from inserting out of range values, SQL_MODE='tradition').

  sql/field.cc
    1.278 05/07/26 12:18:28 ramil@stripped +8 -2
    a fix (bug #11546: Bad error message from inserting out of range values, SQL_MODE='tradition').
    raise an error in case of strict mode for bit fields.

  mysql-test/t/strict.test
    1.16 05/07/26 12:18:28 ramil@stripped +11 -0
    a fix (bug #11546: Bad error message from inserting out of range values, SQL_MODE='tradition').

  mysql-test/r/strict.result
    1.22 05/07/26 12:18:28 ramil@stripped +7 -0
    a fix (bug #11546: Bad error message from inserting out of range values, SQL_MODE='tradition').

# 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:	ramil
# Host:	gw.mysql.r18.ru
# Root:	/usr/home/ram/work/5.0.b11546

--- 1.277/sql/field.cc	2005-07-20 22:16:40 +05:00
+++ 1.278/sql/field.cc	2005-07-26 12:18:28 +05:00
@@ -7846,7 +7846,10 @@
   {
     set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
     memset(ptr, 0xff, field_length);
-    set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+    if (table->in_use->really_abort_on_warning())
+      set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
+    else
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
     return 1;
   }
   /* delta is >= -1 here */
@@ -8063,7 +8066,10 @@
     memset(ptr, 0xff, field_length);
     if (bits)
       *ptr&= ((1 << bits) - 1); /* set first byte */
-    set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+    if (table->in_use->really_abort_on_warning())
+      set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
+    else
+      set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
     return 1;
   }
   bzero(ptr, delta);

--- 1.21/mysql-test/r/strict.result	2005-07-20 05:57:56 +05:00
+++ 1.22/mysql-test/r/strict.result	2005-07-26 12:18:28 +05:00
@@ -1258,3 +1258,10 @@
 d
 2000-10-01
 drop table t1;
+set @@sql_mode='traditional';
+create table t1(a bit(2));
+insert into t1 values(b'101');
+ERROR 22001: Data too long for column 'a' at row 1
+select * from t1;
+a
+drop table t1;

--- 1.15/mysql-test/t/strict.test	2005-07-20 04:36:42 +05:00
+++ 1.16/mysql-test/t/strict.test	2005-07-26 12:18:28 +05:00
@@ -1118,3 +1118,14 @@
 update t1 set d = 1100;
 select * from t1;
 drop table t1;
+
+#
+# BIT fields
+#
+
+set @@sql_mode='traditional';
+create table t1(a bit(2));
+--error 1406
+insert into t1 values(b'101');
+select * from t1;
+drop table t1;
Thread
bk commit into 5.0 tree (ramil:1.1891) BUG#11546ramil26 Jul