blob: 737099158c7fc5ef8660690b2f2cb3e9630a84fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
############## mysql-test\t\character_set_connection_func.test ###############
# #
# Variable Name: character_set_connection #
# Scope: GLOBAL | SESSION #
# Access Type: Dynamic #
# Data Type: string #
# Default Value: utf8 (session), latin1 (global) #
# Range: NA #
# #
# #
# Creation Date: 2008-03-08 #
# Author: Rizwan #
# #
# Description: Test Cases of Dynamic System Variable character_set_connection #
# that checks the behavior of this variable #
# #
# Reference: #
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--echo '#--------------------FN_DYNVARS_011_01-------------------------#'
##########################################################################
# Check if setting character_set_connection is changed in new connection #
##########################################################################
#save
SET @global_character_set_connection = @@global.character_set_connection;
SET @session_character_set_connection = @@session.character_set_connection;
SET @session_character_set_client = @@session.character_set_client;
SET @session_character_set_results = @@session.character_set_results;
SET @@global.character_set_connection = utf8;
connect (con1,localhost,root,,,,);
connection con1;
SELECT @@global.character_set_connection;
SELECT @@session.character_set_connection;
disconnect con1;
--echo '#--------------------FN_DYNVARS_011_02-------------------------#'
###############################################################
# Begin the functionality Testing of character_set_connection #
###############################################################
connection default;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
#==============================================================================
--echo '--verify that character_set_connection converts character_set_client--'
#==============================================================================
SET @@session.character_set_client = utf8;
SET @@session.character_set_results = utf8;
SET @@session.character_set_connection = latin1;
SELECT 'ЁЂЃЄ' AS utf_text;
SET @@session.character_set_connection = utf8;
SELECT 'ЁЂЃЄ' AS utf_text;
#==============================================================================
--echo '---now inserting utf8 string with different character_set_connection--'
#==============================================================================
SET @@session.character_set_connection = ascii;
INSERT INTO t1 VALUES('ЁЂЃЄ');
SELECT * FROM t1;
TRUNCATE TABLE t1;
#==============================================================================
--echo '--now client & results charset in latin1 & connection charset in ascii-'
#==============================================================================
SET @@session.character_set_connection = ascii;
SET @@session.character_set_client = latin1;
SET @@session.character_set_results = latin1;
INSERT INTO t1 VALUES('ЁЂЃЄ');
SELECT * FROM t1;
TRUNCATE TABLE t1;
#==============================================================================
# set names should set character sets [client,connection,results]
#==============================================================================
SET NAMES utf8;
INSERT INTO t1 VALUES('ЁЂЃЄ');
SELECT * FROM t1;
TRUNCATE TABLE t1;
# Cleanup
SET @@global.character_set_connection = @global_character_set_connection;
SET @@session.character_set_connection = @session_character_set_connection;
SET @@session.character_set_client = @session_character_set_client;
SET @@session.character_set_results = @session_character_set_results;
DROP TABLE t1;
#############################################################
# End of functionality Testing for character_set_connection #
#############################################################
|