| 1 |
|
| 2 |
--echo # |
| 3 |
--echo # Variable name : session_track_system_variables |
| 4 |
--echo # Scope : Global & Session |
| 5 |
--echo # |
| 6 |
|
| 7 |
--echo # Global - default |
| 8 |
SELECT @@global.session_track_system_variables; |
| 9 |
--echo # Session - default |
| 10 |
SELECT @@session.session_track_system_variables; |
| 11 |
--echo |
| 12 |
|
| 13 |
--echo # via performance_schema.global_variables |
| 14 |
--disable_warnings |
| 15 |
SELECT * FROM performance_schema.global_variables WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; |
| 16 |
--enable_warnings |
| 17 |
|
| 18 |
--echo # via performance_schema.session_variables |
| 19 |
--disable_warnings |
| 20 |
SELECT * FROM performance_schema.session_variables WHERE VARIABLE_NAME LIKE 'session_track%' ORDER BY VARIABLE_NAME; |
| 21 |
--enable_warnings |
| 22 |
|
| 23 |
# Save the global value to be used to restore the original value. |
| 24 |
SET @global_saved_tmp = @@global.session_track_system_variables; |
| 25 |
--echo |
| 26 |
|
| 27 |
--echo # Altering global variable's value |
| 28 |
SET @@global.session_track_system_variables='autocommit'; |
| 29 |
SELECT @@global.session_track_system_variables; |
| 30 |
SELECT @@session.session_track_system_variables; |
| 31 |
--echo |
| 32 |
|
| 33 |
--echo # Altering session variable's value |
| 34 |
SET @@session.session_track_system_variables='autocommit'; |
| 35 |
SELECT @@global.session_track_system_variables; |
| 36 |
SELECT @@session.session_track_system_variables; |
| 37 |
--echo |
| 38 |
|
| 39 |
--echo # Variables' values in a new session. |
| 40 |
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 41 |
|
| 42 |
--echo # Global - expect "autocommit" |
| 43 |
SELECT @@global.session_track_system_variables; |
| 44 |
--echo |
| 45 |
--echo # Session - expect "autocommit" |
| 46 |
SELECT @@session.session_track_system_variables; |
| 47 |
--echo |
| 48 |
|
| 49 |
--echo # Switching to the default connection. |
| 50 |
connection default; |
| 51 |
|
| 52 |
SELECT @@global.session_track_system_variables; |
| 53 |
SELECT @@session.session_track_system_variables; |
| 54 |
--echo |
| 55 |
|
| 56 |
--echo # Test if DEFAULT is working as expected. |
| 57 |
SET @@global.session_track_system_variables = DEFAULT; |
| 58 |
SET @@session.session_track_system_variables = DEFAULT; |
| 59 |
--echo |
| 60 |
|
| 61 |
SELECT @@global.session_track_system_variables; |
| 62 |
SELECT @@session.session_track_system_variables; |
| 63 |
--echo |
| 64 |
|
| 65 |
--echo # Variables' values in a new session (con2). |
| 66 |
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 67 |
|
| 68 |
SELECT @@global.session_track_system_variables; |
| 69 |
SELECT @@session.session_track_system_variables; |
| 70 |
--echo |
| 71 |
|
| 72 |
--echo # Altering session should not affect global. |
| 73 |
SET @@session.session_track_system_variables = 'sql_mode'; |
| 74 |
SELECT @@global.session_track_system_variables; |
| 75 |
SELECT @@session.session_track_system_variables; |
| 76 |
--echo |
| 77 |
|
| 78 |
--echo # Variables' values in a new session (con3). |
| 79 |
connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 80 |
|
| 81 |
--echo # Altering global should not affect session. |
| 82 |
SET @@global.session_track_system_variables = 'sql_mode'; |
| 83 |
SELECT @@global.session_track_system_variables; |
| 84 |
SELECT @@session.session_track_system_variables; |
| 85 |
--echo |
| 86 |
|
| 87 |
--echo # Switching to the default connection. |
| 88 |
connection default; |
| 89 |
|
| 90 |
--echo # Testing NULL |
| 91 |
SET @@global.session_track_system_variables = NULL; |
| 92 |
SET @@session.session_track_system_variables = NULL; |
| 93 |
|
| 94 |
--echo # Global - expect NULL |
| 95 |
SELECT @@global.session_track_system_variables; |
| 96 |
--echo # Session - expect NULL |
| 97 |
SELECT @@session.session_track_system_variables; |
| 98 |
|
| 99 |
|
| 100 |
--echo # testing with duplicate entries (must fail). |
| 101 |
# Lets first set it to some valid value. |
| 102 |
SET @@global.session_track_system_variables= "time_zone"; |
| 103 |
SET @@session.session_track_system_variables= "time_zone"; |
| 104 |
# Now set with duplicate entries (must fail). |
| 105 |
--error ER_DUP_LIST_ENTRY |
| 106 |
SET @@global.session_track_system_variables= "sql_mode,sql_mode"; |
| 107 |
--error ER_DUP_LIST_ENTRY |
| 108 |
SET @@session.session_track_system_variables= "sql_mode,sql_mode"; |
| 109 |
--echo # Global - must remain unchanged, 'time_zone' |
| 110 |
SELECT @@global.session_track_system_variables; |
| 111 |
--echo # Session - must remain unchanged, 'time_zone' |
| 112 |
SELECT @@session.session_track_system_variables; |
| 113 |
--echo |
| 114 |
|
| 115 |
--echo # Restoring the original values. |
| 116 |
SET @@global.session_track_system_variables = @global_saved_tmp; |
| 117 |
|
| 118 |
--echo # End of tests. |