2
drop table if exists `T1`;
3
drop table if exists `T2`;
4
drop table if exists `T3`;
5
drop table if exists `T4`;
6
drop table if exists `T5`;
7
drop table if exists `T6`;
8
drop table if exists `T7`;
9
drop table if exists `T8`;
10
drop table if exists `T9`;
11
drop table if exists `T10`;
15
# Test TRIM() function with Japanese characters utf8 encoding
19
SET character_set_database = utf8;
21
CREATE TABLE `T1` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
22
CREATE TABLE `T2` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
23
CREATE TABLE `T3` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = innodb;
24
CREATE TABLE `T4` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
25
CREATE TABLE `T5` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
26
CREATE TABLE `T6` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = myisam;
27
CREATE TABLE `T7` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
28
CREATE TABLE `T8` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
29
CREATE TABLE `T9` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = heap;
30
CREATE TABLE `T10` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
31
CREATE TABLE `T11` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
32
CREATE TABLE `T12` (`C1` char(12), INDEX(`C1`)) DEFAULT CHARSET = utf8 engine = bdb;
35
INSERT INTO `T1` VALUES ('アイウエオ');
36
# Test data for TRIM(TRAILING [remstr] FROM str)
37
INSERT INTO `T1` VALUES ('アイウエオカ');
38
INSERT INTO `T1` VALUES ('アイウエオカカ');
39
INSERT INTO `T1` VALUES ('アイウエオカカカ');
40
# Test data for TRIM(LEADING [remstr] FROM str)
41
INSERT INTO `T1` VALUES ('カアイウエオ');
42
INSERT INTO `T1` VALUES ('カカアイウエオ');
43
INSERT INTO `T1` VALUES ('カカカアイウエオ');
44
# Test data for TRIM(BOTH [remstr] FROM str)
45
INSERT INTO `T1` VALUES ('カカカアイウエオカカカ');
46
# Test data for TRIM without [remstr] (remove spaces)
47
INSERT INTO `T1` VALUES (' アイウエオ ');
48
INSERT INTO `T2` VALUES ('あいうえお');
49
INSERT INTO `T2` VALUES ('あいうえおか');
50
INSERT INTO `T2` VALUES ('あいうえおかか');
51
INSERT INTO `T2` VALUES ('あいうえおかかか');
52
INSERT INTO `T2` VALUES ('かあいうえお');
53
INSERT INTO `T2` VALUES ('かかあいうえお');
54
INSERT INTO `T2` VALUES ('かかかあいうえお');
55
INSERT INTO `T2` VALUES ('かかかあいうえおかかか');
56
INSERT INTO `T2` VALUES (' あいうえお ');
57
INSERT INTO `T3` VALUES ('龔龖龗龞龡');
58
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂');
59
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂');
60
INSERT INTO `T3` VALUES ('龔龖龗龞龡丂丂丂');
61
INSERT INTO `T3` VALUES ('丂龔龖龗龞龡');
62
INSERT INTO `T3` VALUES ('丂丂龔龖龗龞龡');
63
INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡');
64
INSERT INTO `T3` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
65
INSERT INTO `T3` VALUES (' 龔龖龗龞龡 ');
67
INSERT INTO `T4` VALUES ('アイウエオ');
68
INSERT INTO `T4` VALUES ('アイウエオカ');
69
INSERT INTO `T4` VALUES ('アイウエオカカ');
70
INSERT INTO `T4` VALUES ('アイウエオカカカ');
71
INSERT INTO `T4` VALUES ('カアイウエオ');
72
INSERT INTO `T4` VALUES ('カカアイウエオ');
73
INSERT INTO `T4` VALUES ('カカカアイウエオ');
74
INSERT INTO `T4` VALUES ('カカカアイウエオカカカ');
75
INSERT INTO `T4` VALUES (' アイウエオ ');
76
INSERT INTO `T5` VALUES ('あいうえお');
77
INSERT INTO `T5` VALUES ('あいうえおか');
78
INSERT INTO `T5` VALUES ('あいうえおかか');
79
INSERT INTO `T5` VALUES ('あいうえおかかか');
80
INSERT INTO `T5` VALUES ('かあいうえお');
81
INSERT INTO `T5` VALUES ('かかあいうえお');
82
INSERT INTO `T5` VALUES ('かかかあいうえお');
83
INSERT INTO `T5` VALUES ('かかかあいうえおかかか');
84
INSERT INTO `T5` VALUES (' あいうえお ');
85
INSERT INTO `T6` VALUES ('龔龖龗龞龡');
86
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂');
87
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂');
88
INSERT INTO `T6` VALUES ('龔龖龗龞龡丂丂丂');
89
INSERT INTO `T6` VALUES ('丂龔龖龗龞龡');
90
INSERT INTO `T6` VALUES ('丂丂龔龖龗龞龡');
91
INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡');
92
INSERT INTO `T6` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
93
INSERT INTO `T6` VALUES (' 龔龖龗龞龡 ');
95
INSERT INTO `T7` VALUES ('アイウエオ');
96
INSERT INTO `T7` VALUES ('アイウエオカ');
97
INSERT INTO `T7` VALUES ('アイウエオカカ');
98
INSERT INTO `T7` VALUES ('アイウエオカカカ');
99
INSERT INTO `T7` VALUES ('カアイウエオ');
100
INSERT INTO `T7` VALUES ('カカアイウエオ');
101
INSERT INTO `T7` VALUES ('カカカアイウエオ');
102
INSERT INTO `T7` VALUES ('カカカアイウエオカカカ');
103
INSERT INTO `T7` VALUES (' アイウエオ ');
104
INSERT INTO `T8` VALUES ('あいうえお');
105
INSERT INTO `T8` VALUES ('あいうえおか');
106
INSERT INTO `T8` VALUES ('あいうえおかか');
107
INSERT INTO `T8` VALUES ('あいうえおかかか');
108
INSERT INTO `T8` VALUES ('かあいうえお');
109
INSERT INTO `T8` VALUES ('かかあいうえお');
110
INSERT INTO `T8` VALUES ('かかかあいうえお');
111
INSERT INTO `T8` VALUES ('かかかあいうえおかかか');
112
INSERT INTO `T8` VALUES (' あいうえお ');
113
INSERT INTO `T9` VALUES ('龔龖龗龞龡');
114
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂');
115
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂');
116
INSERT INTO `T9` VALUES ('龔龖龗龞龡丂丂丂');
117
INSERT INTO `T9` VALUES ('丂龔龖龗龞龡');
118
INSERT INTO `T9` VALUES ('丂丂龔龖龗龞龡');
119
INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡');
120
INSERT INTO `T9` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
121
INSERT INTO `T9` VALUES (' 龔龖龗龞龡 ');
123
INSERT INTO `T10` VALUES ('アイウエオ');
124
INSERT INTO `T10` VALUES ('アイウエオカ');
125
INSERT INTO `T10` VALUES ('アイウエオカカ');
126
INSERT INTO `T10` VALUES ('アイウエオカカカ');
127
INSERT INTO `T10` VALUES ('カアイウエオ');
128
INSERT INTO `T10` VALUES ('カカアイウエオ');
129
INSERT INTO `T10` VALUES ('カカカアイウエオ');
130
INSERT INTO `T10` VALUES ('カカカアイウエオカカカ');
131
INSERT INTO `T10` VALUES (' アイウエオ ');
132
INSERT INTO `T11` VALUES ('あいうえお');
133
INSERT INTO `T11` VALUES ('あいうえおか');
134
INSERT INTO `T11` VALUES ('あいうえおかか');
135
INSERT INTO `T11` VALUES ('あいうえおかかか');
136
INSERT INTO `T11` VALUES ('かあいうえお');
137
INSERT INTO `T11` VALUES ('かかあいうえお');
138
INSERT INTO `T11` VALUES ('かかかあいうえお');
139
INSERT INTO `T11` VALUES ('かかかあいうえおかかか');
140
INSERT INTO `T11` VALUES (' あいうえお ');
141
INSERT INTO `T12` VALUES ('龔龖龗龞龡');
142
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂');
143
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂丂');
144
INSERT INTO `T12` VALUES ('龔龖龗龞龡丂丂丂');
145
INSERT INTO `T12` VALUES ('丂龔龖龗龞龡');
146
INSERT INTO `T12` VALUES ('丂丂龔龖龗龞龡');
147
INSERT INTO `T12` VALUES ('丂丂丂龔龖龗龞龡');
148
INSERT INTO `T12` VALUES ('丂丂丂龔龖龗龞龡丂丂丂');
149
INSERT INTO `T12` VALUES (' 龔龖龗龞龡 ');
152
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T1`;
153
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T1`;
154
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T1`;
155
SELECT `C1`,TRIM(`C1`) FROM `T1`;
156
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T2`;
157
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T2`;
158
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T2`;
159
SELECT `C1`,TRIM(`C1`) FROM `T2`;
160
SELECT `C1`,TRIM(TRAILING '丂'FROM `C1`) FROM `T3`;
161
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T3`;
162
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T3`;
163
SELECT `C1`,TRIM(`C1`) FROM `T3`;
166
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T4`;
167
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T4`;
168
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T4`;
169
SELECT `C1`,TRIM(`C1`) FROM `T4`;
170
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T5`;
171
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T5`;
172
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T5`;
173
SELECT `C1`,TRIM(`C1`) FROM `T5`;
174
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T6`;
175
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T6`;
176
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T6`;
177
SELECT `C1`,TRIM(`C1`) FROM `T6`;
180
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T7`;
181
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T7`;
182
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T7`;
183
SELECT `C1`,TRIM(`C1`) FROM `T7`;
184
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T8`;
185
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T8`;
186
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T8`;
187
SELECT `C1`,TRIM(`C1`) FROM `T8`;
188
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T9`;
189
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T9`;
190
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T9`;
191
SELECT `C1`,TRIM(`C1`) FROM `T9`;
194
SELECT `C1`,TRIM(TRAILING 'カ' FROM `C1`) FROM `T10`;
195
SELECT `C1`,TRIM(LEADING 'カ' FROM `C1`) FROM `T10`;
196
SELECT `C1`,TRIM(BOTH 'カ' FROM `C1`) FROM `T10`;
197
SELECT `C1`,TRIM(`C1`) FROM `T10`;
198
SELECT `C1`,TRIM(TRAILING 'か' FROM `C1`) FROM `T11`;
199
SELECT `C1`,TRIM(LEADING 'か' FROM `C1`) FROM `T11`;
200
SELECT `C1`,TRIM(BOTH 'か' FROM `C1`) FROM `T11`;
201
SELECT `C1`,TRIM(`C1`) FROM `T11`;
202
SELECT `C1`,TRIM(TRAILING '丂' FROM `C1`) FROM `T12`;
203
SELECT `C1`,TRIM(LEADING '丂' FROM `C1`) FROM `T12`;
204
SELECT `C1`,TRIM(BOTH '丂' FROM `C1`) FROM `T12`;
205
SELECT `C1`,TRIM(`C1`) FROM `T12`;