Debian Codegraph @

mysql-test/suite/sys_vars/t/log_output_func.test

raw
1 ################# mysql-test\t\log_output_func.test ##########################
2 # #
3 # Variable Name: log_output #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: enumeration #
7 # Default Value: TABLE #
8 # Range: TABLE, FILE, NONE #
9 # #
10 # #
11 # Creation Date: 2008-03-08 #
12 # Author: Rizwan #
13 # Modified: HHunger 2008-08-29
14 # #
15 # Description: Test Cases of Dynamic System Variable log_output #
16 # that checks the behavior of this variable #
17 # #
18 # Reference: #
19 # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
20 # #
21 ###############################################################################
22
23 # The access to mysql.general_log delivers different result depending on
24 # ps-protocol. So, it is switched off.
25 --disable_ps_protocol
26
27 SET @start_value= @@global.log_output;
28 SET @start_general_log= @@global.general_log;
29 #SET @start_general_log_file= @@global.general_log_file;
30 LET $start_general_log_file= `SELECT @@global.general_log_file`;
31
32 --echo '#--------------------FN_DYNVARS_065_01-------------------------#'
33 ##################################################################
34 # Check if setting log_output is changed in every new connection #
35 ##################################################################
36
37 SET @@global.log_output = 'NONE';
38 # con1 will be default connection from now on
39 connect (con1,localhost,root,,,,);
40 SET @@global.log_output = 'TABLE,FILE';
41
42 # Test that the effect is global
43 connect (con2,localhost,root,,,,);
44 SELECT @@global.log_output;
45
46 --echo '#--------------------FN_DYNVARS_065_02-------------------------#'
47 ####################################################
48 # Begin the functionality Testing of log_output #
49 ####################################################
50
51 connection con1;
52
53 #===============================================================
54 --echo '---Checking general_log when log_output is NONE---'
55 #===============================================================
56
57 SET @@global.log_output = 'NONE';
58 TRUNCATE TABLE mysql.general_log;
59
60 --disable_warnings
61 DROP TABLE IF EXISTS t1;
62 --enable_warnings
63 CREATE TABLE t1(a INT);
64 INSERT INTO t1 VALUE(1);
65 SELECT 'abc';
66 SELECT count(*) FROM mysql.general_log;
67
68 #===============================================================
69 --echo '---Checking general_log when log_output is TABLE---'
70 #===============================================================
71
72 SET @@global.log_output = 'TABLE';
73 TRUNCATE TABLE mysql.general_log;
74
75 --disable_warnings
76 DROP TABLE IF EXISTS t1;
77 --enable_warnings
78 CREATE TABLE t1(a int);
79 INSERT INTO t1 VALUE(1);
80 SELECT 'abc';
81 # At least the last 4 statement should be logged.
82 SELECT count(*)>4 FROM mysql.general_log;
83
84 #===============================================================
85 # Checking general_log when log_output is FILE
86 #===============================================================
87
88 SET @@global.general_log = 'OFF';
89 FLUSH LOGS;
90 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
91 eval SET @@global.general_log_file = '$MYSQLTEST_VARDIR/run/mytest.log';
92 SET @@global.general_log = 'ON';
93 SET @@global.log_output = 'FILE';
94 TRUNCATE TABLE mysql.general_log;
95 --disable_warnings
96 DROP TABLE IF EXISTS t1;
97 --enable_warnings
98 CREATE TABLE t1(a INT);
99 INSERT INTO t1 VALUE(1);
100 SELECT 'abc';
101 SELECT count(*) FROM mysql.general_log;
102
103 DROP TABLE t1;
104
105 file_exists $MYSQLTEST_VARDIR/run/mytest.log ;
106
107 #==============================================================
108 # Clean up
109 #==============================================================
110
111 connection default;
112 SET @@global.general_log= 'OFF';
113 #SET @@global.general_log_file= @start_general_log_file;
114 --replace_result $start_general_log_file start_general_log_file
115 eval SET @@global.general_log_file= '$start_general_log_file';
116 SET @@global.log_output= @start_value;
117 SET @@global.general_log= @start_general_log;
118 SET @@global.general_log= 'ON';
119
120 --enable_ps_protocol
121 ####################################################
122 # End of functionality Testing for log_output #
123 ####################################################