Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller 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.2098 06/03/02 19:59:49 cmiller@zippy.(none) +3 -0
Expanding a binary field should result in 0x00-filled positions, not 0x20
(ASCII space). For Bug#16857.
sql/field_conv.cc
1.53 06/03/02 19:59:45 cmiller@zippy.(none) +17 -1
Bug#16857: Do not expand BINARY fields as if they are strings (which
presumably /should/ be filled with spaces). Instead, fill BINARY fields
with 0x00 bytes.
mysql-test/t/binary.test
1.16 06/03/02 19:59:45 cmiller@zippy.(none) +12 -0
Expanding a binary field should result in 0x00-filled positions, not 0x20
(ASCII space). For Bug#16857.
mysql-test/r/binary.result
1.21 06/03/02 19:59:45 cmiller@zippy.(none) +19 -0
Expanding a binary field should result in 0x00-filled positions, not 0x20
(ASCII space). For Bug#16857.
# 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: cmiller
# Host: zippy.(none)
# Root: /home/cmiller/work/mysql/mysql-5.0__bug16857
--- 1.52/sql/field_conv.cc 2005-09-23 03:18:52 -04:00
+++ 1.53/sql/field_conv.cc 2006-03-02 19:59:45 -05:00
@@ -379,6 +379,16 @@
+static void do_expand_binary(Copy_field *copy)
+{
+ CHARSET_INFO *cs= copy->from_field->charset();
+ memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
+ cs->cset->fill(cs, copy->to_ptr+copy->from_length,
+ copy->to_length-copy->from_length, '\0');
+}
+
+
+
static void do_expand_string(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
@@ -583,7 +593,13 @@
return (from->charset()->mbmaxlen == 1 ?
do_cut_string : do_cut_string_complex);
else if (to_length > from_length)
- return do_expand_string;
+ {
+ if ((to->flags & BINARY_FLAG) != 0)
+ return do_expand_binary;
+ else
+ return do_expand_string;
+ }
+
}
else if (to->real_type() != from->real_type() ||
to_length != from_length ||
--- 1.20/mysql-test/r/binary.result 2005-10-13 10:12:15 -04:00
+++ 1.21/mysql-test/r/binary.result 2006-03-02 19:59:45 -05:00
@@ -141,3 +141,22 @@
`a` binary(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (col1 binary(4));
+insert into t1 values ('a'),('a ');
+select hex(col1) from t1;
+hex(col1)
+61000000
+61200000
+alter table t1 modify col1 binary(10);
+select hex(col1) from t1;
+hex(col1)
+61000000000000000000
+61200000000000000000
+insert into t1 values ('b'),('b ');
+select hex(col1) from t1;
+hex(col1)
+61000000000000000000
+61200000000000000000
+62000000000000000000
+62200000000000000000
+drop table t1;
--- 1.15/mysql-test/t/binary.test 2005-10-13 10:11:28 -04:00
+++ 1.16/mysql-test/t/binary.test 2006-03-02 19:59:45 -05:00
@@ -89,3 +89,15 @@
drop table t1;
# End of 4.1 tests
+
+#
+# Bug#16857
+#
+create table t1 (col1 binary(4));
+insert into t1 values ('a'),('a ');
+select hex(col1) from t1;
+alter table t1 modify col1 binary(10);
+select hex(col1) from t1;
+insert into t1 values ('b'),('b ');
+select hex(col1) from t1;
+drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (cmiller:1.2098) BUG#16857 | Chad MILLER | 3 Mar |