mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	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
		
			
				
	
	
		
			185 lines
		
	
	
		
			7.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			185 lines
		
	
	
		
			7.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
############## mysql-test\t\sql_buffer_result_basic.test ######################
 | 
						||
#                                                                             #
 | 
						||
# Variable Name: sql_buffer_result                                            #
 | 
						||
# Scope: SESSION                                                              #
 | 
						||
# Access Type: Dynamic                                                        #
 | 
						||
# Data Type: boolean                                                          #
 | 
						||
# Default Value:                                                              #
 | 
						||
# Valid Values : 0,1                                                          #
 | 
						||
#                                                                             #
 | 
						||
#                                                                             #
 | 
						||
# Creation Date: 2008-02-07                                                   #
 | 
						||
# Author:  Rizwan                                                             #
 | 
						||
#                                                                             #
 | 
						||
# Description: Test Cases of Dynamic System Variable sql_buffer_result        #
 | 
						||
#              that checks the 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                                               #
 | 
						||
#                                                                             #
 | 
						||
###############################################################################
 | 
						||
 | 
						||
--source include/load_sysvars.inc
 | 
						||
 | 
						||
######################################################################## 
 | 
						||
#                    START OF sql_buffer_result TESTS                  #
 | 
						||
######################################################################## 
 | 
						||
 | 
						||
 | 
						||
################################################################################ 
 | 
						||
#      Saving initial value of sql_buffer_result in a temporary variable       #
 | 
						||
################################################################################ 
 | 
						||
 | 
						||
SET @session_start_value = @@session.sql_buffer_result;
 | 
						||
SELECT @session_start_value;
 | 
						||
 | 
						||
--echo '#--------------------FN_DYNVARS_155_01------------------------#'
 | 
						||
######################################################################## 
 | 
						||
#           Display the DEFAULT value of sql_buffer_result             #
 | 
						||
######################################################################## 
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = 0;
 | 
						||
SET @@session.sql_buffer_result = DEFAULT;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = 1;
 | 
						||
SET @@session.sql_buffer_result = DEFAULT;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
 | 
						||
--echo '#---------------------FN_DYNVARS_155_02-------------------------#'
 | 
						||
############################################################################# 
 | 
						||
#   Check if sql_buffer_result can be accessed with and without @@ sign     #
 | 
						||
############################################################################# 
 | 
						||
 | 
						||
SET sql_buffer_result = 1;
 | 
						||
SELECT @@sql_buffer_result;
 | 
						||
 | 
						||
--Error ER_UNKNOWN_TABLE
 | 
						||
SELECT session.sql_buffer_result;
 | 
						||
 | 
						||
--Error ER_UNKNOWN_TABLE
 | 
						||
SELECT local.sql_buffer_result;
 | 
						||
 | 
						||
SET session sql_buffer_result = 0;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
 | 
						||
--echo '#--------------------FN_DYNVARS_155_03------------------------#'
 | 
						||
######################################################################## 
 | 
						||
#      change the value of sql_buffer_result to a valid value          #
 | 
						||
######################################################################## 
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = 0;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
SET @@session.sql_buffer_result = 1;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
 | 
						||
--echo '#--------------------FN_DYNVARS_155_04-------------------------#'
 | 
						||
########################################################################### 
 | 
						||
#       Change the value of sql_buffer_result to invalid value            #
 | 
						||
########################################################################### 
 | 
						||
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = -1;
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = 2;
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = "TRU";
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = 0.4;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = 1.4;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
--echo 'Bug: Decimal values are accepted and rounded to an integer before';
 | 
						||
--echo 'assingment.';
 | 
						||
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = TR<54>E;
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = <20>N;
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = OF;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.'
 | 
						||
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = <20>FF;
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = '<27>';
 | 
						||
--Error ER_WRONG_VALUE_FOR_VAR
 | 
						||
SET @@session.sql_buffer_result = NO;
 | 
						||
 | 
						||
 | 
						||
--echo '#-------------------FN_DYNVARS_155_05----------------------------#'
 | 
						||
########################################################################### 
 | 
						||
#       Test if accessing global sql_buffer_result gives error            #
 | 
						||
########################################################################### 
 | 
						||
 | 
						||
--Error ER_LOCAL_VARIABLE
 | 
						||
SET @@global.sql_buffer_result = 0;
 | 
						||
 | 
						||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
 | 
						||
SELECT @@global.sql_buffer_result;
 | 
						||
 | 
						||
--echo '#----------------------FN_DYNVARS_155_06------------------------#'
 | 
						||
######################################################################### 
 | 
						||
#     Check if the value in GLOBAL Table contains variable value        #
 | 
						||
#########################################################################
 | 
						||
 | 
						||
SELECT count(VARIABLE_VALUE) 
 | 
						||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 | 
						||
WHERE VARIABLE_NAME='sql_buffer_result';
 | 
						||
 | 
						||
--echo '#----------------------FN_DYNVARS_155_07------------------------#'
 | 
						||
######################################################################### 
 | 
						||
#     Check if the value in GLOBAL Table matches value in variable      #
 | 
						||
#########################################################################
 | 
						||
 | 
						||
SELECT @@session.sql_buffer_result = VARIABLE_VALUE 
 | 
						||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 | 
						||
WHERE VARIABLE_NAME='sql_buffer_result';
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
SELECT VARIABLE_VALUE 
 | 
						||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 | 
						||
WHERE VARIABLE_NAME='sql_buffer_result';
 | 
						||
 | 
						||
--echo '#---------------------FN_DYNVARS_155_08-------------------------#'
 | 
						||
################################################################### 
 | 
						||
#        Check if ON and OFF values can be used on variable       #
 | 
						||
################################################################### 
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = OFF;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
SET @@session.sql_buffer_result = ON;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
--echo '#---------------------FN_DYNVARS_155_09----------------------#'
 | 
						||
################################################################### 
 | 
						||
#      Check if TRUE and FALSE values can be used on variable     #
 | 
						||
################################################################### 
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = TRUE;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
SET @@session.sql_buffer_result = FALSE;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
##############################  
 | 
						||
#   Restore initial value    #
 | 
						||
##############################
 | 
						||
 | 
						||
SET @@session.sql_buffer_result = @session_start_value;
 | 
						||
SELECT @@session.sql_buffer_result;
 | 
						||
 | 
						||
###############################################################
 | 
						||
#                    END OF sql_buffer_result TESTS           #
 | 
						||
############################################################### 
 |