Commit 559536c5 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1

parents b7403e8b 3329f316
...@@ -779,3 +779,14 @@ id term ...@@ -779,3 +779,14 @@ id term
2 testetest 2 testetest
3 testtest 3 testtest
DROP TABLE t1; DROP TABLE t1;
set names utf8;
create table t1 (
a int primary key,
b varchar(6),
index b3(b(3))
) engine=innodb character set=utf8;
insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
a b
2 foobar
drop table t1;
...@@ -221,7 +221,9 @@ drop table t1; ...@@ -221,7 +221,9 @@ drop table t1;
# Bug 4521: unique key prefix interacts poorly with utf8 # Bug 4521: unique key prefix interacts poorly with utf8
# InnoDB: keys with prefix compression, case insensitive collation. # InnoDB: keys with prefix compression, case insensitive collation.
# #
--disable_warnings
create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb; create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
--enable_warnings
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
--error 1062 --error 1062
...@@ -269,7 +271,9 @@ drop table t1; ...@@ -269,7 +271,9 @@ drop table t1;
# Bug 4521: unique key prefix interacts poorly with utf8 # Bug 4521: unique key prefix interacts poorly with utf8
# InnoDB: fixed length keys, case insensitive collation # InnoDB: fixed length keys, case insensitive collation
# #
--disable_warnings
create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb; create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
--enable_warnings
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
...@@ -504,10 +508,12 @@ drop table t1; ...@@ -504,10 +508,12 @@ drop table t1;
# Bug#4594: column index make = failed for gbk, but like works # Bug#4594: column index make = failed for gbk, but like works
# Check InnoDB # Check InnoDB
# #
--disable_warnings
create table t1 ( create table t1 (
str varchar(255) character set utf8 not null, str varchar(255) character set utf8 not null,
key str (str(2)) key str (str(2))
) engine=innodb; ) engine=innodb;
--enable_warnings
INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2'); INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str'; select * from t1 where str='str';
...@@ -563,10 +569,12 @@ DROP TABLE t1; ...@@ -563,10 +569,12 @@ DROP TABLE t1;
# Bug #5723: length(<varchar utf8 field>) returns varying results # Bug #5723: length(<varchar utf8 field>) returns varying results
# #
SET NAMES utf8; SET NAMES utf8;
--disable_warnings
CREATE TABLE t1 ( CREATE TABLE t1 (
subject varchar(255) character set utf8 collate utf8_unicode_ci, subject varchar(255) character set utf8 collate utf8_unicode_ci,
p varchar(15) character set utf8 p varchar(15) character set utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057'); INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
INSERT INTO t1 VALUES ('aaa','bbb'); INSERT INTO t1 VALUES ('aaa','bbb');
SELECT length(subject) FROM t1; SELECT length(subject) FROM t1;
...@@ -612,3 +620,18 @@ SELECT id, term FROM t1 where (list_id = 1) AND (term = "test ...@@ -612,3 +620,18 @@ SELECT id, term FROM t1 where (list_id = 1) AND (term = "test
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
DROP TABLE t1; DROP TABLE t1;
#
# Bug #6019 SELECT tries to use too short prefix index on utf8 data
#
set names utf8;
--disable_warnings
create table t1 (
a int primary key,
b varchar(6),
index b3(b(3))
) engine=innodb character set=utf8;
--enable_warnings
insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
drop table t1;
...@@ -499,6 +499,10 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, ...@@ -499,6 +499,10 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
{ {
char buf[10]; char buf[10];
uint buflen; uint buflen;
uint charlen= my_charpos(cs, min_org, min_str, res_length/cs->mbmaxlen);
if (charlen < (uint) (min_str - min_org))
min_str= min_org + charlen;
/* Write min key */ /* Write min key */
*min_length= (uint) (min_str - min_org); *min_length= (uint) (min_str - min_org);
......
...@@ -2059,7 +2059,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = ...@@ -2059,7 +2059,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_utf8, my_strnncoll_utf8,
my_strnncollsp_utf8, my_strnncollsp_utf8,
my_strnxfrm_utf8, my_strnxfrm_utf8,
my_like_range_simple, my_like_range_mb,
my_wildcmp_mb, my_wildcmp_mb,
my_strcasecmp_utf8, my_strcasecmp_utf8,
my_instr_mb, my_instr_mb,
...@@ -2119,7 +2119,7 @@ CHARSET_INFO my_charset_utf8_general_ci= ...@@ -2119,7 +2119,7 @@ CHARSET_INFO my_charset_utf8_general_ci=
1, /* mbminlen */ 1, /* mbminlen */
3, /* mbmaxlen */ 3, /* mbmaxlen */
0, /* min_sort_char */ 0, /* min_sort_char */
255, /* max_sort_char */ 0xFFFF, /* max_sort_char */
&my_charset_utf8_handler, &my_charset_utf8_handler,
&my_collation_ci_handler &my_collation_ci_handler
}; };
......
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