mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
220d9b8c4a
To-number conversion warnings work differenly with CHAR and VARCHAR sp variables. The original revision-IDs are: staale.smedseng@sun.com-20081124095339-2qdvzkp0rn1ljs30 staale.smedseng@sun.com-20081125104611-rtxic5d12e83ag2o The patch provides ER_TRUNCATED_WRONG_VALUE warning messages for conversion of VARCHAR to numberic values, in line with messages provided for CHAR conversions. Conversions are checked for success, and the message is emitted in case failure. The tests are amended to accept the added warning messages, and explicit conversion of ON/OFF values is added for statements checking system variables. In test rpl.rpl_switch_stm_row_mixed checking for warnings is temporarily disabled for one statement, as this generates warning messages for strings that vary between executions. sql/field.cc: The pushing of the truncation warning is now done in a separate static function, and used in various places.
169 lines
7 KiB
Text
169 lines
7 KiB
Text
######################## mysql-test\t\general_log_basic.test ###################
|
|
# #
|
|
# Variable Name: general_log #
|
|
# Scope: GLOBAL #
|
|
# Access Type: Dynamic #
|
|
# Data Type: BOOLEAN #
|
|
# Default Value: OFF #
|
|
# Valid Values: ON, OFF #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-03-14 #
|
|
# Author: Salman Rawala #
|
|
# #
|
|
# Description: Test Cases of Dynamic System Variable "general_log" #
|
|
# 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-options.html#option_mysqld_event-scheduler #
|
|
# #
|
|
################################################################################
|
|
|
|
|
|
###########################################################
|
|
# START OF general_log TESTS #
|
|
###########################################################
|
|
|
|
|
|
###################################################################
|
|
# Saving initial value of general_log in a temporary variable #
|
|
###################################################################
|
|
|
|
SET @start_value = @@global.general_log;
|
|
SELECT @start_value;
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
|
|
###############################################
|
|
# Verify default value of variable #
|
|
###############################################
|
|
|
|
SET @@global.general_log = DEFAULT;
|
|
SELECT @@global.general_log = 0;
|
|
|
|
|
|
--echo '#--------------------FN_DYNVARS_004_02------------------------#'
|
|
#######################################################################
|
|
# Change the value of general_log to a valid value #
|
|
#######################################################################
|
|
|
|
SET @@global.general_log = ON;
|
|
SELECT @@global.general_log;
|
|
SET @@global.general_log = OFF;
|
|
SELECT @@global.general_log;
|
|
|
|
--echo '#--------------------FN_DYNVARS_004_03-------------------------#'
|
|
#######################################################################
|
|
# Change the value of general_log to invalid value #
|
|
#######################################################################
|
|
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = 2;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = -1;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = TRUEF;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = TRUE_F;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = FALSE0;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = OON;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = ONN;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = OOFF;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = 0FF;
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = ' ';
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = " ";
|
|
--Error ER_WRONG_VALUE_FOR_VAR
|
|
SET @@global.general_log = '';
|
|
|
|
|
|
--echo '#-------------------FN_DYNVARS_004_04----------------------------#'
|
|
###################################################################
|
|
# Test if accessing session general_log gives error #
|
|
###################################################################
|
|
|
|
--Error ER_GLOBAL_VARIABLE
|
|
SET @@session.general_log = OFF;
|
|
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
|
SELECT @@session.general_log;
|
|
|
|
|
|
--echo '#----------------------FN_DYNVARS_004_05------------------------#'
|
|
##############################################################################
|
|
# Check if the value in GLOBAL Tables matches values in variable #
|
|
##############################################################################
|
|
|
|
SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE
|
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
|
WHERE VARIABLE_NAME='general_log';
|
|
|
|
|
|
--echo '#---------------------FN_DYNVARS_004_06----------------------#'
|
|
###################################################################
|
|
# Check if 0 and 1 values can be used on variable #
|
|
###################################################################
|
|
|
|
SET @@global.general_log = 0;
|
|
SELECT @@global.general_log;
|
|
SET @@global.general_log = 1;
|
|
SELECT @@global.general_log;
|
|
|
|
--echo '#---------------------FN_DYNVARS_004_07----------------------#'
|
|
###################################################################
|
|
# Check if TRUE and FALSE values can be used on variable #
|
|
###################################################################
|
|
|
|
SET @@global.general_log = TRUE;
|
|
SELECT @@global.general_log;
|
|
SET @@global.general_log = FALSE;
|
|
SELECT @@global.general_log;
|
|
|
|
--echo '#---------------------FN_DYNVARS_004_08----------------------#'
|
|
##############################################################################
|
|
# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
|
|
# to same session variable #
|
|
##############################################################################
|
|
|
|
SET @@global.general_log = ON;
|
|
SELECT @@general_log = @@global.general_log;
|
|
|
|
--echo '#---------------------FN_DYNVARS_004_09----------------------#'
|
|
#######################################################################
|
|
# Check if general_log can be accessed with and without @@ sign #
|
|
#######################################################################
|
|
--Error ER_GLOBAL_VARIABLE
|
|
SET general_log = ON;
|
|
--Error ER_PARSE_ERROR
|
|
SET local.general_log = OFF;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT local.general_log;
|
|
--Error ER_PARSE_ERROR
|
|
SET global.general_log = ON;
|
|
--Error ER_UNKNOWN_TABLE
|
|
SELECT global.general_log;
|
|
--Error ER_BAD_FIELD_ERROR
|
|
SELECT general_log = @@session.general_log;
|
|
|
|
|
|
|
|
##############################
|
|
# Restore initial value #
|
|
##############################
|
|
|
|
SET @@global.general_log = @start_value;
|
|
SELECT @@global.general_log;
|
|
|
|
|
|
#####################################################
|
|
# END OF general_log TESTS #
|
|
#####################################################
|