Loading mysql-test/r/ctype_utf8.result +29 −0 Original line number Diff line number Diff line Loading @@ -750,3 +750,32 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); id 4 DROP TABLE t1; SET NAMES latin1; CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, list_id smallint unsigned NOT NULL, term text NOT NULL, PRIMARY KEY(id), INDEX(list_id, term(19)) ) TYPE=MyISAM CHARSET=utf8; Warnings: Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead INSERT INTO t1 set list_id = 1, term = "testtest"; INSERT INTO t1 set list_id = 1, term = "testetest"; INSERT INTO t1 set list_id = 1, term = "testtest"; SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); id term 1 testtest 2 testetest 3 testtest SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); id term 1 testtest 2 testetest 3 testtest SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); id term 1 testtest 2 testetest 3 testtest DROP TABLE t1; mysql-test/r/ps.result +39 −0 Original line number Diff line number Diff line Loading @@ -336,3 +336,42 @@ id select_type table type possible_keys key key_len ref rows Extra - - - - - - - - NULL Impossible WHERE drop table t1; deallocate prepare stmt; create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer) from t1; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) - 6570515219 - - 1282061302 - - 6698761160 - - 9647622201 - prepare stmt from "select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer), cast(rand(?)*@precision as unsigned integer) from t1"; set @var=1; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 - 4054035371 - 1282061302 - 8716141803 - 6698761160 - 1418603212 - 9647622201 - 944590960 set @var=2; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 1559528654 6555866465 - 1282061302 6238114970 1223466192 - 6698761160 6511989195 6449731873 - 9647622201 3845601374 8578261098 set @var=3; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 1559528654 9057697559 - 1282061302 6238114970 3730790581 - 6698761160 6511989195 1480860534 - 9647622201 3845601374 6211931236 drop table t1; deallocate prepare stmt; mysql-test/t/ctype_utf8.test +20 −0 Original line number Diff line number Diff line Loading @@ -592,3 +592,23 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb"); SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); DROP TABLE t1; # # Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table # SET NAMES latin1; CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, list_id smallint unsigned NOT NULL, term text NOT NULL, PRIMARY KEY(id), INDEX(list_id, term(19)) ) TYPE=MyISAM CHARSET=utf8; INSERT INTO t1 set list_id = 1, term = "testtest"; INSERT INTO t1 set list_id = 1, term = "testetest"; INSERT INTO t1 set list_id = 1, term = "testtest"; SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); DROP TABLE t1; mysql-test/t/ps.test +27 −1 Original line number Diff line number Diff line Loading @@ -363,4 +363,30 @@ execute stmt using @v; drop table t1; deallocate prepare stmt; # # A test case for Bug#5985 prepare stmt from "select rand(?)" crashes # server. Check that Item_func_rand is prepared-statements friendly. # create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; --replace_column 1 - 3 - select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer) from t1; prepare stmt from "select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer), cast(rand(?)*@precision as unsigned integer) from t1"; set @var=1; --replace_column 1 - 3 - execute stmt using @var; set @var=2; --replace_column 1 - execute stmt using @var; set @var=3; --replace_column 1 - execute stmt using @var; drop table t1; deallocate prepare stmt; sql/field.cc +6 −6 Original line number Diff line number Diff line Loading @@ -5000,10 +5000,10 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), int Field_blob::cmp(const char *a,uint32 a_length, const char *b, uint32 b_length) { int diff=my_strnncoll(field_charset, (const uchar*)a,min(a_length,b_length), (const uchar*)b,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); return field_charset->coll->strnncoll(field_charset, (const uchar*)a, a_length, (const uchar*)b, b_length, 0); } Loading Loading @@ -5087,8 +5087,8 @@ void Field_blob::get_key_image(char *buff,uint length, get_ptr(&blob); uint char_length= length / cs->mbmaxlen; char_length= my_charpos(cs, blob, blob + length, char_length); set_if_smaller(length, char_length); char_length= my_charpos(cs, blob, blob + blob_length, char_length); set_if_smaller(blob_length, char_length); if ((uint32) length > blob_length) { Loading Loading
mysql-test/r/ctype_utf8.result +29 −0 Original line number Diff line number Diff line Loading @@ -750,3 +750,32 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); id 4 DROP TABLE t1; SET NAMES latin1; CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, list_id smallint unsigned NOT NULL, term text NOT NULL, PRIMARY KEY(id), INDEX(list_id, term(19)) ) TYPE=MyISAM CHARSET=utf8; Warnings: Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead INSERT INTO t1 set list_id = 1, term = "testtest"; INSERT INTO t1 set list_id = 1, term = "testetest"; INSERT INTO t1 set list_id = 1, term = "testtest"; SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); id term 1 testtest 2 testetest 3 testtest SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); id term 1 testtest 2 testetest 3 testtest SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); id term 1 testtest 2 testetest 3 testtest DROP TABLE t1;
mysql-test/r/ps.result +39 −0 Original line number Diff line number Diff line Loading @@ -336,3 +336,42 @@ id select_type table type possible_keys key key_len ref rows Extra - - - - - - - - NULL Impossible WHERE drop table t1; deallocate prepare stmt; create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer) from t1; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) - 6570515219 - - 1282061302 - - 6698761160 - - 9647622201 - prepare stmt from "select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer), cast(rand(?)*@precision as unsigned integer) from t1"; set @var=1; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 - 4054035371 - 1282061302 - 8716141803 - 6698761160 - 1418603212 - 9647622201 - 944590960 set @var=2; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 1559528654 6555866465 - 1282061302 6238114970 1223466192 - 6698761160 6511989195 6449731873 - 9647622201 3845601374 8578261098 set @var=3; execute stmt using @var; rand() cast(rand(10)*@precision as unsigned integer) cast(rand(a)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) - 6570515219 1559528654 9057697559 - 1282061302 6238114970 3730790581 - 6698761160 6511989195 1480860534 - 9647622201 3845601374 6211931236 drop table t1; deallocate prepare stmt;
mysql-test/t/ctype_utf8.test +20 −0 Original line number Diff line number Diff line Loading @@ -592,3 +592,23 @@ SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb"); SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); DROP TABLE t1; # # Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table # SET NAMES latin1; CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, list_id smallint unsigned NOT NULL, term text NOT NULL, PRIMARY KEY(id), INDEX(list_id, term(19)) ) TYPE=MyISAM CHARSET=utf8; INSERT INTO t1 set list_id = 1, term = "testtest"; INSERT INTO t1 set list_id = 1, term = "testetest"; INSERT INTO t1 set list_id = 1, term = "testtest"; SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest"); DROP TABLE t1;
mysql-test/t/ps.test +27 −1 Original line number Diff line number Diff line Loading @@ -363,4 +363,30 @@ execute stmt using @v; drop table t1; deallocate prepare stmt; # # A test case for Bug#5985 prepare stmt from "select rand(?)" crashes # server. Check that Item_func_rand is prepared-statements friendly. # create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4); set @precision=10000000000; --replace_column 1 - 3 - select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer) from t1; prepare stmt from "select rand(), cast(rand(10)*@precision as unsigned integer), cast(rand(a)*@precision as unsigned integer), cast(rand(?)*@precision as unsigned integer) from t1"; set @var=1; --replace_column 1 - 3 - execute stmt using @var; set @var=2; --replace_column 1 - execute stmt using @var; set @var=3; --replace_column 1 - execute stmt using @var; drop table t1; deallocate prepare stmt;
sql/field.cc +6 −6 Original line number Diff line number Diff line Loading @@ -5000,10 +5000,10 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), int Field_blob::cmp(const char *a,uint32 a_length, const char *b, uint32 b_length) { int diff=my_strnncoll(field_charset, (const uchar*)a,min(a_length,b_length), (const uchar*)b,min(a_length,b_length)); return diff ? diff : (int) (a_length - b_length); return field_charset->coll->strnncoll(field_charset, (const uchar*)a, a_length, (const uchar*)b, b_length, 0); } Loading Loading @@ -5087,8 +5087,8 @@ void Field_blob::get_key_image(char *buff,uint length, get_ptr(&blob); uint char_length= length / cs->mbmaxlen; char_length= my_charpos(cs, blob, blob + length, char_length); set_if_smaller(length, char_length); char_length= my_charpos(cs, blob, blob + blob_length, char_length); set_if_smaller(blob_length, char_length); if ((uint32) length > blob_length) { Loading