403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/mysql/mysql-test/suite/sys_vars/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/mysql/mysql-test/suite/sys_vars/t/max_sort_length_func.test
############# mysql-test\t\max_sort_length_func.test ###########################
#                                                                              #
# Variable Name: sql_warnings                                                  #
# Scope: SESSION                                                               #
# Access Type: Dynamic                                                         #
# Data Type: NUMERIC                                                           #
# Default Value: 1024                                                          #
# Values:      4-8388608                                                       #
#                                                                              #
#                                                                              #
# Creation Date: 2008-03-02                                                    #
# Author:  Sharique Abdullah                                                   #
#                                                                              #
# Description: Test Cases of Dynamic System Variable max_sort_length           #
#              that checks behavior of this variable in the following ways     #
#              * Functionality based on different values                       #
#                                                                              #
# Reference:                                                                   #
#   http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html        #
#                                                                              #
################################################################################

#
# Setup
#

SET @start_value= @@global.max_sort_length;

#########################
#   Creating new table  #
#########################

--echo ** creating tables **
CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, c BLOB);
CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY, c TEXT);

--echo '#--------------------FN_DYNVARS_098_01-------------------------#'
##########################################################
#    Test behavior of variable on new connection # 01    #
##########################################################

connect (test_con1,localhost,root,,);

# Setting global value of variable and inserting data in table
--echo ** Setting value to 70 and inserting data **
SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
INSERT INTO t set c = repeat('x',69);
INSERT INTO t set c = concat(repeat('x',68),'r','x');
INSERT INTO t set c = concat(repeat('x',68),'s','y');
INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **

# Setting session value of variable and inserting data in table
SET @@session.max_sort_length = 69;
SELECT @@session.max_sort_length;
INSERT INTO t set c = repeat('x',69);
INSERT INTO t set c = concat(repeat('x',68),'r','x');
INSERT INTO t set c = concat(repeat('x',68),'s','y');
INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **

--echo '#--------------------FN_DYNVARS_098_02-------------------------#'
##########################################################
#    Test behavior of variable on new connection # 02    #
##########################################################

connect (test_con2,localhost,root,,);

## Setting global value of variable and inserting data in table
SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
INSERT INTO t set c = repeat('x',69);
INSERT INTO t set c = concat(repeat('x',68),'r','x');
INSERT INTO t set c = concat(repeat('x',68),'s','y');
INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;

--echo ** Results should be sorted **

# Setting session value of variable and inserting data in table
SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
INSERT INTO t set c = repeat('x',69);
INSERT INTO t set c = concat(repeat('x',68),'r','x');
INSERT INTO t set c = concat(repeat('x',68),'s','y');
INSERT INTO t set c = concat(repeat('x',68),'g','w');
SELECT c from t ORDER BY c, id;

--echo ** Results should not be sorted **

--echo '#--------------------FN_DYNVARS_098_03-------------------------#'
#########################################################
#Check if sorting is applied with the max_sort_length=64#
#########################################################

###########################################
#   Setting new value for max_sort_length #
###########################################

SET max_sort_length=64;

###################################
#   Inserting values in  table t  #
###################################

INSERT INTO t set c = repeat('x',69);
INSERT INTO t set c = concat(repeat('x',68),'r','x');
INSERT INTO t set c = concat(repeat('x',68),'s','y');
INSERT INTO t set c = concat(repeat('x',68),'g','w');

SELECT c from t ORDER BY c, id;
--echo ** Results should not be sorted **

RESET QUERY CACHE;

--echo '#--------------------FN_DYNVARS_098_04-------------------------#'
#########################################################
#Check if sorting is applied with the max_sort_length=69#
#########################################################

SET max_sort_length=69;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **

--echo '#--------------------FN_DYNVARS_098_05-------------------------#'
#########################################################
#Check if sorting is applied with the max_sort_length=70#
#########################################################

SET max_sort_length=70;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **

--echo '#--------------------FN_DYNVARS_098_06-------------------------#'
##############################################################
#Check if sorting is applied with the max_sort_length=Default#
##############################################################

SET max_sort_length=default;
SELECT @@max_sort_length;
SELECT c from t ORDER BY c, id;
--echo ** Results should be sorted **

--echo '#--------------------FN_DYNVARS_098_07-------------------------#'
###########################################
#Check if sorting is applied on BLOB type #
###########################################
--echo Testing type BLOB
# Setting global value of variable and inserting data in table
SET @@max_sort_length = 70;
SELECT @@max_sort_length;
INSERT INTO t1 set c = repeat('x',69);
INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
SELECT c from t1 ORDER BY c, id DESC;
--echo ** Results should be sorted **

# Setting session value of variable and inserting data in table
SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
INSERT INTO t1 set c = repeat('x',69);
INSERT INTO t1 set c = concat(repeat('x',68),'r','x');
INSERT INTO t1 set c = concat(repeat('x',68),'s','y');
INSERT INTO t1 set c = concat(repeat('x',68),'g','w');
SELECT c from t1 ORDER BY c, id;
--echo ** Results should not be sorted **

--echo '#--------------------FN_DYNVARS_098_08-------------------------#'
###########################################
#Check if sorting is applied on CHAR type #
###########################################
--echo Testing type CHAR
# Setting global value of variable and inserting data in table
SET @@global.max_sort_length = 70;
SELECT @@global.max_sort_length;
INSERT INTO t2 set c = repeat('x',69);
INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
--echo ** Results should not be sorted **

# Setting session value of variable and inserting data in table
SET @@session.max_sort_length = 64;
SELECT @@session.max_sort_length;
INSERT INTO t2 set c = repeat('x',69);
INSERT INTO t2 set c = concat(repeat('x',68),'r','x');
INSERT INTO t2 set c = concat(repeat('x',68),'s','y');
INSERT INTO t2 set c = concat(repeat('x',68),'g','w');
SELECT c from t2 ORDER BY c, id;
--echo ** Results should not be sorted **

#
# Cleanup
#

connection default;

disconnect test_con1;
disconnect test_con2;

DROP TABLE t, t1, t2;

SET @@global.max_sort_length= @start_value;

Youez - 2016 - github.com/yon3zu
LinuXploit