403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.70.208.150
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/sys_vars/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test
############# mysql-test\t\max_prepared_stmt_count_fn.test #####################
#                                                                              #
# Variable Name: max_prepared_stmt_count						                      #
# Scope: SESSION                                                               #
# Access Type: Dynamic                                                         #
# Data Type: NUMERIC                                                           #
# Default Value: 16382                                                         #
# Values:       0-1048576                                                      #
#                                                                              #
#                                                                              #
# Creation Date: 2008-03-02                                                    #
# Author:  Sharique Abdullah                                                       #
#                                                                              #
# Description: Test Cases of Dynamic System Variable "max_prepared_stmt_count" #
#              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#
#  option_mysqld_max_prepared_stmt_count                                       #
#                                                                              #
################################################################################


--echo ** Setup **
--echo
#
# Setup
#

SET @global_max_prepared_stmt_count = @@global.max_prepared_stmt_count;


--echo '#---------------------FN_DYNVARS_031_01----------------------#'
#################################################################################
#  Check if prepared stmt Can be created more then max_prepared_stmt_count value#
#################################################################################

SET GLOBAL max_prepared_stmt_count=2;
--echo ** Prepare statements **
#preparing stmts
PREPARE stmt  from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";
--echo Expected error "Max prepared statements count reached"

SHOW STATUS like 'Prepared_stmt_count';
--echo 2 Expected


--echo '#---------------------FN_DYNVARS_031_02----------------------#'
################################################################################
# Check if prepared stmt Can be created more then max_prepared_stmt_count value
################################################################################

SET GLOBAL max_prepared_stmt_count=0;

--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
PREPARE stmt3  from "SELECT * FROM information_schema.CHARACTER_SETS C";
--echo Expected error "Max prepared statements count reached"

SHOW STATUS like 'Prepared_stmt_count';
--echo 2 Expected

--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
PREPARE stmt  from "SELECT * FROM information_schema.CHARACTER_SETS C";
--echo Expected error "Max prepared statements count reached"

SHOW STATUS like 'Prepared_stmt_count';
--echo 2 Expected
--echo 'Bug#35389 A pre existing valid prepared statement DROPS if a PREPARE'
--echo 'STATEMENT command is issued with the same name that'
--echo 'causes ER_MAX_PREPARED_STMT_COUNT_REACHED error'


--echo '#---------------------FN_DYNVARS_031_03----------------------#'
##############################################################################
# check the status of prepared_max stmt after setting max_prepared_stmt_count 
##############################################################################


SHOW STATUS like 'Prepared_stmt_count';
SET GLOBAL max_prepared_stmt_count=4;
PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt3 from "SELECT * FROM information_schema.CHARACTER_SETS C";
--echo ** Value of prepared stmt'
SHOW STATUS LIKE 'Prepared_stmt_count';
--echo 4 Expected


--echo '#---------------------FN_DYNVARS_031_04----------------------#'
######################################################################
# Setting value lower then number of prepared stmt                   #
######################################################################

--echo ** preparing stmts **
#preparing stmts

PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C";

--echo ** setting value **
SET GLOBAL max_prepared_stmt_count=3;
--echo ** Check wether any more statements can be  prepared **

--Error ER_MAX_PREPARED_STMT_COUNT_REACHED
PREPARE stmt5 from "SELECT * FROM information_schema.CHARACTER_SETS C";
--echo Expected error "Max prepared statements count reached"

SHOW STATUS LIKE 'Prepared_stmt_count';
--echo 4 Expected


--echo '#---------------------FN_DYNVARS_031_05----------------------#'
###########################################################################
# Checking in stored procedure#
###########################################################################

SET GLOBAL max_prepared_stmt_count=3;

--echo ** Creating procedure **
# create procedure to add rows
DROP PROCEDURE  IF EXISTS  sp_checkstmts;

DELIMITER //;

CREATE PROCEDURE sp_checkstmts ()
BEGIN
PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
END //

DELIMITER ;//

-- Error ER_MAX_PREPARED_STMT_COUNT_REACHED
CALL sp_checkstmts();
--echo Expected error "Max prepared statements count reached"

#
# Cleanup
#

DROP PREPARE stmt;
DROP PREPARE stmt1;
DROP PREPARE stmt2;
DROP PREPARE stmt3;

DROP PROCEDURE sp_checkstmts;

SET @@global.max_prepared_stmt_count = @global_max_prepared_stmt_count;

Youez - 2016 - github.com/yon3zu
LinuXploit