List:Internals« Previous MessageNext Message »
From:antony Date:March 9 2005 8:04pm
Subject:bk commit into 4.1 tree (acurtis:1.2100) BUG#8204
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of acurtis. When acurtis 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 05/03/09 20:04:40 acurtis@stripped +4 -0
  Bug#8204
    Fix for real numbers charset conversion bug
    Tests for charset conversion bug

  sql/item_strfunc.cc
    1.219 05/03/09 20:04:24 acurtis@stripped +10 -0
    Bug#8204
      Force integers and real strings to latin1 charset
      Fixes CONVERT(1.1 USING ucs2)

  sql/item.cc
    1.193 05/03/09 20:04:23 acurtis@stripped +5 -1
    Bug#8204
      For real results, ensure that string is interpreted as sbcs.
      Fixes storing reals into ucs2 fields.

  mysql-test/t/ctype_ucs.test
    1.21 05/03/09 20:04:23 acurtis@stripped +12 -0
    Bug#8204
      Tests for charset conversion bug

  mysql-test/r/ctype_ucs.result
    1.23 05/03/09 20:04:23 acurtis@stripped +20 -0
    Bug#8204
      Tests for charset conversion bug

# 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:	acurtis
# Host:	pcgem.rdg.cyberkinetica.com
# Root:	/var/db/bk/work-acurtis/bug8204.1

--- 1.192/sql/item.cc	2005-03-04 10:15:39 +00:00
+++ 1.193/sql/item.cc	2005-03-09 20:04:23 +00:00
@@ -1836,7 +1836,11 @@
       return set_field_to_null_with_conversions(field, no_conversions);
     }
     field->set_notnull();
-    error=field->store(result->ptr(),result->length(),cs);
+#if MYSQL_VERSION_ID < 50000
+    if (result_type() == REAL_RESULT)
+      result->set_charset(&my_charset_latin1);
+#endif    
+    error=field->store(result->ptr(),result->length(),result->charset());
     str_value.set_quick(0, 0, cs);
   }
   else if (result_type() == REAL_RESULT)

--- 1.218/sql/item_strfunc.cc	2005-03-08 13:17:54 +00:00
+++ 1.219/sql/item_strfunc.cc	2005-03-09 20:04:24 +00:00
@@ -2207,6 +2207,16 @@
     null_value=1;
     return 0;
   }
+#if MYSQL_VERSION_ID < 50000
+  switch (args[0]->result_type())
+  {
+  case INT_RESULT:
+  case REAL_RESULT:
+    arg->set_charset(&my_charset_latin1);
+  default:
+    break;
+  }
+#endif
   null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),
                              conv_charset, &dummy_errors);
   return null_value ? 0 : &str_value;

--- 1.22/mysql-test/r/ctype_ucs.result	2005-02-12 12:27:15 +00:00
+++ 1.23/mysql-test/r/ctype_ucs.result	2005-03-09 20:04:23 +00:00
@@ -627,3 +627,23 @@
 Warning	1265	Data truncated for column 'Field1' at row 1
 DROP TABLE t1;
 SET NAMES latin1;
+SELECT CONVERT(1.1 USING ucs2);
+CONVERT(1.1 USING ucs2)
+1.1
+CREATE TABLE t1 (a varchar(64) character set ucs2);
+INSERT INTO t1 VALUES ("1.1"), ("2.1");
+SELECT a,hex(a) FROM t1;
+a	hex(a)
+1.1	0031002E0031
+2.1	0032002E0031
+UPDATE t1 SET a= a + 0.1;
+SELECT a,hex(a) FROM t1;
+a	hex(a)
+1.2	0031002E0032
+2.2	0032002E0032
+UPDATE t1 SET a= a + 10;
+SELECT a,hex(a) FROM t1;
+a	hex(a)
+11.2	00310031002E0032
+12.2	00310032002E0032
+DROP TABLE t1;

--- 1.20/mysql-test/t/ctype_ucs.test	2005-02-12 12:27:16 +00:00
+++ 1.21/mysql-test/t/ctype_ucs.test	2005-03-09 20:04:23 +00:00
@@ -411,3 +411,15 @@
 INSERT INTO t1 VALUES ('-1');
 DROP TABLE t1;
 SET NAMES latin1;
+#
+# Bug#8204 - Bad numeric conversions when using ucs2
+#
+SELECT CONVERT(1.1 USING ucs2);
+CREATE TABLE t1 (a varchar(64) character set ucs2);
+INSERT INTO t1 VALUES ("1.1"), ("2.1");
+SELECT a,hex(a) FROM t1;
+UPDATE t1 SET a= a + 0.1;
+SELECT a,hex(a) FROM t1;
+UPDATE t1 SET a= a + 10;
+SELECT a,hex(a) FROM t1;
+DROP TABLE t1;
Thread
bk commit into 4.1 tree (acurtis:1.2100) BUG#8204antony9 Mar