Commit f56681be authored by unknown's avatar unknown

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


sql/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
mysql-test/r/ctype_utf8.result:
  Added a test case for bug #11167.
mysql-test/t/ctype_utf8.test:
  Added a test case for bug #11167.
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 96d80002
......@@ -80,6 +80,7 @@ hf@deer.mysql.r18.ru
hf@genie.(none)
holyfoot@mysql.com
igor@hundin.mysql.fi
igor@igor-inspiron.creware.com
igor@linux.local
igor@rurik.mysql.com
ingo@mysql.com
......
......@@ -905,3 +905,37 @@ select * from t1 where city = 'Durban ';
id city
2 Durban
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');
select * from t1 where city = 'Durban';
select * from t1 where city = 'Durban ';
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)
end > str && end[-1] == ' ' ;
end--) ;
length=(uint) (end-str);
memcpy(pos+1,str,length);
*pos=(uchar) length;
pos+=length+1;
memcpy(pos+sizeof(uint), str, length);
*((uint *) pos)= length;
pos+= length+sizeof(uint);
}
else
{
......@@ -8177,9 +8177,9 @@ read_cached_record(JOIN_TAB *tab)
{
if (copy->strip)
{
memcpy(copy->str,pos+1,length=(uint) *pos);
memset(copy->str+length,' ',copy->length-length);
pos+=1+length;
memcpy(copy->str, pos+sizeof(uint), length= *((uint *) pos));
memset(copy->str+length, ' ', copy->length-length);
pos+= sizeof(uint)+length;
}
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