

################## mysql-test\t\innodb_lock_wait_timeout_basic.test ###########
#                                                                             #
# Variable Name: innodb_lock_wait_timeout                                     #
# Scope: Global , Session                                                     #
# Access Type: Dynamic                                                        #
# Data Type: numeric                                                          #
#                                                                             #
#                                                                             #
# Creation Date: 2008-02-07                                                   #
# Author : Sharique Abdullah                                                  #
#                                                                             #
#                                                                             #
# Description:Test Cases of Dynamic System Variable innodb_lock_wait_timeout  #
#             that checks the behavior of this variable in the following ways #
#              * Value Check                                                  #
#              * Scope Check                                                  #
#                                                                             #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
#  server-system-variables.html                                               #
#                                                                             #
###############################################################################

--source include/have_innodb.inc

SET @start_global_value=@@global.innodb_lock_wait_timeout;
SELECT @start_global_value;

--echo '#---------------------BS_STVARS_032_01----------------------#'
####################################################################
#   Displaying default value                                       #
####################################################################
SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
--echo 1 Expected


--echo '#---------------------BS_STVARS_032_02----------------------#'
####################################################################
#   Check if Value can set                                         #
####################################################################

SET global innodb_lock_wait_timeout=60;
SELECT @@global.innodb_lock_wait_timeout;
SET session innodb_lock_wait_timeout=60;
SELECT @@session.innodb_lock_wait_timeout;

--echo '#---------------------BS_STVARS_032_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable  #
#################################################################

SELECT @@GLOBAL.innodb_lock_wait_timeout = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_lock_wait_timeout';
--echo 1 Expected

SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
--echo 1 Expected

SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
WHERE VARIABLE_NAME='innodb_lock_wait_timeout';
--echo 1 Expected



--echo '#---------------------BS_STVARS_032_04----------------------#'
################################################################################
#  Check if accessing variable with and without GLOBAL point to same variable  #
################################################################################
SELECT @@innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout;
--echo 1 Expected



--echo '#---------------------BS_STVARS_032_05----------------------#'
################################################################################
#   Check if innodb_lock_wait_timeout can be accessed with and without @@ sign #
################################################################################

SELECT COUNT(@@innodb_lock_wait_timeout);
--echo 1 Expected

SELECT COUNT(@@local.innodb_lock_wait_timeout);

SELECT COUNT(@@SESSION.innodb_lock_wait_timeout);

SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
--echo 1 Expected

--Error ER_BAD_FIELD_ERROR
SELECT innodb_lock_wait_timeout = @@SESSION.innodb_lock_wait_timeout;

#
# Cleanup
#

SET @@global.innodb_lock_wait_timeout = @start_global_value;
SELECT @@global.innodb_lock_wait_timeout;
