mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
b00c536378
BitKeeper/etc/ignore: Added mysql-test/linux_sys_vars.inc mysql-test/load_sysvars.inc mysql-test/windows_sys_vars.inc to the ignore list
209 lines
9.6 KiB
Text
209 lines
9.6 KiB
Text
############## mysql-test\t\div_precision_increment_basic.test #################
|
|
# #
|
|
# Variable Name: div_precision_increment #
|
|
# Scope: GLOBAL & SESSION #
|
|
# Access Type: Dynamic #
|
|
# Data Type: Numeric #
|
|
# Default Value: 4 #
|
|
# Range: 0 - 30 #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-02-07 #
|
|
# Author: Salman Rawala #
|
|
# #
|
|
# Description: Test Cases of Dynamic System Variable "div_precision_increment" #
|
|
# that checks behavior of this variable in the following ways #
|
|
# * Default Value #
|
|
# * Valid & Invalid values #
|
|
# * Scope & Access method #
|
|
# * Data Integrity . #
|
|
# #
|
|
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
|
|
# server-system-variables.html#option_mysqld_div_precision_increment #
|
|
# #
|
|
################################################################################
|
|
|
|
--source include/load_sysvars.inc
|
|
|
|
#######################################################################
|
|
# START OF div_precision_increment TESTS #
|
|
#######################################################################
|
|
|
|
|
|
#############################################################
|
|
# Save initial value #
|
|
#############################################################
|
|
|
|
SET @start_global_value = @@global.div_precision_increment;
|
|
SELECT @start_global_value;
|
|
SET @start_session_value = @@session.div_precision_increment;
|
|
SELECT @start_session_value;
|
|
|
|
--echo '#--------------------FN_DYNVARS_027_01-------------------------#'
|
|
#######################################################################
|
|
# Display the DEFAULT value of div_precision_increment #
|
|
#######################################################################
|
|
|
|
SET @@global.div_precision_increment = 100;
|
|
SET @@global.div_precision_increment = DEFAULT;
|
|
SELECT @@global.div_precision_increment;
|
|
|
|
SET @@session.div_precision_increment = 200;
|
|
SET @@session.div_precision_increment = DEFAULT;
|
|
SELECT @@session.div_precision_increment;
|
|
|
|
--echo '#--------------------FN_DYNVARS_027_02-------------------------#'
|
|
#######################################################################
|
|
# Check the DEFAULT value of div_precision_increment #
|
|
#######################################################################
|
|
|
|
SET @@global.div_precision_increment = @start_global_value;
|
|
SELECT @@global.div_precision_increment = 4;
|
|
|
|
SET @@session.div_precision_increment = @start_session_value;
|
|
SELECT @@session.div_precision_increment = 4;
|
|
|
|
--echo '#--------------------FN_DYNVARS_027_03-------------------------#'
|
|
#################################################################################
|
|
# Change the value of div_precision_increment to a valid value for GLOBAL Scope #
|
|
#################################################################################
|
|
|
|
SET @@global.div_precision_increment = 1;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = 0;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = 10;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = 30;
|
|
SELECT @@global.div_precision_increment;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_027_04-------------------------#'
|
|
##################################################################################
|
|
# Change the value of div_precision_increment to a valid value for SESSION Scope #
|
|
##################################################################################
|
|
|
|
SET @@session.div_precision_increment = 1;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = 0;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = 7;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = 30;
|
|
SELECT @@session.div_precision_increment;
|
|
|
|
|
|
--echo '#------------------FN_DYNVARS_027_05-----------------------#'
|
|
###################################################################
|
|
# Change the value of div_precision_increment to an invalid value #
|
|
###################################################################
|
|
|
|
SET @@global.div_precision_increment = 31;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = 40;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = -1024;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = 65536;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@session.div_precision_increment = 40;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = 31;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = -2;
|
|
SELECT @@session.div_precision_increment;
|
|
SET @@session.div_precision_increment = 65550;
|
|
SELECT @@session.div_precision_increment;
|
|
echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
|
|
|
|
--Error ER_WRONG_TYPE_FOR_VAR
|
|
SET @@global.div_precision_increment = 65530.30;
|
|
SELECT @@global.div_precision_increment;
|
|
--Error ER_WRONG_TYPE_FOR_VAR
|
|
SET @@global.div_precision_increment = OFF;
|
|
SELECT @@global.div_precision_increment;
|
|
--Error ER_WRONG_TYPE_FOR_VAR
|
|
SET @@session.div_precision_increment = ON;
|
|
SELECT @@session.div_precision_increment;
|
|
--Error ER_WRONG_TYPE_FOR_VAR
|
|
SET @@session.div_precision_increment = 65530.30;
|
|
SELECT @@session.div_precision_increment;
|
|
|
|
|
|
--echo '#------------------FN_DYNVARS_027_06-----------------------#'
|
|
####################################################################
|
|
# Check if the value in GLOBAL Table matches value in variable #
|
|
####################################################################
|
|
|
|
SELECT @@global.div_precision_increment = VARIABLE_VALUE
|
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
|
WHERE VARIABLE_NAME='div_precision_increment';
|
|
|
|
--echo '#------------------FN_DYNVARS_027_07-----------------------#'
|
|
####################################################################
|
|
# Check if the value in SESSION Table matches value in variable #
|
|
####################################################################
|
|
|
|
SELECT @@session.div_precision_increment = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='div_precision_increment';
|
|
|
|
|
|
# FN_DYNVARS_027_07 - Check if TRUE and FALSE values can be used on variable
|
|
SET @@global.div_precision_increment = TRUE;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@global.div_precision_increment = FALSE;
|
|
SELECT @@global.div_precision_increment;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_027_08----------------------#'
|
|
####################################################################################
|
|
# Check if accessing variable with and without GLOBAL point to same variable #
|
|
####################################################################################
|
|
|
|
SET @@global.div_precision_increment = 0;
|
|
SELECT @@div_precision_increment = @@global.div_precision_increment;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_027_09----------------------#'
|
|
########################################################################################################
|
|
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
|
|
########################################################################################################
|
|
|
|
SET @@div_precision_increment = 1;
|
|
SELECT @@div_precision_increment = @@local.div_precision_increment;
|
|
SELECT @@local.div_precision_increment = @@session.div_precision_increment;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_027_10----------------------#'
|
|
##################################################################################
|
|
# Check if div_precision_increment can be accessed with and without @@ sign #
|
|
##################################################################################
|
|
|
|
SET div_precision_increment = 1;
|
|
SELECT @@div_precision_increment;
|
|
--Error ER_PARSE_ERROR
|
|
SET local.div_precision_increment = 1;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT local.div_precision_increment;
|
|
--Error ER_PARSE_ERROR
|
|
SET session.div_precision_increment = 1;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT session.div_precision_increment;
|
|
--Error ER_BAD_FIELD_ERROR
|
|
SELECT div_precision_increment = @@session.div_precision_increment;
|
|
|
|
|
|
|
|
####################################
|
|
# Restore initial value #
|
|
####################################
|
|
|
|
SET @@global.div_precision_increment = @start_global_value;
|
|
SELECT @@global.div_precision_increment;
|
|
SET @@session.div_precision_increment = @start_session_value;
|
|
SELECT @@session.div_precision_increment;
|
|
|
|
|
|
#######################################################
|
|
# END OF div_precision_increment TESTS #
|
|
#######################################################
|
|
|