Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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.2091 06/03/01 20:11:30 gluh@stripped +3 -0
Fix for bug#16678 FORMAT gives wrong result if client run with
default-character-set=utf8
calculate Item_func_format::max_length using charset->mbmaxlen
sql/item_strfunc.h
1.104 06/03/01 20:11:25 gluh@stripped +3 -1
Fix for bug#16678 FORMAT gives wrong result if client run with
default-character-set=utf8
calculate Item_func_format::max_length using charset->mbmaxlen
mysql-test/t/func_math.test
1.27 06/03/01 20:11:24 gluh@stripped +22 -0
Fix for bug#16678 FORMAT gives wrong result if client run with
default-character-set=utf8
test case
mysql-test/r/func_math.result
1.34 06/03/01 20:11:24 gluh@stripped +20 -0
Fix for bug#16678 FORMAT gives wrong result if client run with
default-character-set=utf8
test case
# 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: gluh
# Host: eagle.intranet.mysql.r18.ru
# Root: /home/gluh/MySQL/Bugs/5.0.16678
--- 1.103/sql/item_strfunc.h Wed Dec 7 22:53:40 2005
+++ 1.104/sql/item_strfunc.h Wed Mar 1 20:11:25 2006
@@ -471,7 +471,9 @@ public:
void fix_length_and_dec()
{
collation.set(default_charset());
- max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
+ uint char_length=
args[0]->max_length/args[0]->collation.collation->mbmaxlen;
+ max_length= ((char_length + (char_length-args[0]->decimals)/3) *
+ collation.collation->mbmaxlen);
}
const char *func_name() const { return "format"; }
void print(String *);
--- 1.33/mysql-test/r/func_math.result Tue Feb 7 16:24:39 2006
+++ 1.34/mysql-test/r/func_math.result Wed Mar 1 20:11:24 2006
@@ -218,3 +218,23 @@ truncate(-5000111000111000155,-1)
select truncate(15000111000111000155,-1);
truncate(15000111000111000155,-1)
15000111000111000150
+set names utf8;
+create table t1
+(f1 varchar(32) not null,
+f2 smallint(5) unsigned not null,
+f3 int(10) unsigned not null default '0')
+engine=myisam default charset=utf8;
+insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
+create table t2
+(f1 int(10) unsigned not null,
+f2 int(10) unsigned not null,
+f3 smallint(5) unsigned not null)
+engine=myisam default charset=utf8;
+insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
+select format(t2.f2-t2.f1+1,0) from t1,t2
+where t1.f2 = t2.f3 order by t1.f1;
+format(t2.f2-t2.f1+1,0)
+10,000
+10,000
+drop table t1, t2;
+set names default;
--- 1.26/mysql-test/t/func_math.test Tue Feb 7 16:24:35 2006
+++ 1.27/mysql-test/t/func_math.test Wed Mar 1 20:11:24 2006
@@ -155,3 +155,25 @@ select truncate(-5000111000111000155,-1)
# truncate on unsigned bigint
select truncate(15000111000111000155,-1);
+#
+# Bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
+#
+set names utf8;
+create table t1
+(f1 varchar(32) not null,
+ f2 smallint(5) unsigned not null,
+ f3 int(10) unsigned not null default '0')
+engine=myisam default charset=utf8;
+insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
+
+create table t2
+(f1 int(10) unsigned not null,
+ f2 int(10) unsigned not null,
+ f3 smallint(5) unsigned not null)
+engine=myisam default charset=utf8;
+insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
+
+select format(t2.f2-t2.f1+1,0) from t1,t2
+where t1.f2 = t2.f3 order by t1.f1;
+drop table t1, t2;
+set names default;
| Thread |
|---|
| • bk commit into 5.0 tree (gluh:1.2091) BUG#16678 | gluh | 1 Mar |