Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
414bd57b
Commit
414bd57b
authored
Sep 16, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UCS tests
parent
62f2cb14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
241 additions
and
0 deletions
+241
-0
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_ucs.result
+111
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+130
-0
No files found.
mysql-test/r/ctype_ucs.result
0 → 100644
View file @
414bd57b
DROP TABLE IF EXISTS t1;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r''), (X'2004');
SELECT hex(word) FROM t1 ORDER BY word;
hex(word)
0420
2004
DELETE FROM t1;
INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020');
SELECT hex(word) FROM t1 ORDER BY word;
hex(word)
0420
2004
DROP TABLE t1;
CREATE TABLE t1 (
word VARCHAR(64),
bar INT(11) default 0,
PRIMARY KEY (word))
TYPE=MyISAM
CHARSET ucs2
COLLATE ucs2_general_ci ;
INSERT INTO t1 (word) VALUES ("aar");
INSERT INTO t1 (word) VALUES ("a");
INSERT INTO t1 (word) VALUES ("aardvar");
INSERT INTO t1 (word) VALUES ("aardvark");
INSERT INTO t1 (word) VALUES ("aardvara");
INSERT INTO t1 (word) VALUES ("aardvarz");
EXPLAIN SELECT * FROM t1 ORDER BY word;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
SELECT * FROM t1 ORDER BY word;
word bar
a 0
aar 0
aardvar 0
aardvara 0
aardvark 0
aardvarz 0
EXPLAIN SELECT word FROM t1 ORDER BY word;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
SELECT word FROM t1 ORDER by word;
word
a
aar
aardvar
aardvara
aardvark
aardvarz
DROP TABLE t1;
CREATE TABLE t1 (
word VARCHAR(64) ,
PRIMARY KEY (word))
TYPE=MyISAM
CHARSET ucs2
COLLATE ucs2_general_ci;
INSERT INTO t1 (word) VALUES ("aar");
INSERT INTO t1 (word) VALUES ("a");
INSERT INTO t1 (word) VALUES ("aardvar");
INSERT INTO t1 (word) VALUES ("aardvark");
INSERT INTO t1 (word) VALUES ("aardvara");
INSERT INTO t1 (word) VALUES ("aardvarz");
EXPLAIN SELECT * FROM t1 ORDER BY WORD;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 128 NULL 6 Using index
SELECT * FROM t1 ORDER BY word;
word
a
aar
aardvar
aardvara
aardvark
aardvarz
DROP TABLE t1;
CREATE TABLE t1 (
word TEXT,
bar INT(11) AUTO_INCREMENT,
PRIMARY KEY (bar))
TYPE=MyISAM
CHARSET ucs2
COLLATE ucs2_general_ci ;
INSERT INTO t1 (word) VALUES ("aar");
INSERT INTO t1 (word) VALUES ("a" );
INSERT INTO t1 (word) VALUES ("aardvar");
INSERT INTO t1 (word) VALUES ("aardvark");
INSERT INTO t1 (word) VALUES ("aardvara");
INSERT INTO t1 (word) VALUES ("aardvarz");
EXPLAIN SELECT * FROM t1 ORDER BY word;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
SELECT * FROM t1 ORDER BY word;
word bar
a 2
aar 1
aardvar 3
aardvara 5
aardvark 4
aardvarz 6
EXPLAIN SELECT word FROM t1 ORDER BY word;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
SELECT word FROM t1 ORDER BY word;
word
a
aar
aardvar
aardvara
aardvark
aardvarz
DROP TABLE t1;
mysql-test/t/ctype_ucs.test
0 → 100644
View file @
414bd57b
--
source
include
/
have_ucs2
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
SET
CHARACTER
SET
koi8r
;
#
# Check that 0x20 is only trimmed when it is
# a part of real SPACE character, not just a part
# of a multibyte sequence.
# Note, CYRILLIC LETTER ER is used as an example, which
# is stored as 0x0420 in UCS2, thus contains 0x20 in the
# low byte. The second character is THREE-PER-M, U+2004,
# which contains 0x20 in the high byte.
#
CREATE
TABLE
t1
(
word
VARCHAR
(
64
)
CHARACTER
SET
ucs2
);
INSERT
INTO
t1
VALUES
(
_koi8r
''
),
(
X
'2004'
);
SELECT
hex
(
word
)
FROM
t1
ORDER
BY
word
;
DELETE
FROM
t1
;
#
# Check that real spaces are correctly trimmed.
#
INSERT
INTO
t1
VALUES
(
X
'042000200020'
),
(
X
'200400200020'
);
SELECT
hex
(
word
)
FROM
t1
ORDER
BY
word
;
DROP
TABLE
t1
;
######################################################
#
# Bug 1264
#
# Description:
#
# When using a ucs2 table in MySQL,
# either with ucs2_general_ci or ucs2_bin collation,
# words are returned in an incorrect order when using ORDER BY
# on an _indexed_ CHAR or VARCHAR column. They are sorted with
# the longest word *first* instead of last. I.E. The word "aardvark"
# is in the results before the word "a".
#
# If there is no index for the column, the problem does not occur.
#
# Interestingly, if there is no second column, the words are returned
# in the correct order.
#
# According to EXPLAIN, it looks like when the output includes columns that
# are not part of the index sorted on, it does a filesort, which fails.
# Using a straight index yields correct results.
#
# Two fields, index
#
CREATE
TABLE
t1
(
word
VARCHAR
(
64
),
bar
INT
(
11
)
default
0
,
PRIMARY
KEY
(
word
))
TYPE
=
MyISAM
CHARSET
ucs2
COLLATE
ucs2_general_ci
;
INSERT
INTO
t1
(
word
)
VALUES
(
"aar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"a"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvark"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvara"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvarz"
);
EXPLAIN
SELECT
*
FROM
t1
ORDER
BY
word
;
SELECT
*
FROM
t1
ORDER
BY
word
;
EXPLAIN
SELECT
word
FROM
t1
ORDER
BY
word
;
SELECT
word
FROM
t1
ORDER
by
word
;
DROP
TABLE
t1
;
#
# One field, index
#
CREATE
TABLE
t1
(
word
VARCHAR
(
64
)
,
PRIMARY
KEY
(
word
))
TYPE
=
MyISAM
CHARSET
ucs2
COLLATE
ucs2_general_ci
;
INSERT
INTO
t1
(
word
)
VALUES
(
"aar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"a"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvark"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvara"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvarz"
);
EXPLAIN
SELECT
*
FROM
t1
ORDER
BY
WORD
;
SELECT
*
FROM
t1
ORDER
BY
word
;
DROP
TABLE
t1
;
#
# Two fields, no index
#
CREATE
TABLE
t1
(
word
TEXT
,
bar
INT
(
11
)
AUTO_INCREMENT
,
PRIMARY
KEY
(
bar
))
TYPE
=
MyISAM
CHARSET
ucs2
COLLATE
ucs2_general_ci
;
INSERT
INTO
t1
(
word
)
VALUES
(
"aar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"a"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvar"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvark"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvara"
);
INSERT
INTO
t1
(
word
)
VALUES
(
"aardvarz"
);
EXPLAIN
SELECT
*
FROM
t1
ORDER
BY
word
;
SELECT
*
FROM
t1
ORDER
BY
word
;
EXPLAIN
SELECT
word
FROM
t1
ORDER
BY
word
;
SELECT
word
FROM
t1
ORDER
BY
word
;
DROP
TABLE
t1
;
#
# END OF Bug 1264 test
#
########################################################
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment