Debian Codegraph @

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

raw
1 ############# mysql-test\t\sql_buffer_result_func.test #####################
2 # #
3 # Variable Name: sql_buffer_result #
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_buffer_result" #
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 @original_sql_buffer_result = @@sql_buffer_result;
29
30 #
31 # Create tables
32 #
33
34 CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20));
35
36 INSERT INTO t1 VALUES('aa','bb');
37 INSERT INTO t1 VALUES('aa','bb');
38 INSERT INTO t1 VALUES('aa','bb');
39 INSERT INTO t1 VALUES('aa','bb');
40 INSERT INTO t1 VALUES('aa','bb');
41
42 --echo '#--------------------FN_DYNVARS_156_01-------------------------#'
43 #
44 # TRUE mode
45 #
46
47 SET SESSION sql_buffer_result = 1;
48
49 --disable_ps_protocol
50 SHOW STATUS LIKE 'Created_tmp_tables';
51 --enable_ps_protocol
52 --echo Expected value : 0.
53
54 --disable_cursor_protocol
55 --disable_ps2_protocol
56 SELECT * FROM t1;
57 --enable_ps2_protocol
58 --enable_cursor_protocol
59
60 --disable_ps_protocol
61 SHOW STATUS LIKE 'Created_tmp_tables';
62 --enable_ps_protocol
63 --echo Expected value : 1.
64
65 --disable_cursor_protocol
66 --disable_ps2_protocol
67 SELECT * FROM t1;
68 --enable_ps2_protocol
69 --enable_cursor_protocol
70
71 --disable_ps_protocol
72 SHOW STATUS LIKE 'Created_tmp_tables';
73 --enable_ps_protocol
74 --echo Expected value : 2.
75
76 --echo '#--------------------FN_DYNVARS_156_02-------------------------#'
77 #
78 # FALSE mode
79 #
80
81 SET SESSION sql_buffer_result = 0;
82
83 --disable_ps_protocol
84 SHOW STATUS LIKE 'Created_tmp_tables';
85 --enable_ps_protocol
86 --echo Expected value : 2.
87
88 --disable_cursor_protocol
89 SELECT * FROM t1;
90 --enable_cursor_protocol
91
92 --disable_ps_protocol
93 SHOW STATUS LIKE 'Created_tmp_tables';
94 --enable_ps_protocol
95 --echo Expected value : 2.
96
97 --echo '#--------------------FN_DYNVARS_156_03-------------------------#'
98 #
99 # Session data integrity check
100 #
101 connect (con_int1,localhost,root,,);
102
103 connection con_int1;
104
105 SELECT @@SESSION.sql_buffer_result;
106 --echo 0 / FALSE Expected
107
108 SET SESSION sql_buffer_result = FALSE;
109
110 connect (con_int2,localhost,root,,);
111
112 connection con_int2;
113
114 SELECT @@SESSION.sql_buffer_result;
115 --echo 0 / FALSE Expected
116
117 SET SESSION sql_buffer_result = TRUE;
118
119 connection con_int1;
120
121 SELECT @@SESSION.sql_buffer_result;
122 --echo 0 / FALSE Expected
123
124 connection con_int2;
125
126 SELECT @@SESSION.sql_buffer_result;
127 --echo 1 / TRUE Expected
128
129 connection default;
130
131 disconnect con_int1;
132 disconnect con_int2;
133
134
135 #
136 # Cleanup
137 #
138 --echo ** Cleanup **
139
140 SET @@sql_buffer_result = @original_sql_buffer_result;
141
142 DROP TABLE t1;