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 --echo ** Connecting con_int1 using root **
74 connect (con_int1,localhost,root,,);
75
76 --echo ** Connection con_int1 **
77 connection con_int1;
78 SELECT @@SESSION.sql_log_off;
79 --echo 0 / FALSE Expected
80
81 SET SESSION sql_log_off = FALSE;
82 --echo ** Connecting con_int2 using root **
83 connect (con_int2,localhost,root,,);
84
85 --echo ** Connection con_int2 **
86 connection con_int2;
87 SELECT @@SESSION.sql_log_off;
88 --echo 0 / FALSE Expected
89
90 SET SESSION sql_log_off = TRUE;
91
92 --echo ** Connection con_int2 **
93 connection con_int2;
94 SELECT @@SESSION.sql_log_off;
95 --echo 1 / TRUE Expected
96
97 --echo ** Connection con_int1 **
98 connection con_int1;
99 SELECT @@SESSION.sql_log_off;
100 --echo 0 / FALSE Expected
101
102 --echo ** Connection default **
103 connection default;
104 --echo Disconnecting Connections con_int1, con_int2
105 disconnect con_int1;
106 disconnect con_int2;
107
108
109 #
110 # Cleanup
111 #
112
113 SET SESSION sql_log_off = @default_sql_log_off;
114
115 DROP TABLE t1;