drop table if exists t1;
DROP TABLE IF EXISTS t1;
SHOW COLLATION LIKE 'cp1250_czech_cs';
Collation	Charset	Id	Default	Compiled	Sortlen
cp1250_czech_cs	cp1250	34		Yes	2
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_general_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
c	char(10)	cp1250_general_ci	YES	MUL	NULL			
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
c1	varchar(15)	cp1250_general_ci	YES	MUL	NULL			
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result  from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert ignore into t1 values (),();
Warnings:
Warning	1364	Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))


select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
#
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
#
SET character_set_client=latin1;
SET character_set_connection= @test_character_set;
SET collation_connection= @test_collation;
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
COLLATION('.')	c1
cp1250_general_ci	.wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `name` varchar(10) DEFAULT NULL,
  `level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level))	concat(name, repeat(' ',level))
string 	string 
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE CONCAT(c1)='a';
c1
a
a 
SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a ';
c1
a 
SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
c1
a 
EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a ';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a '
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('a'),('a ');
SELECT * FROM t1 WHERE 'a'=CONCAT(c1);
c1
a
a 
SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1);
c1
a 
SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
c1
a 
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '% '=CONCAT(c1);
c1
%
% 
SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
c1
%
SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
c1
%
EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('%'),('% ');
SELECT * FROM t1 WHERE '%'=CONCAT(c1);
c1
%
% 
SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1);
c1
%
SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
c1
%
EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`)
DROP TABLE t1;
#
# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a'
#
CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 VALUES ('a'),('a ');
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
a	LENGTH(a)
a	1
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
a	LENGTH(a)
a	1
EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
Warnings:
Note	1003	select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a`  not like 'a ' and `test`.`t1`.`a` = 'a'
DROP TABLE t1;
#
# End of MDEV-8694
#
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET @safe_character_set_client= @@character_set_client;
SET @safe_character_set_results= @@character_set_results;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
c	char(10)	cp1250_czech_cs	YES	MUL	NULL			
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
c1	varchar(15)	cp1250_czech_cs	YES	MUL	NULL			
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result  from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result  from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
create table t1 (a set('a') not null);
insert ignore into t1 values (),();
Warnings:
Warning	1364	Field 'a' doesn't have a default value
select cast(a as char(1)) from t1;
cast(a as char(1))


select a sounds like a from t1;
a sounds like a
1
1
select 1 from t1 order by cast(a as char(1));
1
1
1
drop table t1;
#
# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found
#
SET character_set_client=latin1;
SET character_set_connection= @test_character_set;
SET collation_connection= @test_collation;
SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1;
COLLATION('.')	c1
cp1250_czech_cs	.wwwmysqlcom
set names utf8;
create table t1 (
name varchar(10),
level smallint unsigned);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `name` varchar(10) DEFAULT NULL,
  `level` smallint(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs
insert into t1 values ('string',1);
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
concat(name,space(level))	concat(name, repeat(' ',level))
string 	string 
drop table t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET character_set_client= @safe_character_set_client;
SET character_set_results= @safe_character_set_results;
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
INSERT INTO t1 VALUES ('');
SELECT a, length(a), a='', a=' ', a='  ' FROM t1;
a	length(a)	a=''	a=' '	a='  '
	0	1	1	1
DROP TABLE t1;
CREATE TABLE t1 (
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
PRIMARY KEY  (`popisek`)
);
INSERT INTO t1 VALUES ('2005-01-1');
SELECT * FROM t1 WHERE popisek = '2005-01-1';
popisek
2005-01-1
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
popisek
2005-01-1
drop table t1;
set names cp1250;
CREATE TABLE t1
(
id  INT AUTO_INCREMENT PRIMARY KEY,
str VARCHAR(32)  CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL default '',
UNIQUE KEY (str)
);
INSERT INTO t1 VALUES (NULL, 'a');
INSERT INTO t1 VALUES (NULL, 'aa');
INSERT INTO t1 VALUES (NULL, 'aaa');
INSERT INTO t1 VALUES (NULL, 'aaaa');
INSERT INTO t1 VALUES (NULL, 'aaaaa');
INSERT INTO t1 VALUES (NULL, 'aaaaaa');
INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
select * from t1 where str like 'aa%';
id	str
2	aa
3	aaa
4	aaaa
5	aaaaa
6	aaaaaa
7	aaaaaaa
drop table t1;
set names cp1250;
create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
insert into t1 values("abcdefghá");
insert into t1 values("ááèè");
select a from t1 where a like "abcdefghá";
a
abcdefghá
drop table t1;
set names cp1250 collate cp1250_czech_cs;
SELECT strcmp('a','a '),   strcmp('a ','a');
strcmp('a','a ')	strcmp('a ','a')
0	0
SELECT strcmp('a\0','a' ), strcmp('a','a\0');
strcmp('a\0','a' )	strcmp('a','a\0')
1	-1
SELECT strcmp('a\0','a '), strcmp('a ','a\0');
strcmp('a\0','a ')	strcmp('a ','a\0')
1	-1
SELECT strcmp('a\t','a' ), strcmp('a', 'a\t');
strcmp('a\t','a' )	strcmp('a', 'a\t')
1	-1
SELECT strcmp('a\t','a '), strcmp('a ', 'a\t');
strcmp('a\t','a ')	strcmp('a ', 'a\t')
1	-1
create table t1 select repeat('a',4000) a;
delete from t1;
insert into t1 values ('a'), ('a '), ('a\t');
select collation(a),hex(a) from t1 order by a;
collation(a)	hex(a)
cp1250_czech_cs	61
cp1250_czech_cs	6109
cp1250_czech_cs	6120
drop table t1;
#
# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP
#
SELECT @@collation_connection;
@@collation_connection
cp1250_czech_cs
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP;
i
1
1
SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP;
i
1
1
DROP TABLE t1;
#
# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations
#
SELECT @@collation_connection;
@@collation_connection
cp1250_czech_cs
CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0;
INSERT INTO t1 (a) VALUES ("a");
INSERT INTO t1 (a) VALUES ("b");
INSERT INTO t1 (a) VALUES ("c");
INSERT INTO t1 (a) VALUES ("d");
INSERT INTO t1 (a) VALUES ("e");
INSERT INTO t1 (a) VALUES ("f");
INSERT INTO t1 (a) VALUES ("g");
INSERT INTO t1 (a) VALUES ("h");
INSERT INTO t1 (a) VALUES ("i");
INSERT INTO t1 (a) VALUES ("j");
INSERT INTO t1 (a) VALUES ("k");
INSERT INTO t1 (a) VALUES ("l");
INSERT INTO t1 (a) VALUES ("m");
SELECT * FROM t1 ORDER BY LOWER(a);
a
a
b
c
d
e
f
g
h
i
j
k
l
m
SELECT * FROM t1 ORDER BY LOWER(a) DESC;
a
m
l
k
j
i
h
g
f
e
d
c
b
a
DROP TABLE t1;
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators) 
using cp1250);
ERROR HY000: Unknown locale: 'ON'
#
# Start of 5.6 tests
#
#
# WL#3664 WEIGHT_STRING
#
#
# Note:
# cp1250_czech_cs does not support WEIGHT_STRING in full extent
#
set names cp1250 collate cp1250_czech_cs;
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
CREATE TABLE t1 AS SELECT 'a' AS a;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` varchar(1) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `ws` varbinary(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
A402
SELECT HEX(ws) FROM t2;
HEX(ws)
A402
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a;
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` varchar(5) CHARACTER SET cp1250 COLLATE cp1250_czech_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT HEX(WEIGHT_STRING(a)) FROM t1;
HEX(WEIGHT_STRING(a))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(3)))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `ws` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1;
HEX(WEIGHT_STRING(a AS CHAR(10)))
A4A4A4A4A40202020202
SELECT HEX(ws) FROM t2;
HEX(ws)
A4A4A4A4A40202020202
DROP TABLE t2;
DROP TABLE t1;
select hex(weight_string('a'));
hex(weight_string('a'))
A402
select hex(weight_string('A'));
hex(weight_string('A'))
A401
select hex(weight_string('abc'));
hex(weight_string('abc'))
A4A5A6020202
select hex(weight_string('abc' as char(2)));
hex(weight_string('abc' as char(2)))
A4A5A6020202
select hex(weight_string('abc' as char(3)));
hex(weight_string('abc' as char(3)))
A4A5A6020202
select hex(weight_string('abc' as char(5)));
hex(weight_string('abc' as char(5)))
A4A5A6020202
select hex(weight_string('abc', 1, 2, 0xC0));
hex(weight_string('abc', 1, 2, 0xC0))
A4
select hex(weight_string('abc', 2, 2, 0xC0));
hex(weight_string('abc', 2, 2, 0xC0))
A4A5
select hex(weight_string('abc', 3, 2, 0xC0));
hex(weight_string('abc', 3, 2, 0xC0))
A4A5A6
select hex(weight_string('abc', 4, 2, 0xC0));
hex(weight_string('abc', 4, 2, 0xC0))
A4A5A602
select hex(weight_string('abc', 5, 2, 0xC0));
hex(weight_string('abc', 5, 2, 0xC0))
A4A5A60202
select hex(weight_string('abc',25, 2, 0xC0));
hex(weight_string('abc',25, 2, 0xC0))
A4A5A602020200000000000000000000000000000000000000
select hex(weight_string('abc', 1, 3, 0xC0));
hex(weight_string('abc', 1, 3, 0xC0))
A4
select hex(weight_string('abc', 2, 3, 0xC0));
hex(weight_string('abc', 2, 3, 0xC0))
A4A5
select hex(weight_string('abc', 3, 3, 0xC0));
hex(weight_string('abc', 3, 3, 0xC0))
A4A5A6
select hex(weight_string('abc', 4, 3, 0xC0));
hex(weight_string('abc', 4, 3, 0xC0))
A4A5A602
select hex(weight_string('abc', 5, 3, 0xC0));
hex(weight_string('abc', 5, 3, 0xC0))
A4A5A60202
select hex(weight_string('abc',25, 3, 0xC0));
hex(weight_string('abc',25, 3, 0xC0))
A4A5A602020200000000000000000000000000000000000000
select hex(weight_string('abc', 1, 4, 0xC0));
hex(weight_string('abc', 1, 4, 0xC0))
A4
select hex(weight_string('abc', 2, 4, 0xC0));
hex(weight_string('abc', 2, 4, 0xC0))
A4A5
select hex(weight_string('abc', 3, 4, 0xC0));
hex(weight_string('abc', 3, 4, 0xC0))
A4A5A6
select hex(weight_string('abc', 4, 4, 0xC0));
hex(weight_string('abc', 4, 4, 0xC0))
A4A5A602
select hex(weight_string('abc', 5, 4, 0xC0));
hex(weight_string('abc', 5, 4, 0xC0))
A4A5A60202
select hex(weight_string('abc',25, 4, 0xC0));
hex(weight_string('abc',25, 4, 0xC0))
A4A5A602020200000000000000000000000000000000000000
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
select hex(weight_string(cast(_latin1 0x80 as char)));
hex(weight_string(cast(_latin1 0x80 as char)))
8123
select hex(weight_string(cast(_latin1 0x808080 as char)));
hex(weight_string(cast(_latin1 0x808080 as char)))
818181232323
select hex(weight_string(cast(_latin1 0x808080 as char) as char(2)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(2)))
818181232323
select hex(weight_string(cast(_latin1 0x808080 as char) as char(3)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(3)))
818181232323
select hex(weight_string(cast(_latin1 0x808080 as char) as char(5)));
hex(weight_string(cast(_latin1 0x808080 as char) as char(5)))
818181232323
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0))
81
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0))
8181
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0))
818181
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0))
81818123
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0))
8181812323
select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0))
81818123232300000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0))
81
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0))
8181
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0))
818181
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0))
81818123
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0))
8181812323
select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0))
81818123232300000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0))
81
select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0))
8181
select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0))
818181
select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0))
81818123
select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0))
8181812323
select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0));
hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0))
81818123232300000000000000000000000000000000000000
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
select collation(cast(_latin1 0xDF as char));
collation(cast(_latin1 0xDF as char))
cp1250_czech_cs
select hex(weight_string('s'));
hex(weight_string('s'))
B902
select hex(weight_string(cast(_latin1 0xDF as char)));
hex(weight_string(cast(_latin1 0xDF as char)))
BB01
select hex(weight_string(cast(_latin1 0xDF as char) as char(1)));
hex(weight_string(cast(_latin1 0xDF as char) as char(1)))
BB01
select hex(weight_string('c'));
hex(weight_string('c'))
A602
select hex(weight_string('h'));
hex(weight_string('h'))
AC02
select hex(weight_string('ch'));
hex(weight_string('ch'))
AD03
select hex(weight_string('i'));
hex(weight_string('i'))
AE02
select hex(weight_string(cast(_latin1 0x6368DF as char)));
hex(weight_string(cast(_latin1 0x6368DF as char)))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char) as char(1)));
hex(weight_string(cast(_latin1 0x6368DF as char) as char(1)))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char) as char(2)));
hex(weight_string(cast(_latin1 0x6368DF as char) as char(2)))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char) as char(3)));
hex(weight_string(cast(_latin1 0x6368DF as char) as char(3)))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char) as char(4)));
hex(weight_string(cast(_latin1 0x6368DF as char) as char(4)))
ADBB0301
select hex(weight_string(cast(_latin1 0xDF6368 as char)));
hex(weight_string(cast(_latin1 0xDF6368 as char)))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1)));
hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1)))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2)));
hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2)))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3)));
hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3)))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4)));
hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4)))
BBAD0103
select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0))
AD
select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0))
ADBB
select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0))
ADBB03
select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0))
ADBB0301000000000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0))
AD
select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0))
ADBB
select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0))
ADBB03
select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0))
ADBB0301000000000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0))
AD
select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0))
ADBB
select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0))
ADBB03
select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0))
ADBB0301
select hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0));
hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0))
ADBB0301000000000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0))
BB
select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0))
BBAD
select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0))
BBAD01
select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0))
BBAD0103000000000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0))
BB
select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0))
BBAD
select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0))
BBAD01
select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0))
BBAD0103000000000000000000000000000000000000000000
select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0))
BB
select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0))
BBAD
select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0))
BBAD01
select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0))
BBAD0103
select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0));
hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0))
BBAD0103000000000000000000000000000000000000000000
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
select hex(weight_string('a' LEVEL 1));
hex(weight_string('a' LEVEL 1))
A4
select hex(weight_string('A' LEVEL 1));
hex(weight_string('A' LEVEL 1))
A4
select hex(weight_string('abc' LEVEL 1));
hex(weight_string('abc' LEVEL 1))
A4A5A6
select hex(weight_string('abc' as char(2) LEVEL 1));
hex(weight_string('abc' as char(2) LEVEL 1))
A4A5A6
select hex(weight_string('abc' as char(3) LEVEL 1));
hex(weight_string('abc' as char(3) LEVEL 1))
A4A5A6
select hex(weight_string('abc' as char(5) LEVEL 1));
hex(weight_string('abc' as char(5) LEVEL 1))
A4A5A6
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
A4A5A6
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
A4A5A6
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
A4A5A6
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
select hex(weight_string('a' LEVEL 2));
hex(weight_string('a' LEVEL 2))
02
select hex(weight_string('A' LEVEL 2));
hex(weight_string('A' LEVEL 2))
01
select hex(weight_string('abc' LEVEL 2));
hex(weight_string('abc' LEVEL 2))
020202
select hex(weight_string('abc' as char(2) LEVEL 2));
hex(weight_string('abc' as char(2) LEVEL 2))
020202
select hex(weight_string('abc' as char(3) LEVEL 2));
hex(weight_string('abc' as char(3) LEVEL 2))
020202
select hex(weight_string('abc' as char(5) LEVEL 2));
hex(weight_string('abc' as char(5) LEVEL 2))
020202
select @@collation_connection;
@@collation_connection
cp1250_czech_cs
select hex(weight_string('a' LEVEL 1,2));
hex(weight_string('a' LEVEL 1,2))
A402
select hex(weight_string('a' LEVEL 1-2));
hex(weight_string('a' LEVEL 1-2))
A402
select hex(weight_string('A' LEVEL 1,2));
hex(weight_string('A' LEVEL 1,2))
A401
select hex(weight_string('A' LEVEL 1-2));
hex(weight_string('A' LEVEL 1-2))
A401
#
# End of 5.6 tests
#
