~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/ctype_euckr.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_euckr.inc
 
2
 
 
3
#
 
4
# Tests with the euckr character set
 
5
#
 
6
--disable_warnings
 
7
drop table if exists t1;
 
8
--enable_warnings
 
9
 
 
10
SET @test_character_set= 'euckr';
 
11
SET @test_collation= 'euckr_korean_ci';
 
12
-- source include/ctype_common.inc
 
13
 
 
14
SET NAMES euckr;
 
15
SET collation_connection='euckr_korean_ci';
 
16
-- source include/ctype_filesort.inc
 
17
-- source include/ctype_innodb_like.inc
 
18
-- source include/ctype_like_escape.inc
 
19
-- source include/ctype_like_range_f1f2.inc
 
20
SET collation_connection='euckr_bin';
 
21
-- source include/ctype_filesort.inc
 
22
-- source include/ctype_innodb_like.inc
 
23
-- source include/ctype_like_escape.inc
 
24
-- source include/ctype_like_range_f1f2.inc
 
25
 
 
26
#
 
27
# Bug#15377 Valid multibyte sequences are truncated on INSERT
 
28
#
 
29
SET NAMES euckr;
 
30
CREATE TABLE t1 (a text) character set euckr;
 
31
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
 
32
SELECT hex(a) FROM t1 ORDER BY a;
 
33
DROP TABLE t1;
 
34
 
 
35
# End of 4.1 tests
 
36
 
 
37
#
 
38
#Bug #30315 Character sets: insertion of euckr code value 0xa141 fails
 
39
#
 
40
create table t1 (s1 varchar(5) character set euckr);
 
41
# Insert some valid characters
 
42
insert into t1 values (0xA141);
 
43
insert into t1 values (0xA15A);
 
44
insert into t1 values (0xA161);
 
45
insert into t1 values (0xA17A);
 
46
insert into t1 values (0xA181);
 
47
insert into t1 values (0xA1FE);
 
48
# Insert some invalid characters
 
49
insert into t1 values (0xA140);
 
50
insert into t1 values (0xA15B);
 
51
insert into t1 values (0xA160);
 
52
insert into t1 values (0xA17B);
 
53
insert into t1 values (0xA180);
 
54
insert into t1 values (0xA1FF);
 
55
select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
 
56
drop table t1;
 
57
 
 
58
--echo End of 5.0 tests
 
59
 
 
60
 
 
61
--echo Start of 5.4 tests
 
62
 
 
63
--echo #
 
64
--echo # WL#3997 New euckr characters
 
65
--echo #
 
66
SET NAMES utf8;
 
67
CREATE TABLE t1 (a varchar(10) character set euckr);
 
68
INSERT INTO t1 VALUES (0xA2E6), (0xA2E7);
 
69
SELECT hex(a), hex(@utf8:=convert(a using utf8)), hex(convert(@utf8 using euckr)) FROM t1;
 
70
DROP TABLE t1;
 
71
 
 
72
--echo #
 
73
--echo # WL#3332 Korean Enhancements
 
74
--echo # euckr valid codes are now [81..FE][41..5A,61..7A,81..FE]
 
75
--echo #
 
76
 
 
77
CREATE TABLE t1 (a binary(1), key(a));
 
78
--disable_query_log
 
79
let $1=255;
 
80
while($1)
 
81
{
 
82
  eval INSERT INTO t1 VALUES (unhex(hex($1)));
 
83
  dec $1;
 
84
}
 
85
--enable_query_log
 
86
 
 
87
CREATE TABLE t2 (s VARCHAR(4), a VARCHAR(1) CHARACTER SET euckr);
 
88
--disable_warnings
 
89
INSERT INTO t2
 
90
SELECT hex(concat(t11.a, t12.a)), concat(t11.a, t12.a)
 
91
FROM t1 t11, t1 t12
 
92
WHERE t11.a >= 0x81 AND t11.a <= 0xFE
 
93
AND   t12.a >= 0x41 AND t12.a <= 0xFE
 
94
ORDER BY t11.a, t12.a;
 
95
--enable_warnings
 
96
SELECT s as bad_code FROM t2 WHERE a='' ORDER BY s;
 
97
DELETE FROM t2 WHERE a='';
 
98
ALTER TABLE t2 ADD u VARCHAR(1) CHARACTER SET utf8, ADD a2 VARCHAR(1) CHARACTER SET euckr;
 
99
--disable_warnings
 
100
UPDATE t2 SET u=a, a2=u;
 
101
--enable_warnings
 
102
SELECT s as unassigned_code FROM t2 WHERE u='?';
 
103
DELETE FROM t2 WHERE u='?';
 
104
# Make sure there are no euckr->utf8->euckr roundtrip problems
 
105
SELECT count(*) as roundtrip_problem_chars FROM t2 WHERE hex(a) <> hex(a2);
 
106
SELECT s, hex(a), hex(u), hex(a2) FROM t2 ORDER BY s;
 
107
DROP TABLE t1, t2;
 
108
 
 
109
--echo End of 5.4 tests