diff options
author | unknown <igor@igor-inspiron.creware.com> | 2005-06-13 06:10:19 -0700 |
---|---|---|
committer | unknown <igor@igor-inspiron.creware.com> | 2005-06-13 06:10:19 -0700 |
commit | 3f483c18bdf0cde65ab795450ba3fc43f68806ed (patch) | |
tree | e65e709e34df00878a6743e82b3008035aaf8daa | |
parent | f8f95d1c91bc1c39d2c9241f0781a7e7a45e8077 (diff) | |
download | mariadb-git-3f483c18bdf0cde65ab795450ba3fc43f68806ed.tar.gz |
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
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 34 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 42 | ||||
-rw-r--r-- | sql/sql_select.cc | 12 |
4 files changed, 83 insertions, 6 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 343fb26c83a..717c9cd9261 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -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 diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 29b18f0431c..12ef8dfb8e8 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -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; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 3c49b2a47f7..343b7c867e7 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -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; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5b1603b44e2..2cb650cda2a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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 { |