| 1 |
|
| 2 |
|
| 3 |
################## mysql-test\t\error_count_basic.test ######################## |
| 4 |
# # |
| 5 |
# Variable Name: error_count # |
| 6 |
# Scope: Session # |
| 7 |
# Access Type: Static # |
| 8 |
# Data Type: numeric # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author : Sharique Abdullah # |
| 13 |
# # |
| 14 |
# # |
| 15 |
# Description:Test Cases of Dynamic System Variable error_count # |
| 16 |
# that checks the behavior of this variable in the following ways # |
| 17 |
# * Value Check # |
| 18 |
# * Scope Check # |
| 19 |
# # |
| 20 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # |
| 21 |
# server-system-variables.html # |
| 22 |
# # |
| 23 |
############################################################################### |
| 24 |
|
| 25 |
--echo '#---------------------BS_STVARS_005_01----------------------#' |
| 26 |
#################################################################### |
| 27 |
# Displaying default value # |
| 28 |
#################################################################### |
| 29 |
|
| 30 |
SELECT COUNT(@@SESSION.error_count); |
| 31 |
--echo 1 Expected |
| 32 |
|
| 33 |
--echo '#---------------------BS_STVARS_005_02----------------------#' |
| 34 |
#################################################################### |
| 35 |
# Check if Value can set # |
| 36 |
#################################################################### |
| 37 |
|
| 38 |
|
| 39 |
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 40 |
SET @@SESSION.error_count=1; |
| 41 |
--echo Expected error 'Read only variable' |
| 42 |
|
| 43 |
SELECT COUNT(@@SESSION.error_count); |
| 44 |
--echo 1 Expected |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
--echo '#---------------------BS_STVARS_005_03----------------------#' |
| 50 |
################################################################# |
| 51 |
# Check if the value in SESSION Table matches value in variable # |
| 52 |
################################################################# |
| 53 |
|
| 54 |
SELECT @@SESSION.error_count = VARIABLE_VALUE |
| 55 |
FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
| 56 |
WHERE VARIABLE_NAME='error_count'; |
| 57 |
--echo 1 Expected |
| 58 |
|
| 59 |
SELECT COUNT(@@SESSION.error_count); |
| 60 |
--echo 1 Expected |
| 61 |
|
| 62 |
SELECT COUNT(VARIABLE_VALUE) |
| 63 |
FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
| 64 |
WHERE VARIABLE_NAME='error_count'; |
| 65 |
--echo 1 Expected |
| 66 |
|
| 67 |
|
| 68 |
--echo '#---------------------BS_STVARS_005_04----------------------#' |
| 69 |
################################################################################ |
| 70 |
# Check if accessing variable with and without SESSION point to same variable # |
| 71 |
################################################################################ |
| 72 |
SELECT @@error_count = @@SESSION.error_count; |
| 73 |
--echo 1 Expected |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
--echo '#---------------------BS_STVARS_005_05----------------------#' |
| 78 |
################################################################################ |
| 79 |
# Check if error_count can be accessed with and without @@ sign # |
| 80 |
################################################################################ |
| 81 |
|
| 82 |
SELECT COUNT(@@error_count); |
| 83 |
--echo 1 Expected |
| 84 |
SELECT COUNT(@@local.error_count); |
| 85 |
--echo 1 Expected |
| 86 |
SELECT COUNT(@@SESSION.error_count); |
| 87 |
--echo 1 Expected |
| 88 |
|
| 89 |
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 90 |
SELECT COUNT(@@GLOBAL.error_count); |
| 91 |
--echo Expected error 'Variable is a SESSION variable' |
| 92 |
|
| 93 |
--error ER_BAD_FIELD_ERROR |
| 94 |
SELECT COUNT(error_count = @@GLOBAL.error_count); |
| 95 |
--echo Expected error 'Readonly variable' |
| 96 |
|
| 97 |
|