Debian Codegraph @

mysql-test/suite/sys_vars/inc/scenarios_for_readonly_sysvar.inc

raw
1 # ==== Purpose ====
2 #
3 # Verify that a readonly variable has the expected default value and
4 # cannot be set to other values.
5 #
6 # ==== Requirements ====
7 #
8 # R1. The initial value should be equal to the expected default value.
9 #
10 # R2. A specified set of valid values should all result in an error
11 # when trying to set them. The value shall be unchagned.
12 #
13 # R3. Setting the value to DEFAULT shall fail for the variable.
14 #
15 # ==== Usage ====
16 #
17 # --let $scope = {session|global}
18 # --let $name = NAME
19 # [--let $alias = NAME]
20 # --let $default = VALUE
21 # --let $values = JSON_ARRAY
22 # --source scenarios_for_readonly_sysvar.inc
23 #
24 # Parameters:
25 #
26 # $scope
27 # The scope to test.
28 #
29 # All other parameters
30 # See json_sysvar_spec.inc
31
32
33 --echo ==== Testing SET @@$scope.$name [read-only] ====
34
35 --echo # Initial value is default
36
37 --let $expect_value = $default
38 --source assertions_for_sysvar_and_alias_value.inc
39
40 --echo # Valid values for *read-only* variable cannot be set
41 # Iterate over values, set the variable, and verify that it worked.
42 --let $json_array = $values
43 --source $json_value_start
44 while (!$json_value_done) {
45 if ($mask_value) {
46 --replace_result $json_value_value VALUE
47 }
48 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
49 eval SET @@$scope.$name = $json_value_value;
50
51 --let $expect_value = $default
52 --source assertions_for_sysvar_and_alias_value.inc
53
54 --source $json_value_next
55 }
56
57 --echo # Setting default value for variable
58 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
59 eval SET @@$scope.$name = DEFAULT;
60
61 --let $expect_value = $default
62 --source assertions_for_sysvar_and_alias_value.inc