--source include/have_ucs2.inc
--source include/have_innodb.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 `Ｔ９`;
--enable_warnings

#
# Test CHAR_LENGTH() function with Japanese character in ucs2 encoding
#

SET NAMES ujis;
SET character_set_database = ucs2;
SET collation_connection = ucs2_general_ci;

CREATE TABLE `Ｔ１` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = innodb;
CREATE TABLE `Ｔ２` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = innodb;
CREATE TABLE `Ｔ３` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = innodb;
CREATE TABLE `Ｔ４` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = myisam;
CREATE TABLE `Ｔ５` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = myisam;
CREATE TABLE `Ｔ６` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = myisam;
CREATE TABLE `Ｔ７` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
CREATE TABLE `Ｔ８` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = MEMORY;
CREATE TABLE `Ｔ９` (`Ｃ１` char(5), INDEX(`Ｃ１`)) DEFAULT CHARSET = ucs2 engine = MEMORY;

INSERT INTO `Ｔ１` VALUES ('ｱｲｳｴｵ'),('ｱｲｳｴ'),('ｱｲｳ'),('ｱｲ'),('ｱ'),('');
INSERT INTO `Ｔ２` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
INSERT INTO `Ｔ３` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
INSERT INTO `Ｔ４` VALUES ('ｱｲｳｴｵ'),('ｱｲｳｴ'),('ｱｲｳ'),('ｱｲ'),('ｱ'),('');
INSERT INTO `Ｔ５` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
INSERT INTO `Ｔ６` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');
INSERT INTO `Ｔ７` VALUES ('ｱｲｳｴｵ'),('ｱｲｳｴ'),('ｱｲｳ'),('ｱｲ'),('ｱ'),('');
INSERT INTO `Ｔ８` VALUES ('あいうえお'),('あいうえ'),('あいう'),('あい'),('あ'),('');
INSERT INTO `Ｔ９` VALUES ('龔龖龗龞龡'),('龔龖龗龞'),('龔龖龗'),('龔龖'),('龔'),('');

#InnoDB
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ１`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ２`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ３`;

#MyISAM
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ４`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ５`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ６`;

#MEMORY
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ７`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ８`;
SELECT `Ｃ１`, CHAR_LENGTH(`Ｃ１`) FROM `Ｔ９`;

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