MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:September 28 2006 12:00pm
Subject:bk commit into 5.0 tree (ramil:1.2273) BUG#22271
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@stripped, 2006-09-28 17:00:29+05:00, ramil@stripped +3 -0
  Fix for bug #22271: data casting may affect data stored in the next column(s?)
  
  Using wrong filling value may cause unneeded extra bit rewriting.
  
  Fix: use proper value to fill uneven bits.

  mysql-test/r/type_bit.result@stripped, 2006-09-28 17:00:25+05:00, ramil@stripped +8 -0
    Fix for bug #22271: data casting may affect data stored in the next column(s?)
      - test case.

  mysql-test/t/type_bit.test@stripped, 2006-09-28 17:00:25+05:00, ramil@stripped +8 -0
    Fix for bug #22271: data casting may affect data stored in the next column(s?)
      - test result.

  sql/field.cc@stripped, 2006-09-28 17:00:25+05:00, ramil@stripped +1 -1
    Fix for bug #22271: data casting may affect data stored in the next column(s?)
      - use ((1 << bit_len) - 1) instead of 0xff to fill uneven bits 
        in order not to change other's bits.

# 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:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/bug22271/my50-bug22271

--- 1.323/sql/field.cc	2006-09-28 17:00:38 +05:00
+++ 1.324/sql/field.cc	2006-09-28 17:00:38 +05:00
@@ -7921,7 +7921,7 @@ int Field_bit::store(const char *from, u
       (delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) ||
       (!bit_len && delta < 0))
   {
-    set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
+    set_rec_bits((1 << bit_len) - 1, bit_ptr, bit_ofs, bit_len);
     memset(ptr, 0xff, bytes_in_rec);
     if (table->in_use->really_abort_on_warning())
       set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);

--- 1.17/mysql-test/r/type_bit.result	2006-09-28 17:00:38 +05:00
+++ 1.18/mysql-test/r/type_bit.result	2006-09-28 17:00:38 +05:00
@@ -602,4 +602,12 @@ NULL	NULL
 0	0
 11111111	11111111
 drop table bug15583;
+create table t1(a bit(1), b smallint unsigned);
+insert into t1 (b, a) values ('2', '1');
+Warnings:
+Warning	1264	Out of range value adjusted for column 'a' at row 1
+select hex(a), b from t1;
+hex(a)	b
+1	2
+drop table t1;
 End of 5.0 tests

--- 1.16/mysql-test/t/type_bit.test	2006-09-28 17:00:38 +05:00
+++ 1.17/mysql-test/t/type_bit.test	2006-09-28 17:00:38 +05:00
@@ -252,5 +252,13 @@ select hex(b + 0), bin(b + 0), oct(b + 0
 select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
 drop table bug15583;
 
+#
+# Bug #22271: data casting may affect data stored in the next column(s?)
+#
+
+create table t1(a bit(1), b smallint unsigned);
+insert into t1 (b, a) values ('2', '1');
+select hex(a), b from t1;
+drop table t1;
 
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (ramil:1.2273) BUG#22271ramil28 Sep