Debian Codegraph @

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

raw
1 ############# mysql-test\t\sql_log_off_func.test ##########################
2 # #
3 # Variable Name: sql_log_off #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: BOOLEAN #
7 # Default Value: 0 FALSE #
8 # Values: 1 TRUE, 0 FALSE #
9 # #
10 # #
11 # Creation Date: 2008-02-25 #
12 # Author: Sharique Abdullah #
13 # #
14 # Description: Test Cases of Dynamic System Variable "sql_log_off" #
15 # that checks behavior of this variable in the following ways#
16 # * Functionality based on different values #
17 # #
18 # Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html #
19 # #
20 ###########################################################################
21
22 --echo ** Setup **
23 --echo
24 #
25 # Setup
26 #
27
28 SET @default_sql_log_off = @@sql_log_off;
29
30 #
31 # Create tables
32 #
33
34 CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
35
36 INSERT INTO t1 VALUES('aa1','bb');
37 INSERT INTO t1 VALUES('aa2','bb');
38 INSERT INTO t1 VALUES('aa3','bb');
39 INSERT INTO t1 VALUES('aa4','bb');
40 INSERT INTO t1 VALUES('aa5','bb');
41
42 --echo '#--------------------FN_DYNVARS_158_01-------------------------#'
43 #
44 # Value ON
45 #
46
47 SET SESSION sql_log_off = ON;
48
49 UPDATE t1 SET a = 'aa1-updated' WHERE a = 'aa1';
50
51 --echo Checking if log contains the executed statement
52 SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1-updated\' WHERE a = \'aa1\'';
53
54 --echo '#--------------------FN_DYNVARS_158_02-------------------------#'
55 #
56 # Value OFF
57 #
58
59 SET SESSION sql_log_off = OFF;
60
61 # With ps-protocol the UPDATE is executed twice
62 --disable_ps_protocol
63 UPDATE t1 SET a = 'aa1' WHERE a = 'aa1-updated';
64 --enable_ps_protocol
65
66 --echo Checking if log contains the executed statement
67 SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1\' WHERE a = \'aa1-updated\'';
68
69 --echo '#--------------------FN_DYNVARS_158_03--------------------------#'
70 #
71 # Session data integrity check
72 #
73 connect (con_int1,localhost,root,,);
74
75 connection con_int1;
76 SELECT @@SESSION.sql_log_off;
77 --echo 0 / FALSE Expected
78
79 SET SESSION sql_log_off = FALSE;
80 connect (con_int2,localhost,root,,);
81
82 connection con_int2;
83 SELECT @@SESSION.sql_log_off;
84 --echo 0 / FALSE Expected
85
86 SET SESSION sql_log_off = TRUE;
87
88 connection con_int2;
89 SELECT @@SESSION.sql_log_off;
90 --echo 1 / TRUE Expected
91
92 connection con_int1;
93 SELECT @@SESSION.sql_log_off;
94 --echo 0 / FALSE Expected
95
96 connection default;
97 disconnect con_int1;
98 disconnect con_int2;
99
100
101 #
102 # Cleanup
103 #
104
105 SET SESSION sql_log_off = @default_sql_log_off;
106
107 DROP TABLE t1;