ctype_utf8.test, ctype_utf8.result:

  Added a test case for bug #11167.
sql_select.cc:
  Fixed bug #11167.
  In 4.1 char/varchar fields are limited by 255 characters in
  length that make them longer than 255 bytes in size for such
  character sets as UTF8. The functions store_record_in_cache
  and read_cached_records did not take into account this
  Moreover the code did not take into account that the size
  of the varchar fields in 5.0 can be up to 65535 bytes
parent a3e72ec8
...@@ -80,6 +80,7 @@ hf@deer.mysql.r18.ru ...@@ -80,6 +80,7 @@ hf@deer.mysql.r18.ru
hf@genie.(none) hf@genie.(none)
holyfoot@mysql.com holyfoot@mysql.com
igor@hundin.mysql.fi igor@hundin.mysql.fi
igor@igor-inspiron.creware.com
igor@linux.local igor@linux.local
igor@rurik.mysql.com igor@rurik.mysql.com
ingo@mysql.com ingo@mysql.com
......
...@@ -905,3 +905,37 @@ select * from t1 where city = 'Durban '; ...@@ -905,3 +905,37 @@ select * from t1 where city = 'Durban ';
id city id city
2 Durban 2 Durban
drop table t1; drop table t1;
SET NAMES UTF8;
CREATE TABLE t1 (
`id` int(20) NOT NULL auto_increment,
`country` varchar(100) NOT NULL default '',
`shortcode` varchar(100) NOT NULL default '',
`operator` varchar(100) NOT NULL default '',
`momid` varchar(30) NOT NULL default '',
`keyword` varchar(160) NOT NULL default '',
`content` varchar(160) NOT NULL default '',
`second_token` varchar(160) default NULL,
`gateway_id` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`msisdn` varchar(15) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`),
KEY `IX_mobile_originated_message_keyword` (`keyword`),
KEY `IX_mobile_originated_message_created` (`created`),
KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
CREATE TABLE t2 (
`msisdn` varchar(15) NOT NULL default '',
`operator_id` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
UNIQUE KEY `PK_user` (`msisdn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
content msisdn
ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми 1234567890
11 g 1234567890
DROP TABLE t1,t2;
...@@ -746,3 +746,45 @@ insert into t1 values (2,'Durban'); ...@@ -746,3 +746,45 @@ insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban'; select * from t1 where city = 'Durban';
select * from t1 where city = 'Durban '; select * from t1 where city = 'Durban ';
drop table t1; drop table t1;
#
# Test for bug #11167: join for utf8 varchar value longer than 255 bytes
#
SET NAMES UTF8;
CREATE TABLE t1 (
`id` int(20) NOT NULL auto_increment,
`country` varchar(100) NOT NULL default '',
`shortcode` varchar(100) NOT NULL default '',
`operator` varchar(100) NOT NULL default '',
`momid` varchar(30) NOT NULL default '',
`keyword` varchar(160) NOT NULL default '',
`content` varchar(160) NOT NULL default '',
`second_token` varchar(160) default NULL,
`gateway_id` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
`msisdn` varchar(15) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`),
KEY `IX_mobile_originated_message_keyword` (`keyword`),
KEY `IX_mobile_originated_message_created` (`created`),
KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
CREATE TABLE t2 (
`msisdn` varchar(15) NOT NULL default '',
`operator_id` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
UNIQUE KEY `PK_user` (`msisdn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
DROP TABLE t1,t2;
...@@ -8112,9 +8112,9 @@ store_record_in_cache(JOIN_CACHE *cache) ...@@ -8112,9 +8112,9 @@ store_record_in_cache(JOIN_CACHE *cache)
end > str && end[-1] == ' ' ; end > str && end[-1] == ' ' ;
end--) ; end--) ;
length=(uint) (end-str); length=(uint) (end-str);
memcpy(pos+1,str,length); memcpy(pos+sizeof(uint), str, length);
*pos=(uchar) length; *((uint *) pos)= length;
pos+=length+1; pos+= length+sizeof(uint);
} }
else else
{ {
...@@ -8177,9 +8177,9 @@ read_cached_record(JOIN_TAB *tab) ...@@ -8177,9 +8177,9 @@ read_cached_record(JOIN_TAB *tab)
{ {
if (copy->strip) if (copy->strip)
{ {
memcpy(copy->str,pos+1,length=(uint) *pos); memcpy(copy->str, pos+sizeof(uint), length= *((uint *) pos));
memset(copy->str+length,' ',copy->length-length); memset(copy->str+length, ' ', copy->length-length);
pos+=1+length; pos+= sizeof(uint)+length;
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment