From d5d4923107a2f8d3455debfe6ab8b22b5793f6cf Mon Sep 17 00:00:00 2001
From: "bar@bar.mysql.r18.ru" <>
Date: Thu, 25 Sep 2003 18:06:39 +0500
Subject: [PATCH] LPAD and RPAD test with UCS2 was added.

---
 mysql-test/r/ctype_ucs.result | 34 ++++++++++++++++++++++++++++++++++
 mysql-test/t/ctype_ucs.test   | 18 ++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 2a0b17df04..db626c8acb 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -13,6 +13,40 @@ hex(word)
 0420
 2004
 DROP TABLE t1;
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+СССССССССР
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+LPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+СТСТСТСТСР
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+СТУСТУСТУР
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+РСТУФХЦЧШЩ
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421')
+РССССССССС
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+RPAD(_ucs2 X'0420',10,_ucs2 X'04210422')
+РСТСТСТСТС
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423')
+РСТУСТУСТУ
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423')
+РСТУФХЦЧШЩ
+CREATE TABLE t1 SELECT 
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `l` char(10) character set ucs2 NOT NULL default '',
+  `r` char(10) character set ucs2 NOT NULL default ''
+) TYPE=MyISAM CHARSET=latin1
+DROP TABLE t1;
 SET NAMES koi8r;
 SET character_set_connection=ucs2;
 create table t1 (a varchar(10) character set ucs2, key(a));
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 80ae70c0fe..0457c204e3 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -29,6 +29,24 @@ INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
 SELECT hex(word) FROM t1 ORDER BY word;
 DROP TABLE t1;
 
+#
+# Check LPAD/RPAD
+#
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
+SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
+SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
+
+CREATE TABLE t1 SELECT 
+LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
+RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
 ######################################################
 #
 # Test of like
-- 
2.30.9