-- source include/have_innodb.inc
-- source include/have_bdb.inc
--character_set sjis
--disable_warnings
drop table if exists `‚s‚P`;
drop table if exists `‚s‚Q`;
drop table if exists `‚s‚R`;
drop table if exists `‚s‚S`;
drop table if exists `‚s‚T`;
drop table if exists `‚s‚U`;
drop table if exists `‚s‚V`;
drop table if exists `‚s‚W`;
drop table if exists `‚s‚X`;
drop table if exists `‚s‚P‚O`;
drop table if exists `‚s‚P‚P`;
drop table if exists `‚s‚P‚Q`;
--enable_warnings

#
# Test CHARSET() function with Japanese characters in sjis encoding
#

SET NAMES sjis;
SET character_set_database = sjis;

CREATE TABLE `‚s‚P` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `‚s‚Q` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `‚s‚R` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = innodb;
CREATE TABLE `‚s‚S` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `‚s‚T` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `‚s‚U` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = myisam;
CREATE TABLE `‚s‚V` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `‚s‚W` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `‚s‚X` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = heap;
CREATE TABLE `‚s‚P‚O` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = bdb;
CREATE TABLE `‚s‚P‚P` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = bdb;
CREATE TABLE `‚s‚P‚Q` (`‚b‚P` char(20)) DEFAULT CHARSET = sjis engine = bdb;

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

--disable_query_log
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `‚s‚P`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `‚s‚Q`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `‚s‚R`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `‚s‚S`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `‚s‚T`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `‚s‚U`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `‚s‚V`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `‚s‚W`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `‚s‚X`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_sjis.dat' INTO TABLE `‚s‚P‚O`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis.dat' INTO TABLE `‚s‚P‚P`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_sjis2.dat' INTO TABLE `‚s‚P‚Q`;
--enable_query_log

#InnoDB
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚P`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚Q`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚R`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚R`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚R`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚R`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚R`;

#MyISAM
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚S`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚T`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚U`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚S`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚S`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚S`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚S`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚T`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚T`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚T`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚T`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚U`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚U`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚U`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚U`;

#Heap
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚V`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚W`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚X`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚V`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚V`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚V`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚V`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚W`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚W`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚W`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚W`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚X`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚X`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚X`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚X`;

#BDB
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚P‚O`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚P‚P`;
SELECT DISTINCT CHARSET(`‚b‚P`) FROM `‚s‚P‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚P‚O`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚P‚O`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚P‚O`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚P‚O`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚P‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚P‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚P‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚P‚P`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING utf8)) FROM `‚s‚P‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ucs2)) FROM `‚s‚P‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING sjis)) FROM `‚s‚P‚Q`;
SELECT DISTINCT CHARSET(CONVERT(`‚b‚P` USING ujis)) FROM `‚s‚P‚Q`;

drop table `‚s‚P`;
drop table `‚s‚Q`;
drop table `‚s‚R`;
drop table `‚s‚S`;
drop table `‚s‚T`;
drop table `‚s‚U`;
drop table `‚s‚V`;
drop table `‚s‚W`;
drop table `‚s‚X`;
drop table `‚s‚P‚O`;
drop table `‚s‚P‚P`;
drop table `‚s‚P‚Q`;
