-- source include/have_innodb.inc
-- source include/have_bdb.inc
--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 CHARSET() function with Japanese characters in utf8 encoding
#

SET NAMES utf8;
SET character_set_database = utf8;

CREATE TABLE `Ｔ１` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ２` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ３` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ４` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `Ｔ５` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `Ｔ６` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = myisam;
CREATE TABLE `Ｔ７` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `Ｔ８` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `Ｔ９` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = heap;
CREATE TABLE `Ｔ１０` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = bdb;
CREATE TABLE `Ｔ１１` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 engine = bdb;
CREATE TABLE `Ｔ１２` (`Ｃ１` char(20)) DEFAULT CHARSET = utf8 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_utf8.dat' INTO TABLE `Ｔ１`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `Ｔ２`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `Ｔ３`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `Ｔ４`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `Ｔ５`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `Ｔ６`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `Ｔ７`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `Ｔ８`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `Ｔ９`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0201_utf8.dat' INTO TABLE `Ｔ１０`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0208_utf8.dat' INTO TABLE `Ｔ１１`;
 --eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/suite/jp/std_data/jisx0212_utf8.dat' INTO TABLE `Ｔ１２`;
--enable_query_log

#InnoDB
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ１`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ２`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ３`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ３`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ３`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ３`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ３`;

#MyISAM
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ４`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ５`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ６`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ４`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ４`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ４`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ４`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ５`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ５`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ５`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ５`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ６`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ６`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ６`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ６`;

#Heap
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ７`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ８`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ９`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ７`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ７`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ７`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ７`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ８`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ８`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ８`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ８`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ９`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ９`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ９`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ９`;

#BDB
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ１０`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ１１`;
SELECT DISTINCT CHARSET(`Ｃ１`) FROM `Ｔ１２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ１０`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ１０`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ１０`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ１０`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ１１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ１１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ１１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ１１`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING utf8)) FROM `Ｔ１２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ucs2)) FROM `Ｔ１２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING sjis)) FROM `Ｔ１２`;
SELECT DISTINCT CHARSET(CONVERT(`Ｃ１` USING ujis)) FROM `Ｔ１２`;

drop table `Ｔ１`;
drop table `Ｔ２`;
drop table `Ｔ３`;
drop table `Ｔ４`;
drop table `Ｔ５`;
drop table `Ｔ６`;
drop table `Ｔ７`;
drop table `Ｔ８`;
drop table `Ｔ９`;
drop table `Ｔ１０`;
drop table `Ｔ１１`;
drop table `Ｔ１２`;
