1--source include/have_statement_timeout.inc
2
3--echo # Displaying default value
4
5SELECT COUNT(@@GLOBAL.have_statement_timeout);
6--echo 1 Expected
7
8--echo # Check if Value can set
9
10--error ER_INCORRECT_GLOBAL_LOCAL_VAR
11SET @@GLOBAL.have_statement_timeout=1;
12--echo Expected error 'Read only variable'
13
14SELECT COUNT(@@GLOBAL.have_statement_timeout);
15--echo 1 Expected
16
17--echo # Check if the value in GLOBAL Table matches value in variable
18
19--disable_warnings
20SELECT @@GLOBAL.have_statement_timeout = VARIABLE_VALUE
21FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
22WHERE VARIABLE_NAME='have_statement_timeout';
23--enable_warnings
24--echo 1 Expected
25
26SELECT COUNT(@@GLOBAL.have_statement_timeout);
27--echo 1 Expected
28
29--disable_warnings
30SELECT COUNT(VARIABLE_VALUE)
31FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
32WHERE VARIABLE_NAME='have_statement_timeout';
33--enable_warnings
34--echo 1 Expected
35
36--echo # Check if accessing variable with and without GLOBAL point to same variable
37
38SELECT @@have_statement_timeout = @@GLOBAL.have_statement_timeout;
39--echo 1 Expected
40
41--echo # Check if have_statement_timeout can be accessed with and without @@ sign
42
43SELECT COUNT(@@have_statement_timeout);
44--echo 1 Expected
45
46--error ER_INCORRECT_GLOBAL_LOCAL_VAR
47SELECT COUNT(@@local.have_statement_timeout);
48--echo Expected error 'Variable is a GLOBAL variable'
49
50--error ER_INCORRECT_GLOBAL_LOCAL_VAR
51SELECT COUNT(@@SESSION.have_statement_timeout);
52--echo Expected error 'Variable is a GLOBAL variable'
53
54SELECT COUNT(@@GLOBAL.have_statement_timeout);
55--echo 1 Expected
56
57--error ER_BAD_FIELD_ERROR
58SELECT have_statement_timeout = @@SESSION.have_statement_timeout;
59--echo Expected error 'Readonly variable'
60