~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to mysql-test/suite/funcs_1/t/charset_collation.test

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# suite/funcs_1/t/charset_collation.test
 
2
#
 
3
# Tests checking the content of the information_schema tables
 
4
#      character_sets
 
5
#      collations
 
6
#      collation_character_set_applicability
 
7
#
 
8
# Created:
 
9
# 2009-04-28 mleich Replace the charset_collation_* test which failed too often
 
10
#                   because of changes
 
11
#                   - in general available character sets and collations
 
12
#                   - in build types
 
13
#                   (Bug#40545, Bug#40209, Bug#40618, Bug#38346)
 
14
#
 
15
 
 
16
# Create a low privileged user.
 
17
--error 0, ER_CANNOT_USER
 
18
DROP USER dbdict_test@localhost;
 
19
CREATE USER dbdict_test@localhost;
 
20
 
 
21
--echo # Establish connection con (user=dbdict_test)
 
22
connect (con,localhost,dbdict_test,,);
 
23
################################################################################
 
24
#
 
25
# The original requirements for the following tests were:
 
26
#
 
27
# 3.2.2.2: Ensure that the table (information_schema.character_sets) shows the
 
28
#          relevant information on every character set for which the current
 
29
#          user or PUBLIC have the USAGE privilege.
 
30
#
 
31
# 3.2.2.3: Ensure that the table (information_schema.character_sets) does not
 
32
#          show any information on any character set for which the current user
 
33
#          or PUBLIC have no USAGE privilege.
 
34
#
 
35
#
 
36
# 3.2.3.2: Ensure that the table (information_schema.collations) shows the
 
37
#          relevant information on every collation for which the current user
 
38
#          or PUBLIC have the USAGE privilege.
 
39
#
 
40
# 3.2.3.3: Ensure that the table (information_schema.collations) does not show
 
41
#          any information on any collations for which the current user and
 
42
#          PUBLIC have no USAGE privilege.
 
43
#
 
44
#
 
45
# 3.2.4.2: Ensure that the table
 
46
#                information_schema.collation_character_set_applicability
 
47
#          shows the relevant information on every collation/character set
 
48
#          combination for which the current user or PUBLIC have the USAGE
 
49
#          privilege.
 
50
#
 
51
# 3.2.4.3: Ensure that the table
 
52
#                information_schema.collation_character_set_applicability
 
53
#          does not show any information on any collation/character set
 
54
#          combinations for which the current user and PUBLIC have no
 
55
#          USAGE privilege.
 
56
#
 
57
# Notes (2009-04-28 mleich):
 
58
# - The requirements are outdated because grant/revoke privilege for using a
 
59
#   characterset/collation were never implemented.
 
60
#   Therefore the tests focus on the completeness and correctness of the
 
61
#   content (rows and columns) of these tables.
 
62
# - The amount of collations/character sets grows with new MySQL releases.
 
63
#   Even within the same release the amount of records within these tables
 
64
#   can differ between different build types (community, enterprise, source,...)
 
65
#   Therefore we limit the queries to character sets and collations which
 
66
#   - exist in all build types
 
67
#   - have in all build types the same "state".
 
68
#   The character set
 
69
#   - utf8 is used for Metadata
 
70
#   - ascii is a quite usual
 
71
#   The collations <character set>_general_ci and <character set>_bin seem
 
72
#   to be available all time.
 
73
#
 
74
################################################################################
 
75
 
 
76
let $char_set_condition= character_set_name IN ('utf8','latin1','binary');
 
77
let $collation_condition=
 
78
   (collation_name LIKE CONCAT(character_set_name,'_general_ci')
 
79
    OR
 
80
    collation_name LIKE CONCAT(character_set_name,'_bin'));
 
81
--echo
 
82
eval SELECT *
 
83
FROM information_schema.character_sets
 
84
WHERE $char_set_condition
 
85
ORDER BY character_set_name;
 
86
 
 
87
--echo
 
88
eval SELECT *
 
89
FROM information_schema.collations
 
90
WHERE $char_set_condition
 
91
  AND $collation_condition
 
92
ORDER BY collation_name;
 
93
 
 
94
--echo
 
95
eval SELECT *
 
96
FROM information_schema.collation_character_set_applicability
 
97
WHERE $char_set_condition
 
98
  AND $collation_condition
 
99
ORDER BY collation_name, character_set_name;
 
100
 
 
101
 
 
102
# Cleanup
 
103
--echo # Switch to connection default + disconnect con
 
104
connection default;
 
105
disconnect con;
 
106
DROP USER dbdict_test@localhost;
 
107