-- source include/have_innodb.inc
-- source include/have_bdb.inc
--character_set sjis
--disable_warnings
drop table if exists `Ｔ１`;
drop table if exists `Ｔ２`;
drop table if exists `Ｔ３`;
drop table if exists `Ｔ４`;
drop table if exists `Ｔ５`;
drop table if exists `Ｔ６`;
drop table if exists `Ｔ７`;
drop table if exists `Ｔ８`;
drop table if exists `Ｔ９`;
drop table if exists `Ｔ１０`;
drop table if exists `Ｔ１１`;
drop table if exists `Ｔ１２`;
--enable_warnings

#
# Test Displaying Japanese charact using WHERE condtion in sjis encoding
#

SET NAMES sjis;
SET character_set_database = sjis;

CREATE TABLE `Ｔ１` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `Ｔ２` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `Ｔ３` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `Ｔ４` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `Ｔ５` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `Ｔ６` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `Ｔ７` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `Ｔ８` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `Ｔ９` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `Ｔ１０` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = bdb;
CREATE TABLE `Ｔ１１` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = bdb;
CREATE TABLE `Ｔ１２` (`Ｃ１` char(20), INDEX(`Ｃ１`)) DEFAULT CHARSET = sjis engine = bdb;

#Load the following data in each table
# jisx0201 hankaku-katakana data
# jisx0208 data
# jisx0212 supplemental character data

--disable_query_log
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `Ｔ１`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `Ｔ２`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `Ｔ３`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `Ｔ４`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `Ｔ５`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `Ｔ６`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `Ｔ７`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `Ｔ８`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `Ｔ９`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `Ｔ１０`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `Ｔ１１`;
--eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `Ｔ１２`;
--enable_query_log

#InnoDB
SELECT * FROM `Ｔ１` WHERE `Ｃ１` = 'ｰｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿ';
SELECT * FROM `Ｔ２` WHERE `Ｃ１` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
SELECT * FROM `Ｔ３` WHERE `Ｃ１` = 'ソ十表予構噂蚕申貼能暴禄曾箪兔喀媾彌拿杤';

#MyISAM
SELECT * FROM `Ｔ４` WHERE `Ｃ１` = 'ｰｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿ';
SELECT * FROM `Ｔ５` WHERE `Ｃ１` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
SELECT * FROM `Ｔ６` WHERE `Ｃ１` = 'ソ十表予構噂蚕申貼能暴禄曾箪兔喀媾彌拿杤';

#Heap
SELECT * FROM `Ｔ７` WHERE `Ｃ１` = 'ｰｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿ';
SELECT * FROM `Ｔ８` WHERE `Ｃ１` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
SELECT * FROM `Ｔ９` WHERE `Ｃ１` = 'ソ十表予構噂蚕申貼能暴禄曾箪兔喀媾彌拿杤';

#BDB
SELECT * FROM `Ｔ１０` WHERE `Ｃ１` = 'ｰｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿ';
SELECT * FROM `Ｔ１１` WHERE `Ｃ１` = '・ぁあぃいぅうぇえぉおかがきぎくぐけげこ';
SELECT * FROM `Ｔ１２` WHERE `Ｃ１` = 'ソ十表予構噂蚕申貼能暴禄曾箪兔喀媾彌拿杤';

#Test to distinguish 0x9353 and 0x9373
CREATE TABLE t1(c1 char(1)) default charset = sjis engine=innodb;
CREATE TABLE t2(c1 char(1)) default charset = sjis engine=myisam;
CREATE TABLE t3(c1 char(1)) default charset = sjis engine=heap;
CREATE TABLE t4(c1 char(1)) default charset = sjis engine=bdb;
INSERT INTO t1 VALUES('鉄'),('都');
INSERT INTO t2 VALUES('鉄'),('都');
INSERT INTO t3 VALUES('鉄'),('都');
INSERT INTO t4 VALUES('鉄'),('都');
SELECT * FROM t1 WHERE c1 = '鉄';
SELECT * FROM t2 WHERE c1 = '鉄';
SELECT * FROM t3 WHERE c1 = '鉄';
SELECT * FROM t4 WHERE c1 = '鉄';
SELECT * FROM t1 WHERE c1 = '都';
SELECT * FROM t2 WHERE c1 = '都';
SELECT * FROM t3 WHERE c1 = '都';
SELECT * FROM t4 WHERE c1 = '都';

DROP TABLE `Ｔ１`;
DROP TABLE `Ｔ２`;
DROP TABLE `Ｔ３`;
DROP TABLE `Ｔ４`;
DROP TABLE `Ｔ５`;
DROP TABLE `Ｔ６`;
DROP TABLE `Ｔ７`;
DROP TABLE `Ｔ８`;
DROP TABLE `Ｔ９`;
DROP TABLE `Ｔ１０`;
DROP TABLE `Ｔ１１`;
DROP TABLE `Ｔ１２`;
