From 3a98b7831826418d656f8dc4d8f9ca2592e51c36 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 11 Nov 2004 20:12:12 +0100 Subject: [PATCH 01/20] Result of WL#2225 Extend the test cases for PS + develop a basic test routine for PS The basic test routine mysql-test/include/patchwork-check.inc Test cases for the the basic test routine mysql-test/t/tool_test.test mysql-test/r/tool_test.result Test cases for prepared statements with functions mysql-test/t/ps_12func.test mysql-test/r/ps_12func.result Some statements are set to comment, because of open bugs. Fresh MySQL V4.1 and V5.0 souces produce in the moment (~11-Nov-2004) the same result files. --- mysql-test/include/patchwork-check.inc | 330 ++ mysql-test/r/ps_12func.result | 4748 ++++++++++++++++++++++++ mysql-test/r/tool_test.result | 223 ++ mysql-test/t/ps_12func.test | 867 +++++ mysql-test/t/tool_test.test | 105 + 5 files changed, 6273 insertions(+) create mode 100644 mysql-test/include/patchwork-check.inc create mode 100644 mysql-test/r/ps_12func.result create mode 100644 mysql-test/r/tool_test.result create mode 100644 mysql-test/t/ps_12func.test create mode 100644 mysql-test/t/tool_test.test diff --git a/mysql-test/include/patchwork-check.inc b/mysql-test/include/patchwork-check.inc new file mode 100644 index 00000000000..b11db7fa50d --- /dev/null +++ b/mysql-test/include/patchwork-check.inc @@ -0,0 +1,330 @@ +###################### patchwork-check.inc ############################# +# # +# Basic routine for the generation and execution of prepared and non # +# prepared SQL statements. # +# # +# Purpose: Simplify the check of complex statements with different # +# sets of parameters (data type, value) # +# # +######################################################################## + +# +# NOTE: PLEASE BE VERY CAREFULL, WHEN CHANGING OR USING ;-) THIS ROUTINE. +# +# Please be aware, that this routine +# - will be sourced by several test case files stored within the +# directory 'mysql-test/t'. So every change here will affect +# several test cases. +# - does not check its own prequisites +# - modifies the content and the data type of the +# uservariables @var_1 ... @var_ +# +# Please preserve the '___' naming of the the auxiliary variables. +# These names should avoid that a test case writer accidently creates a +# variable with the same name. +# + +# naming conventions: +# stmt_c_ --> statement with constants like "select 1 " +# stmt_uv_ --> statement with uservariables like "select @var_1 " +# stmt_ph_ --> prepared statement with placeholders like "select ? " + + +# +# Explanation how to use this routine by an example: +# +# Content of the caller script: +# .... +# set @stmt_part1= 'SELECT f1 + ' +# set @stmt_part2= ' from t1 where f2= ' ; +# set @stmt_part3= '' ; +# set @string_1= "1"; set @type_1= "BIGINT"; +# set @string_2= "-2.3E-4"; set @type_2= "DOUBLE"; +# set @max_var_number= 2; +# --source include/patchwork-check.inc +# +# # The next testing rounds could start with +# set @string_1= "NULL"; set @type_1= "BIGINT"; +# set @string_2= "-2.3E-4"; set @type_2= "DOUBLE"; +# --source include/patchwork-check.inc +# +# set @string_1= "1"; set @type_1= "BIGINT"; +# set @string_2= "NULL"; set @type_2= "LONGTEXT"; +# --source include/patchwork-check.inc +# +# Statements and uservariables to be produced and executed by this routine +# 1. Statements with constants +# 1.1 stmt1= SELECT f1 + 1 from t1 where f2= -2.3E-4 ; +# 1.2 stmt1 as prepared statement +# 2. Statements with uservariables +# @var_n should be of data type @type_n (if possible) and have the +# content @string_n . +# 2.1 stmt2= SELECT f1 + @var_1 from t1 where f2= @var_2 +# 2.2 stmt2 as prepared statement +# 3. prepared statement with placeholders +# prepare stmt1 from 'SELECT f1 + ? from t1 where f2= ?' +# execute stmt1 using @var_1, @var_2 +# +# Every prepared statement variant of the "patchwork" is 3 times executed. +# +# +# Please have also also a look into +# - t/tooltest.test , which checks or +# - t/ps_12func.test , which contains test cases using +# this routine. +# + + +############## +# +# Prerequisites: +# +# The caller script must set the following uservariables: +# +# The statement pieces: @stmt_part1, @stmt_part2, ... , @stmt_part +# +# The parameter values: @string_1, ... , @string_ +# The parameter value should fit to the data type ! +# UPPER(@stmt_part1) = 'NULL' will cause (SQL) NULL as content. +# +# The parameter data types: @type_1, ... , @type_ +# valid types are: BIGINT, DOUBLE, LONGTEXT, LONGBLOB +# +# Attention: All other type assignments will lead to a +# uservariable of type LONGTEXT !! +# +# The number of parameter values must be published via +# set @max_var_number= ; +# +# Attention: This routine does not perform any check of the content +# of these variables. +# + +############## +# +# How is intended uservariable generated: +# +# Step 1: generate a uservariable of the intended type +# +# UPPER(@type_) statement +# BIGINT set @var_= 0 +# DOUBLE' set @var_idx_= 0.0 +# LONGTEXT' set @var_= "INIT" +# LONGBLOB' set @var_= CAST("INIT" AS BINARY) +# set @var_= "INIT" +# +# Step 2: assign the value to the uservariable +# +# IF ( UPPER(@string_) != 'NULL') +# UPPER(@type_) +# BIGINT set @var_= CEIL(@string_) +# DOUBLE set @var_= @string_ + 0.0 +# LONGTEXT set @var_= @string_ +# LONGBLOB set @var_= CAST(@string_ AS BINARY) +# set @var_= @string_ +# ELSE +# set @var_= NULL +# + + +# +# How to debug this routine if something goes wrong: +# +# 1. Put the line '--disable_abort_on_error' into the caller script +# --> There will be no abort of mysqltest, if a statement fails. +# You will get a protocol (in most cases). +# 2. Put the line 'set $__debug_= 1 ;' into the caller script . +# The next call of patchwork-check.inc will print +# the type and content of generated uservariables and statements. +# 3. disable the '--disable_query_log' option some lines below +# +# and please be patient towards this routine, it is far away from being perfect. +# + + +# Suppress the majority of the huge output concerning the statement and +# uservariable generation +--disable_query_log + +let $__idx_= 1 ; +eval set @__stmt_c_= @stmt_part_$__idx_ ; +# If the number of variables is greater 0, we need also +# - the statement with uservariables (stmt_uv) and +# - the prepared statement with placeholders (stmt_ph) and +# - the execute for the prepared statement with placeholders (execute_stmt_ph) +let $__with_var_= `select @max_var_number > 0`; +while ($__with_var_) +{ + eval set @__stmt_uv_= @stmt_part_$__idx_ ; + eval set @__stmt_ph_= @stmt_part_$__idx_ ; + set @__execute_stmt_ph= 'execute __stmt_ph_ using ' ; + let $__num_= `select @max_var_number`; + while ($__num_) + { + ##### Generate the Uservariables + eval set @__my_init_= CASE UPPER(@type_$__idx_) + WHEN 'BIGINT' THEN 'set @var_$__idx_= 0' + WHEN 'DOUBLE' THEN 'set @var_$__idx_= 0.0' + WHEN 'LONGTEXT' THEN 'set @var_$__idx_= "INIT"' + WHEN 'LONGBLOB' THEN 'set @var_$__idx_= CAST("INIT" AS BINARY)' + ELSE 'set @var_$__idx_= "INIT"' END; + # select @__my_init_ as "@__my_init_ is: " ; + let $__my_init_= `select @__my_init_`; + eval $__my_init_ ; + + eval set @__my_init_= CASE UPPER(@type_$__idx_) + WHEN 'BIGINT' THEN + "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',CEIL(@string_$__idx_),NULL)" + WHEN 'DOUBLE' THEN + "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_ + 0.0,NULL)" + WHEN 'LONGTEXT' THEN + "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_,NULL)" + WHEN 'LONGBLOB' THEN + "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',CAST(@string_$__idx_ AS BINARY),NULL)" + ELSE + "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_,NULL)" END; + let $__my_init_= `select @__my_init_`; + eval $__my_init_ ; + + ##### concat the variable to the statements + ## with Constants + # 1. replace ugly NULLs like 'NuLl' with 'NULL' for better readability + # 2. Strings to be inserted into the statement must be quoted + eval set @__stmt_c_= concat( + @__stmt_c_, + IF(UPPER(@string_$__idx_)='NULL','NULL', + IF(UPPER(@type_$__idx_)='LONGTEXT' or UPPER(@type_$__idx_)='LONGBLOB', + concat('''',@string_$__idx_,''''), @string_$__idx_ + ))) ; + ## with Uservariables + eval set @__stmt_uv_= concat(@__stmt_uv_, '@var_$__idx_') ; + ## with placeholders + eval set @__stmt_ph_= concat(@__stmt_ph_, '?') ; + + ##### complete the execute for the prepared statement with placeholders + eval set @__execute_stmt_ph= concat(@__execute_stmt_ph, '@var_$__idx_,') ; + + inc $__idx_ ; + ##### concat the next part of the statement to the statements + eval set @__stmt_c_= concat(@__stmt_c_, @stmt_part_$__idx_ ); + eval set @__stmt_uv_= concat(@__stmt_uv_, @stmt_part_$__idx_ ); + eval set @__stmt_ph_= concat(@__stmt_ph_, @stmt_part_$__idx_ ); + + dec $__num_ ; + } + # @__execute_stmt_ph contains a trailing ',' which must be cut away + set @__execute_stmt_ph= substr(@__execute_stmt_ph,1,length(@__execute_stmt_ph) - 1); + dec $__with_var_ ; +} + +while ($__debug_) +{ + ### Print debug informations for patchwork with variables + let $__with_var_= `select @max_var_number > 0`; + while ($__with_var_) + { + ### Print out the content of the statement variables + eval select "--------------------------------------" + as "the content of the statement variables" + union select concat('@__stmt_c_ is: ',@__stmt_c_) + union select concat('@__stmt_uv_ is: ',@__stmt_uv_) + union select concat('@__stmt_ph_ is: ',@__stmt_ph_) + union select concat('@__execute_stmt_ph is: ',@__execute_stmt_ph); + + + ### Print out the content of the uservariables + select '--------------------------------------' + as "the content of the parameter variables"; + set @__parameter_= 'select '; + let $__num_= `select @max_var_number`; + let $__idx_= 1 ; + while ($__num_) + { + eval select @type_$__idx_ as type, + @string_$__idx_ as string, + @var_$__idx_ as uservariable ; + eval set @__parameter_= concat(@__parameter_, '@var_$__idx_ ,'); + inc $__idx_ ; + + dec $__num_ ; + } + # @__parameter_ contains a trailing ',' which must be cut away + set @__parameter_= substr(@__parameter_,1,length(@__parameter_) - 1); + let $__aux_= `select @__parameter_` ; + eval $__aux_ ; + + + ### Create a table from the uservariables and print out the column types + let $__aux_= `select concat('CREATE TABLE t9 AS ',@__parameter_)` ; + --disable_warnings + drop table if exists t9; + --enable_warnings + eval $__aux_ ; + show create table t9; + drop table t9; + + dec $__with_var_ ; + } + ### Print debug informations for patchwork without variables + ### stmt_uv, stmt_ph, execute_stmt_ph and uservariables do NOT exist + let $__with_var_= `select @max_var_number = 0`; + while ($__with_var_) + { + ### Print out the content of the statement variables + eval select "--------------------------------------" + as "the content of the statement variable" + union select concat('@__stmt_c_ is: ',@__stmt_c_) ; + + dec $__with_var_ ; + } + + + dec $__debug_ ; +} + +## copy the statements and the execute into $variables +# (__stmt_ph_ is not needed) +## + generate the prepared statements +--enable_query_log +let $__stmt_c_= `select @__stmt_c_`; +eval prepare __stmt_c_ from @__stmt_c_ ; +let $__with_var_= `select @max_var_number > 0`; +while ($__with_var_) +{ + let $__stmt_uv_= `select @__stmt_uv_`; + eval prepare __stmt_uv_ from @__stmt_uv_ ; + let $__execute_ph= `select @__execute_stmt_ph`; + eval prepare __stmt_ph_ from @__stmt_ph_ ; + dec $__with_var_ ; +} + + +##### The execution of all statements +## statement with Constants +eval $__stmt_c_ ; +## prepared statement with Constants +execute __stmt_c_ ; +# Try to detect if the prior executes damaged the parse tree by +# two additional executes . +execute __stmt_c_ ; +execute __stmt_c_ ; +let $__with_var_= `select @max_var_number > 0`; +while ($__with_var_) +{ + ## statement with Uservariables + eval $__stmt_uv_ ; + ## prepared statement with Uservariables + execute __stmt_uv_ ; + # Try to detect if the prior executes damaged the parse tree by + # two additional executes . + execute __stmt_uv_ ; + execute __stmt_uv_ ; + ## prepared statement with placeholders + eval $__execute_ph ; + # Try to detect if the prior executes damaged the parse tree by + # two additional executes . + eval $__execute_ph ; + eval $__execute_ph ; + + dec $__with_var_ ; +} diff --git a/mysql-test/r/ps_12func.result b/mysql-test/r/ps_12func.result new file mode 100644 index 00000000000..881d5392edd --- /dev/null +++ b/mysql-test/r/ps_12func.result @@ -0,0 +1,4748 @@ +use test; + +###### Variations on ROUND(X,D) ###### + +set @stmt_part_1= 'select ROUND(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ') as my_col' ; +set @max_var_number= 2; +set @string_1= '11.298' ; +set @type_1= 'DOUBLE' ; +set @type_2= 'BIGINT' ; +set @string_2= '1' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,1) as my_col ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +set @string_2= '3' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,3) as my_col ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +set @string_2= '4' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,4) as my_col ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +set @string_2= '0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,0) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +set @string_2= '-1' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-1) as my_col ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +set @string_2= '-2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-2) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +set @string_2= '-3' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-3) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'DOUBLE' ; +set @string_2= '1.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,1.0) as my_col ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +set @string_2= '3.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,3.0) as my_col ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +execute __stmt_c_ ; +my_col +11.298 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_uv_ ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.298 +set @string_2= '4.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,4.0) as my_col ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +execute __stmt_c_ ; +my_col +11.2980 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_uv_ ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.2980 +set @string_2= '0.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,0.0) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11 +set @string_2= '-1.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-1.0) as my_col ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +10 +set @string_2= '-2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-2.0) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +set @string_2= '-3.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,-3.0) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +0 +set @string_2= '1.1' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,1.1) as my_col ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +execute __stmt_c_ ; +my_col +11.3 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.3 +set @string_2= '1.9' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,1.9) as my_col ; +my_col +11.30 +execute __stmt_c_ ; +my_col +11.30 +execute __stmt_c_ ; +my_col +11.30 +execute __stmt_c_ ; +my_col +11.30 +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_uv_ ; +my_col +11.3 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.30 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.30 +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +11.30 +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.298,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_1= 'NULL' ; +set @type_1= 'DOUBLE' ; +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= '-2.0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,-2.0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ,@var_2) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2 ; +my_col +NULL +set @stmt_part_1= 'select ROUND(' ; +set @stmt_part_2= ') as my_col' ; +set @max_var_number= 1; +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select ROUND(@var_1 ) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +set @string_1= '-11' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(-11) as my_col ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +select ROUND(@var_1 ) as my_col ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +set @string_1= '0' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(0) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +set @string_1= '11.49' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(11.49) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select ROUND(@var_1 ) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +set @string_1= '10.51' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(10.51) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select ROUND(@var_1 ) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +execute __stmt_ph_ using @var_1 ; +my_col +11 +set @string_1= '0.0' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(0.0) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select ROUND(@var_1 ) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +set @string_1= 'NULL' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select ROUND(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +set @string_1= '-11.49' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(-11.49) as my_col ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +select ROUND(@var_1 ) as my_col ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +set @string_1= '-10.51' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select ROUND(-10.51) as my_col ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +execute __stmt_c_ ; +my_col +-11 +select ROUND(@var_1 ) as my_col ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_uv_ ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +execute __stmt_ph_ using @var_1 ; +my_col +-11 +set @stmt_part_2= 'select ROUND() as my_col' ; +set @max_var_number= 0; +prepare __stmt_c_ from @__stmt_c_ ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +select ROUND( ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +execute __stmt_c_ ; +ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE +execute __stmt_c_ ; +ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE +execute __stmt_c_ ; +ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE + +###### Variations on CONCAT_WS(separator,str1,str2,...) ###### + +set @stmt_part_1= 'select CONCAT_WS(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ') as my_col' ; +set @max_var_number= 3; +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S','My','QL') as my_col ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS(NULL,'My','QL') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS(NULL,'My','QL') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS(NULL,'My','QL') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'NULL' ; +set @type_2= 'LONGBLOB' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S',NULL,'QL') as my_col ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +set @type_2= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S',NULL,'QL') as my_col ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +set @type_2= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S',NULL,'QL') as my_col ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +execute __stmt_c_ ; +my_col +QL +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_uv_ ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +QL +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'NULL' ; +set @type_3= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S','My',NULL) as my_col ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S','My',NULL) as my_col ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +set @type_3= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S','My',NULL) as my_col ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +execute __stmt_c_ ; +my_col +My +select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_uv_ ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +My +set @stmt_part_1= "select CONCAT_WS('S',IF(" ; +set @stmt_part_2= ' IS NULL, ' ; +set @stmt_part_3= ' , ' ; +set @stmt_part_4= "),'QL') as my_col" ; +set @max_var_number= 3; +set @string_1= 'My' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'X' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'My' ; +set @type_3= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONCAT_WS('S',IF('My' IS NULL, 'X' , 'My'),'QL') as my_col ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +select CONCAT_WS('S',IF(@var_1 IS NULL, @var_2 , @var_3),'QL') as my_col ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +MySQL +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= 'X' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'My' ; +set @type_3= 'LONGTEXT' ; + +###### Variations on CHAR(N,...) ###### + +set @stmt_part_1= 'select CHAR(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ',' ; +set @stmt_part_6= ') as my_col' ; +set @max_var_number= 5; +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CHAR(77,121,83,81,76) as my_col ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +execute __stmt_c_ ; +my_col +MySQL +select CHAR(@var_1 ,@var_2,@var_3,@var_4,@var_5) as my_col ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_uv_ ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; +my_col +MySQL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; +my_col +MySQL +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +set @string_4= 'NULL' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= 'NULL' ; +set @type_5= 'BIGINT' ; +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; + +###### Variations on CHAR_LENGTH ###### + +set @stmt_part_1= 'select CHAR_LENGTH(' ; +set @stmt_part_2= ') as my_col' ; +set @max_var_number= 1; +set @string_1= 'MySQL' ; +set @type_1= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CHAR_LENGTH('MySQL') as my_col ; +my_col +5 +execute __stmt_c_ ; +my_col +5 +execute __stmt_c_ ; +my_col +5 +execute __stmt_c_ ; +my_col +5 +select CHAR_LENGTH(@var_1 ) as my_col ; +my_col +5 +execute __stmt_uv_ ; +my_col +5 +execute __stmt_uv_ ; +my_col +5 +execute __stmt_uv_ ; +my_col +5 +execute __stmt_ph_ using @var_1 ; +my_col +5 +execute __stmt_ph_ using @var_1 ; +my_col +5 +execute __stmt_ph_ using @var_1 ; +my_col +5 +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CHAR_LENGTH(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CHAR_LENGTH(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CHAR_LENGTH(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CHAR_LENGTH(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CHAR_LENGTH(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CHAR_LENGTH(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL + +###### Variations on FIELD(str,str1,str2,str3,...) ###### + +set @stmt_part_1= 'select FIELD(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ') as my_col' ; +set @max_var_number= 4; +set @string_1= 'Hit' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '1it' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'Hit' ; +set @type_3= 'LONGTEXT' ; +set @string_4= '3it' ; +set @type_4= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select FIELD('Hit','1it','Hit','3it') as my_col ; +my_col +2 +execute __stmt_c_ ; +my_col +2 +execute __stmt_c_ ; +my_col +2 +execute __stmt_c_ ; +my_col +2 +select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +2 +execute __stmt_uv_ ; +my_col +2 +execute __stmt_uv_ ; +my_col +2 +execute __stmt_uv_ ; +my_col +2 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +2 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +2 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +2 +set @string_1= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select FIELD(NULL,'1it','Hit','3it') as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 +set @string_3= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select FIELD(NULL,'1it',NULL,'3it') as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +0 + +###### Variations on INSERT(str,pos,len,newstr) ###### + +set @stmt_part_1= "select INSERT(" ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ") as my_col" ; +set @max_var_number= 4; +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,4,'1234') as my_col ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +set @string_2= '+30.0E-1' ; +set @type_2= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',+30.0E-1,4,'1234') as my_col ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '+40.0E-1' ; +set @type_3= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,+40.0E-1,'1234') as my_col ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +execute __stmt_c_ ; +my_col +AB1234GHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_uv_ ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234GHI +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT(NULL,3,4,'1234') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'NULL' ; +set @type_2= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',NULL,4,'1234') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,NULL,'1234') as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= 'NULL' ; +set @type_4= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,4,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +NULL +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +set @string_2= '15' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',15,4,'1234') as my_col ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +set @string_2= '0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',0,4,'1234') as my_col ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +set @string_2= '-1' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',-1,4,'1234') as my_col ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +execute __stmt_c_ ; +my_col +ABCDEFGHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_uv_ ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +ABCDEFGHI +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +set @string_3= '10' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,10,'1234') as my_col ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 +set @string_3= '5' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,5,'1234') as my_col ; +my_col +AB1234HI +execute __stmt_c_ ; +my_col +AB1234HI +execute __stmt_c_ ; +my_col +AB1234HI +execute __stmt_c_ ; +my_col +AB1234HI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234HI +execute __stmt_uv_ ; +my_col +AB1234HI +execute __stmt_uv_ ; +my_col +AB1234HI +execute __stmt_uv_ ; +my_col +AB1234HI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234HI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234HI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234HI +set @string_3= '0' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,0,'1234') as my_col ; +my_col +AB1234CDEFGHI +execute __stmt_c_ ; +my_col +AB1234CDEFGHI +execute __stmt_c_ ; +my_col +AB1234CDEFGHI +execute __stmt_c_ ; +my_col +AB1234CDEFGHI +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234CDEFGHI +execute __stmt_uv_ ; +my_col +AB1234CDEFGHI +execute __stmt_uv_ ; +my_col +AB1234CDEFGHI +execute __stmt_uv_ ; +my_col +AB1234CDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234CDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234CDEFGHI +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234CDEFGHI +set @string_3= '-1' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select INSERT('ABCDEFGHI',3,-1,'1234') as my_col ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +execute __stmt_c_ ; +my_col +AB1234 +select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_uv_ ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; +my_col +AB1234 + +###### Variations on BIN(N) ###### + +set @stmt_part_1= "select BIN(" ; +set @stmt_part_2= ") as my_col" ; +set @max_var_number= 1; +set @string_1= '12' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(12) as my_col ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +select BIN(@var_1 ) as my_col ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select BIN(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +set @string_1= '2147483648' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(2147483648) as my_col ; +my_col +10000000000000000000000000000000 +execute __stmt_c_ ; +my_col +10000000000000000000000000000000 +execute __stmt_c_ ; +my_col +10000000000000000000000000000000 +execute __stmt_c_ ; +my_col +10000000000000000000000000000000 +select BIN(@var_1 ) as my_col ; +my_col +10000000000000000000000000000000 +execute __stmt_uv_ ; +my_col +10000000000000000000000000000000 +execute __stmt_uv_ ; +my_col +10000000000000000000000000000000 +execute __stmt_uv_ ; +my_col +10000000000000000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +10000000000000000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +10000000000000000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +10000000000000000000000000000000 +set @string_1= '0' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(0) as my_col ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +execute __stmt_c_ ; +my_col +0 +select BIN(@var_1 ) as my_col ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_uv_ ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +execute __stmt_ph_ using @var_1 ; +my_col +0 +set @string_1= '-1' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(-1) as my_col ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_c_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_c_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_c_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +select BIN(@var_1 ) as my_col ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_uv_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_uv_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_uv_ ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_ph_ using @var_1 ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_ph_ using @var_1 ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +execute __stmt_ph_ using @var_1 ; +my_col +1111111111111111111111111111111111111111111111111111111111111111 +set @string_1= '9000000000000000000' ; +set @type_1= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(9000000000000000000) as my_col ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_c_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_c_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_c_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +select BIN(@var_1 ) as my_col ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_uv_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_uv_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_uv_ ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +execute __stmt_ph_ using @var_1 ; +my_col +111110011100110011011000101000011100010100001000000000000000000 +set @string_1= '12.9E-0' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(12.9E-0) as my_col ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +select BIN(@var_1 ) as my_col ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +set @string_1= '0.129E+2' ; +set @type_1= 'DOUBLE' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIN(0.129E+2) as my_col ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +execute __stmt_c_ ; +my_col +1100 +select BIN(@var_1 ) as my_col ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_uv_ ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 +execute __stmt_ph_ using @var_1 ; +my_col +1100 + +###### Variations on BIT_LENGT(str) ###### + +set @stmt_part_1= "select BIT_LENGTH(" ; +set @stmt_part_2= ") as my_col" ; +set @max_var_number= 1; +set @string_1= 'text' ; +set @type_1= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIT_LENGTH('text') as my_col ; +my_col +32 +execute __stmt_c_ ; +my_col +32 +execute __stmt_c_ ; +my_col +32 +execute __stmt_c_ ; +my_col +32 +select BIT_LENGTH(@var_1 ) as my_col ; +my_col +32 +execute __stmt_uv_ ; +my_col +32 +execute __stmt_uv_ ; +my_col +32 +execute __stmt_uv_ ; +my_col +32 +execute __stmt_ph_ using @var_1 ; +my_col +32 +execute __stmt_ph_ using @var_1 ; +my_col +32 +execute __stmt_ph_ using @var_1 ; +my_col +32 +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select BIT_LENGTH(NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select BIT_LENGTH(@var_1 ) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ; +my_col +NULL + +###### Variations on CONV(N,from_base,to_base) ###### + +set @stmt_part_1= "select CONV(" ; +set @stmt_part_2= "," ; +set @stmt_part_3= "," ; +set @stmt_part_4= ") as my_col" ; +set @max_var_number= 3; +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(37,10,10) as my_col ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +set @string_1= '-37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(-37,10,10) as my_col ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +set @string_1= CAST(CAST(-37 AS unsigned INTEGER) AS CHAR); +set @type_1= 'LONGTEXT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV('18446744073709551579',10,10) as my_col ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +execute __stmt_c_ ; +my_col +18446744073709551579 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_uv_ ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +18446744073709551579 +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(37,10,-10) as my_col ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +set @string_1= '-37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(-37,10,-10) as my_col ; +my_col +-37 +execute __stmt_c_ ; +my_col +-37 +execute __stmt_c_ ; +my_col +-37 +execute __stmt_c_ ; +my_col +-37 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +-37 +execute __stmt_uv_ ; +my_col +-37 +execute __stmt_uv_ ; +my_col +-37 +execute __stmt_uv_ ; +my_col +-37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +-37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +-37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +-37 +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,10,11) as my_col ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,11,10) as my_col ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +execute __stmt_c_ ; +my_col +9 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_uv_ ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +9 +set @string_1= '10' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(10,10,11) as my_col ; +my_col +A +execute __stmt_c_ ; +my_col +A +execute __stmt_c_ ; +my_col +A +execute __stmt_c_ ; +my_col +A +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +A +execute __stmt_uv_ ; +my_col +A +execute __stmt_uv_ ; +my_col +A +execute __stmt_uv_ ; +my_col +A +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +A +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +A +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +A +set @string_1= 'A' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV('A',11,10) as my_col ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(11,10,11) as my_col ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +execute __stmt_c_ ; +my_col +10 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_uv_ ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +10 +set @string_1= '10' ; +set @type_1= 'BIGINT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(10,11,10) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '36' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(37,10,36) as my_col ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +execute __stmt_c_ ; +my_col +11 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_uv_ ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +11 +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +set @string_2= '36' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(11,36,10) as my_col ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +execute __stmt_c_ ; +my_col +37 +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_uv_ ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +37 +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(NULL,10,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '37' ; +set @string_2= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(37,NULL,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_2= '10' ; +set @string_3= 'NULL' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(37,10,NULL) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_3= '10' ; +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '37' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,37,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '1' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,1,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '0' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,0,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '-1' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,-1,10) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '37' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,10,37) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '1' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,10,1) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '0' ; +set @type_2= 'BIGINT' ; +set @string_3= '0' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,0,0) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-1' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,10,-1) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-37' ; +set @type_3= 'BIGINT' ; +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +select CONV(9,10,-37) as my_col ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +execute __stmt_c_ ; +my_col +NULL +select CONV(@var_1 ,@var_2,@var_3) as my_col ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_uv_ ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; +my_col +NULL diff --git a/mysql-test/r/tool_test.result b/mysql-test/r/tool_test.result new file mode 100644 index 00000000000..7be7645d8eb --- /dev/null +++ b/mysql-test/r/tool_test.result @@ -0,0 +1,223 @@ +use test ; +set @stmt_part_1= 'SELECT 1 as "my_fine_statement"' ; +set @max_var_number= 0; +the content of the statement variable +-------------------------------------- +@__stmt_c_ is: SELECT 1 as "my_fine_statement" +prepare __stmt_c_ from @__stmt_c_ ; +SELECT 1 as "my_fine_statement" ; +my_fine_statement +1 +execute __stmt_c_ ; +my_fine_statement +1 +execute __stmt_c_ ; +my_fine_statement +1 +execute __stmt_c_ ; +my_fine_statement +1 +set @stmt_part_1= 'SELECT ' ; +set @stmt_part_2= ' + ' ; +set @stmt_part_3= ' + ' ; +set @stmt_part_4= ' + ' ; +set @stmt_part_5= ' + ' ; +set @stmt_part_6= ' + ' ; +set @stmt_part_7= ' + ' ; +set @stmt_part_8= ' + ' ; +set @stmt_part_9= ' as "my_fine_statement"' ; +set @max_var_number= 8; +set @string_1= '1' ; +set @type_1= 'BIGINT' ; +set @string_2= 'nULL' ; +set @type_2= 'BIGINT' ; +set @string_3= '2.0' ; +set @type_3= 'DOUBLE' ; +set @string_4= 'NuLL' ; +set @type_4= 'DOUBLE' ; +set @string_5= 'TEXT' ; +set @type_5= 'LONGTEXT' ; +set @string_6= 'NUlL' ; +set @type_6= 'LONGTEXT' ; +set @string_7= 'BLOB' ; +set @type_7= 'LONGBLOB' ; +set @string_8= 'NULl' ; +set @type_8= 'LONGBLOB' ; +set @var_1= 'YYYYYYYY' ; +set @var_2= 'YYYYYYYY' ; +set @var_3= 'YYYYYYYY' ; +set @var_4= 'YYYYYYYY' ; +set @var_5= 'YYYYYYYY' ; +set @var_6= 'YYYYYYYY' ; +set @var_7= 'YYYYYYYY' ; +set @var_8= 'YYYYYYYY' ; +the content of the statement variables +-------------------------------------- +@__stmt_c_ is: SELECT 1 + NULL + 2.0 + NULL + 'TEXT' + NULL + 'BLOB' + NULL as "my_fine_statement" +@__stmt_uv_ is: SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" +@__stmt_ph_ is: SELECT ? + ? + ? + ? + ? + ? + ? + ? as "my_fine_statement" +@__execute_stmt_ph is: execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 +the content of the parameter variables +-------------------------------------- +type string uservariable +BIGINT 1 1 +type string uservariable +BIGINT nULL NULL +type string uservariable +DOUBLE 2.0 2 +type string uservariable +DOUBLE NuLL NULL +type string uservariable +LONGTEXT TEXT TEXT +type string uservariable +LONGTEXT NUlL NULL +type string uservariable +LONGBLOB BLOB BLOB +type string uservariable +LONGBLOB NULl NULL +@var_1 @var_2 @var_3 @var_4 @var_5 @var_6 @var_7 @var_8 +1 NULL 2 NULL TEXT NULL BLOB NULL +Table Create Table +t9 CREATE TABLE `t9` ( + `@var_1` bigint(20) default NULL, + `@var_2` bigint(20) default NULL, + `@var_3` double default NULL, + `@var_4` double default NULL, + `@var_5` longtext, + `@var_6` longtext, + `@var_7` longblob, + `@var_8` longblob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +SELECT 1 + NULL + 2.0 + NULL + 'TEXT' + NULL + 'BLOB' + NULL as "my_fine_statement" ; +my_fine_statement +NULL +execute __stmt_c_ ; +my_fine_statement +NULL +execute __stmt_c_ ; +my_fine_statement +NULL +execute __stmt_c_ ; +my_fine_statement +NULL +SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" ; +my_fine_statement +NULL +execute __stmt_uv_ ; +my_fine_statement +NULL +execute __stmt_uv_ ; +my_fine_statement +NULL +execute __stmt_uv_ ; +my_fine_statement +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +NULL +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +NULL +set @string_1= '1.0' ; +set @type_1= 'DOUBLE' ; +set @string_2= '3.0' ; +set @type_2= 'DOUBLE' ; +set @string_3= '2' ; +set @type_3= 'BIGINT' ; +set @string_4= '4' ; +set @type_4= 'BIGINT' ; +set @string_5= '5' ; +set @type_5= 'BIGINT' ; +set @string_6= '6' ; +set @type_6= 'DOUBLE' ; +set @string_7= '7' ; +set @type_7= 'DOUBLE' ; +set @string_8= '8' ; +set @type_8= 'DOUBLE' ; +set @var_1= 'YYYYYYYY' ; +set @var_2= 'YYYYYYYY' ; +set @var_3= 'YYYYYYYY' ; +set @var_4= 'YYYYYYYY' ; +set @var_5= 'YYYYYYYY' ; +set @var_6= 'YYYYYYYY' ; +set @var_7= 'YYYYYYYY' ; +set @var_8= 'YYYYYYYY' ; +the content of the statement variables +-------------------------------------- +@__stmt_c_ is: SELECT 1.0 + 3.0 + 2 + 4 + 5 + 6 + 7 + 8 as "my_fine_statement" +@__stmt_uv_ is: SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" +@__stmt_ph_ is: SELECT ? + ? + ? + ? + ? + ? + ? + ? as "my_fine_statement" +@__execute_stmt_ph is: execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 +the content of the parameter variables +-------------------------------------- +type string uservariable +DOUBLE 1.0 1 +type string uservariable +DOUBLE 3.0 3 +type string uservariable +BIGINT 2 2 +type string uservariable +BIGINT 4 4 +type string uservariable +BIGINT 5 5 +type string uservariable +DOUBLE 6 6 +type string uservariable +DOUBLE 7 7 +type string uservariable +DOUBLE 8 8 +@var_1 @var_2 @var_3 @var_4 @var_5 @var_6 @var_7 @var_8 +1 3 2 4 5 6 7 8 +Table Create Table +t9 CREATE TABLE `t9` ( + `@var_1` double default NULL, + `@var_2` double default NULL, + `@var_3` bigint(20) default NULL, + `@var_4` bigint(20) default NULL, + `@var_5` bigint(20) default NULL, + `@var_6` double default NULL, + `@var_7` double default NULL, + `@var_8` double default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +prepare __stmt_c_ from @__stmt_c_ ; +prepare __stmt_uv_ from @__stmt_uv_ ; +prepare __stmt_ph_ from @__stmt_ph_ ; +SELECT 1.0 + 3.0 + 2 + 4 + 5 + 6 + 7 + 8 as "my_fine_statement" ; +my_fine_statement +36.0 +execute __stmt_c_ ; +my_fine_statement +36.0 +execute __stmt_c_ ; +my_fine_statement +36.0 +execute __stmt_c_ ; +my_fine_statement +36.0 +SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" ; +my_fine_statement +36 +execute __stmt_uv_ ; +my_fine_statement +36 +execute __stmt_uv_ ; +my_fine_statement +36 +execute __stmt_uv_ ; +my_fine_statement +36 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +36 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +36 +execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; +my_fine_statement +36 diff --git a/mysql-test/t/ps_12func.test b/mysql-test/t/ps_12func.test new file mode 100644 index 00000000000..65abffe946c --- /dev/null +++ b/mysql-test/t/ps_12func.test @@ -0,0 +1,867 @@ +##################### ps_12func.test ##################### +# # +# Prepared Statement tests of functions # +# # +# Non prepared variants are also checked # +# # +# Checked functions: # +# # +# ROUND(X,D) and ROUND(X) # +# CONCAT_WS(separator,str1,str2,...) # +# CHAR(N,...) # +# CHAR_LENGTH(str) # +# FIELD(str,str1,str2,str3,...) # +# INSERT(str,pos,len,newstr) # +# BIN(N) # +# BIT_LENGTH(str) # +# CONV(N,from_base,to_base) # +# # +########################################################## + +use test; + +# "--disable_abort_on_error" is definitely needed, because there are some tests +# which intentional produce statements with wrong syntax and it is not +# possible to put a "--error " just before the execution calls +# within patchwork-test.inc . +--disable_abort_on_error + +##### ROUND(X,D) +--disable_query_log +select concat('###### Variations on ROUND(X,D) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= 'select ROUND(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ') as my_col' ; +set @max_var_number= 2; + + +#------------------------------------------------------------------ +# first parameter 11.298 (DOUBLE) , ROUND( m.n , p ) m = 2 ; n = 3 +# Variations on parameter2 +#------------------------------------------------------------------ +set @string_1= '11.298' ; +set @type_1= 'DOUBLE' ; +## data type BIGINT, if possible +set @type_2= 'BIGINT' ; +# p < n +set @string_2= '1' ; +--source include/patchwork-check.inc +# p = n +set @string_2= '3' ; +--source include/patchwork-check.inc +# p > n +set @string_2= '4' ; +--source include/patchwork-check.inc +# p = 0 +set @string_2= '0' ; +--source include/patchwork-check.inc +# -p < m +set @string_2= '-1' ; +--source include/patchwork-check.inc +# -p = m +set @string_2= '-2' ; +--source include/patchwork-check.inc +# -p > m +set @string_2= '-3' ; +--source include/patchwork-check.inc +# -p = NULL +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +## data type DOUBLE, if possible +set @type_2= 'DOUBLE' ; +# p < n +set @string_2= '1.0' ; +--source include/patchwork-check.inc +# p = n +set @string_2= '3.0' ; +--source include/patchwork-check.inc +# p > n +set @string_2= '4.0' ; +--source include/patchwork-check.inc +# p = 0 +set @string_2= '0.0' ; +--source include/patchwork-check.inc +# -p < m +set @string_2= '-1.0' ; +--source include/patchwork-check.inc +# -p = m +set @string_2= '-2.0' ; +--source include/patchwork-check.inc +# -p > m +set @string_2= '-3.0' ; +--source include/patchwork-check.inc +# ugly values +set @string_2= '1.1' ; +--source include/patchwork-check.inc +set @string_2= '1.9' ; +--source include/patchwork-check.inc +# -p = NULL +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +## data type LONGBLOB, content NULL +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + + +#------------------------------------------------------------------ +# first parameter data type BIGINT, content NULL +# Variations on parameter2 +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; + +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +--source include/patchwork-check.inc +set @string_2= '-2' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +--source include/patchwork-check.inc +set @string_2= '-2.0' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + + +#------------------------------------------------------------------ +# first parameter data type DOUBLE, content NULL +# Variations on parameter2 +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'DOUBLE' ; + +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +--source include/patchwork-check.inc +set @string_2= '-2' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +--source include/patchwork-check.inc +set @string_2= '-2.0' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + + +#------------------------------------------------------------------ +# first parameter data type LONGBLOB, content NULL +# Variations on parameter2 +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; + +set @type_2= 'BIGINT' ; +set @string_2= '2' ; +--source include/patchwork-check.inc +set @string_2= '-2' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'DOUBLE' ; +set @string_2= '2.0' ; +--source include/patchwork-check.inc +set @string_2= '-2.0' ; +--source include/patchwork-check.inc +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +set @type_2= 'LONGBLOB' ; +set @string_2= 'NULL' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# ROUND(D) Returns the argument X, rounded to the nearest integer. +#------------------------------------------------------------------ +set @stmt_part_1= 'select ROUND(' ; +set @stmt_part_2= ') as my_col' ; +set @max_var_number= 1; +## test cases with BIGINT +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '-11' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '0' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +## test cases with BIGINT +set @string_1= '11.49' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= '10.51' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= '0.0' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= 'NULL' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= '-11.49' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= '-10.51' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +## Incomplete statement +set @stmt_part_2= 'select ROUND() as my_col' ; +set @max_var_number= 0; +--source include/patchwork-check.inc + +##### CONCAT_WS(separator,str1,str2,...) +# Example: CONCAT_WS('S','My','QL') +--disable_query_log +select concat('###### Variations on CONCAT_WS(separator,str1,str2,...) ######') +as '' union select ''; +--enable_query_log +set @stmt_part_1= 'select CONCAT_WS(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ') as my_col' ; +set @max_var_number= 3; + +### common case +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +### The separator (first parameter) is NULL. +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +--source include/patchwork-check.inc +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc + +### The first string (second parameter) is NULL. +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'NULL' ; +set @type_2= 'LONGBLOB' ; +set @string_3= 'QL' ; +set @type_3= 'LONGTEXT' ; +--source include/patchwork-check.inc +set @type_2= 'BIGINT' ; +--source include/patchwork-check.inc +set @type_2= 'DOUBLE' ; +--source include/patchwork-check.inc + +### The second string (third parameter) is NULL. +set @string_1= 'S' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'My' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'NULL' ; +set @type_3= 'LONGTEXT' ; +--source include/patchwork-check.inc +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @type_3= 'DOUBLE' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# some complicated things +#------------------------------------------------------------------ +# select concat_ws('S',IF(parameter1=NULL,parameter2,parameter3),'QL') +set @stmt_part_1= "select CONCAT_WS('S',IF(" ; +set @stmt_part_2= ' IS NULL, ' ; +set @stmt_part_3= ' , ' ; +set @stmt_part_4= "),'QL') as my_col" ; +set @max_var_number= 3; + +# common case +set @string_1= 'My' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'X' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'My' ; +set @type_3= 'LONGTEXT' ; +--source include/patchwork-check.inc + +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= 'X' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'My' ; +set @type_3= 'LONGTEXT' ; +# deactivated because of +# Bug#6297 : prepared statement, wrong handling of IS NULL +# let $__debug_= 1; +# --source include/patchwork-check.inc + +##### CHAR(N,...) +# Example(Manual): SELECT CHAR(77,121,83,81,'76'); +--disable_query_log +select concat('###### Variations on CHAR(N,...) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= 'select CHAR(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ',' ; +set @stmt_part_6= ') as my_col' ; +set @max_var_number= 5; + +### common case +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +# Only the first parameter is NULL. +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +##### ugly maybe wrong result +# Bug#6317: string function CHAR, parameter is NULL, wrong result +#--source include/patchwork-check.inc + +## Only one non first/last parameter is NULL. +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +# Bug#6317: string function CHAR, parameter is NULL, wrong result +#--source include/patchwork-check.inc + +## Two neighbour parameters in the middle are NULL. +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +set @string_4= 'NULL' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +# Bug#6317: string function CHAR, parameter is NULL, wrong result +#--source include/patchwork-check.inc + +## Only the last parameter is NULL. +set @string_1= '77' ; +set @type_1= 'BIGINT' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= 'NULL' ; +set @type_5= 'BIGINT' ; +# Bug#6317: string function CHAR, parameter is NULL, wrong result +#--source include/patchwork-check.inc + +## The first parameter is NULL with bad type. +set @string_1= 'NULL' ; +set @type_1= 'LONGBLOB' ; +set @string_2= '121' ; +set @type_2= 'BIGINT' ; +set @string_3= '83' ; +set @type_3= 'BIGINT' ; +set @string_4= '81' ; +set @type_4= 'BIGINT' ; +set @string_5= '76' ; +set @type_5= 'BIGINT' ; +# Bug#6317: string function CHAR, parameter is NULL, wrong result +#--source include/patchwork-check.inc + + +##### CHAR_LENGTH(str) +--disable_query_log +select concat('###### Variations on CHAR_LENGTH ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= 'select CHAR_LENGTH(' ; +set @stmt_part_2= ') as my_col' ; +set @max_var_number= 1; + +### common case +set @string_1= 'MySQL' ; +set @type_1= 'LONGTEXT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +--source include/patchwork-check.inc +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc + + +##### FIELD(str,str1,str2,str3,...) +--disable_query_log +select concat('###### Variations on FIELD(str,str1,str2,str3,...) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= 'select FIELD(' ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ') as my_col' ; +set @max_var_number= 4; + +### common case +set @string_1= 'Hit' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '1it' ; +set @type_2= 'LONGTEXT' ; +set @string_3= 'Hit' ; +set @type_3= 'LONGTEXT' ; +set @string_4= '3it' ; +set @type_4= 'LONGTEXT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +# string to search for is NULL, all other strings not NULL +set @string_1= 'NULL' ; +# Bug#6321: strange error, string function FIELD(, .. +--source include/patchwork-check.inc +# string to search for and one of the other is NULL +set @string_3= 'NULL' ; +# Bug#6321: strange error, string function FIELD(, .. +--source include/patchwork-check.inc + + +##### INSERT(str,pos,len,newstr) +# Manual Example: SELECT INSERT('Quadratic', 3, 4, 'What') -> 'QuWhattic' +--disable_query_log +select concat('###### Variations on INSERT(str,pos,len,newstr) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= "select INSERT(" ; +set @stmt_part_2= ',' ; +set @stmt_part_3= ',' ; +set @stmt_part_4= ',' ; +set @stmt_part_5= ") as my_col" ; +set @max_var_number= 4; + +### common case (modified manual example) +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# Try DOUBLE instead of BIGINT for pos and len +#------------------------------------------------------------------ +set @string_2= '+30.0E-1' ; +set @type_2= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '+40.0E-1' ; +set @type_3= 'DOUBLE' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +--source include/patchwork-check.inc +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= 'NULL' ; +set @type_2= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= 'NULL' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= 'NULL' ; +set @type_4= 'LONGTEXT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# Variations on the second parameter (start position) +#------------------------------------------------------------------ +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +# start position > length of the first string (9) +set @string_2= '15' ; +--source include/patchwork-check.inc +# start position = 0 +set @string_2= '0' ; +--source include/patchwork-check.inc +# start position < 0 +set @string_2= '-1' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# Variations on the third parameter (# of chars of string one to be replaced) +#------------------------------------------------------------------ +set @string_1= 'ABCDEFGHI' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '3' ; +set @type_2= 'BIGINT' ; +set @string_3= '4' ; +set @type_3= 'BIGINT' ; +set @string_4= '1234' ; +set @type_4= 'LONGTEXT' ; +## chars to be replaced > length of the second string +# start pos (3) + replace length(10) > length of first string(9) +set @string_3= '10' ; +--source include/patchwork-check.inc +# start pos (3) + chars to be replaced (5) < length of first string(9) +set @string_3= '5' ; +--source include/patchwork-check.inc +# chars to be replaced = 0 +set @string_3= '0' ; +--source include/patchwork-check.inc +# chars to be replaced < 0 +set @string_3= '-1' ; +--source include/patchwork-check.inc + + +##### BIN(N) +# manual example: SELECT BIN(12); -> '1100' +--disable_query_log +select concat('###### Variations on BIN(N) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= "select BIN(" ; +set @stmt_part_2= ") as my_col" ; +set @max_var_number= 1; + +set @string_1= '12' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +#### Variations on the parameter +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '2147483648' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '0' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '-1' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9000000000000000000' ; +set @type_1= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '12.9E-0' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc +set @string_1= '0.129E+2' ; +set @type_1= 'DOUBLE' ; +--source include/patchwork-check.inc + +##### BIT_LENGTH(str) +# Manual example: SELECT BIT_LENGTH('text'); -> 32 +--disable_query_log +select concat('###### Variations on BIT_LENGT(str) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= "select BIT_LENGTH(" ; +set @stmt_part_2= ") as my_col" ; +set @max_var_number= 1; + +set @string_1= 'text' ; +set @type_1= 'LONGTEXT' ; +--source include/patchwork-check.inc + +# try NULL +set @string_1= 'NULL' ; +set @type_1= 'LONGTEXT' ; +--source include/patchwork-check.inc + + +##### CONV(N,from_base,to_base) +# Manual example: SELECT CONV(-17,10,-18); -> '-H' +--disable_query_log +select concat('###### Variations on CONV(N,from_base,to_base) ######') as '' +union select ''; +--enable_query_log +set @stmt_part_1= "select CONV(" ; +set @stmt_part_2= "," ; +set @stmt_part_3= "," ; +set @stmt_part_4= ") as my_col" ; +set @max_var_number= 3; + +#------------------------------------------------------------------ +# Manual: If to_base is a negative number, N is regarded as a signed number. +# Otherwise, N is treated as unsigned. +# Experiments with positive/negative number/to_base +#------------------------------------------------------------------ +# number positive written, to_base positive +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +# number negative written, to_base positive +set @string_1= '-37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +# The last result (unsigned) BIGINT 18446744073709551579 might be surprising. +# The next statements could give an explanation. +set @string_1= CAST(CAST(-37 AS unsigned INTEGER) AS CHAR); +set @type_1= 'LONGTEXT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +# number positive written, to_base negative +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +# number negative written, to_base negative +set @string_1= '-37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# conversions to and from the exotic 11 based number system +#------------------------------------------------------------------ +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '10' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= 'A' ; +set @type_1= 'LONGTEXT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '11' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '10' ; +set @type_1= 'BIGINT' ; +set @string_2= '11' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# Try the maximum base value 36 +#------------------------------------------------------------------ +set @string_1= '37' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '36' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '11' ; +set @type_1= 'BIGINT' ; +set @string_2= '36' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# NULL at different parameter positions +#------------------------------------------------------------------ +set @string_1= 'NULL' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '37' ; +set @string_2= 'NULL' ; +--source include/patchwork-check.inc +set @string_2= '10' ; +set @string_3= 'NULL' ; +--source include/patchwork-check.inc +set @string_3= '10' ; + +#------------------------------------------------------------------ +# The rule for from_base is: 2 <= from_base <= 36 +# Try values outside of this range. +#------------------------------------------------------------------ +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '37' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '1' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '0' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '-1' ; +set @type_2= 'BIGINT' ; +set @string_3= '10' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc + +#------------------------------------------------------------------ +# The rule for to_base is: 2<= ABS(to_base) <= 36 +# Try values outside of this range. +#------------------------------------------------------------------ +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '37' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '1' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '0' ; +set @type_2= 'BIGINT' ; +set @string_3= '0' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-1' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc +set @string_1= '9' ; +set @type_1= 'BIGINT' ; +set @string_2= '10' ; +set @type_2= 'BIGINT' ; +set @string_3= '-37' ; +set @type_3= 'BIGINT' ; +--source include/patchwork-check.inc + + diff --git a/mysql-test/t/tool_test.test b/mysql-test/t/tool_test.test new file mode 100644 index 00000000000..b28eae2c17d --- /dev/null +++ b/mysql-test/t/tool_test.test @@ -0,0 +1,105 @@ +########################### tool_test.test ############################# +# # +# Test sequences for the check of mysqltest based test tools # +# # +# Checked routines: # +# include/patchwork-check.inc # +# # +######################################################################## + +##### Check of include/patchwork-check.inc +# +use test ; +--disable_abort_on_error + +#----------------------------------------------------------------------- +# Simple test (special case): +# The statement is made of only one piece and does not contain variables. +#----------------------------------------------------------------------- +set @stmt_part_1= 'SELECT 1 as "my_fine_statement"' ; +set @max_var_number= 0; +# switch debug output on (Attention: patchwork-check.inc will switch it off) +let $__debug_= 1; +--source include/patchwork-check.inc + +#----------------------------------------------------------------------- +# Test case with many statement pieces and variables of all in +# include/patchwork-check.inc available data types. +#----------------------------------------------------------------------- +set @stmt_part_1= 'SELECT ' ; +set @stmt_part_2= ' + ' ; +set @stmt_part_3= ' + ' ; +set @stmt_part_4= ' + ' ; +set @stmt_part_5= ' + ' ; +set @stmt_part_6= ' + ' ; +set @stmt_part_7= ' + ' ; +set @stmt_part_8= ' + ' ; +set @stmt_part_9= ' as "my_fine_statement"' ; +set @max_var_number= 8; + +set @string_1= '1' ; +set @type_1= 'BIGINT' ; +set @string_2= 'nULL' ; +set @type_2= 'BIGINT' ; +set @string_3= '2.0' ; +set @type_3= 'DOUBLE' ; +set @string_4= 'NuLL' ; +set @type_4= 'DOUBLE' ; +set @string_5= 'TEXT' ; +set @type_5= 'LONGTEXT' ; +set @string_6= 'NUlL' ; +set @type_6= 'LONGTEXT' ; +set @string_7= 'BLOB' ; +set @type_7= 'LONGBLOB' ; +set @string_8= 'NULl' ; +set @type_8= 'LONGBLOB' ; + +# Initialization of all uservariables to the data type LONGTEXT and content, +# which will not be repeated within the following tests. +# 'include/patchwork-check.inc' MUST destroy all these settings. +# That is why this initialization is NOT needed within test cases +# calling include/patchwork-check.inc . +set @var_1= 'YYYYYYYY' ; +set @var_2= 'YYYYYYYY' ; +set @var_3= 'YYYYYYYY' ; +set @var_4= 'YYYYYYYY' ; +set @var_5= 'YYYYYYYY' ; +set @var_6= 'YYYYYYYY' ; +set @var_7= 'YYYYYYYY' ; +set @var_8= 'YYYYYYYY' ; + +# switch debug output on (Attention: patchwork-check.inc will switch it off) +let $__debug_= 1; +--source include/patchwork-check.inc + +### Execute the statement with more useful content of the variables. +set @string_1= '1.0' ; +set @type_1= 'DOUBLE' ; +set @string_2= '3.0' ; +set @type_2= 'DOUBLE' ; +set @string_3= '2' ; +set @type_3= 'BIGINT' ; +set @string_4= '4' ; +set @type_4= 'BIGINT' ; +set @string_5= '5' ; +set @type_5= 'BIGINT' ; +set @string_6= '6' ; +set @type_6= 'DOUBLE' ; +set @string_7= '7' ; +set @type_7= 'DOUBLE' ; +set @string_8= '8' ; +set @type_8= 'DOUBLE' ; + +# Initialization +set @var_1= 'YYYYYYYY' ; +set @var_2= 'YYYYYYYY' ; +set @var_3= 'YYYYYYYY' ; +set @var_4= 'YYYYYYYY' ; +set @var_5= 'YYYYYYYY' ; +set @var_6= 'YYYYYYYY' ; +set @var_7= 'YYYYYYYY' ; +set @var_8= 'YYYYYYYY' ; + +# switch debug output on (Attention: include/patchwork-check.inc switches it off) +let $__debug_= 1; +--source include/patchwork-check.inc From bd8f96f759a1b633de5d6359c824277663ebd3f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Dec 2004 21:00:43 +0100 Subject: [PATCH 02/20] Small bug fix ps-modify1 used the user variables @1, @2, @100 set within ps_query and ps_modify. That architecture was wrong, because the dependence of ps_modify1 on ps_query and ps_modify makes the test script maintenance and the use of these test cases during bug fixing/ debugging of single sub test cases very uncomfortable. Therefore these user variables (@1, @2, @100) are also set within ps-modify1. The result files of the test cases ps_2myisam, ps_3innodb, ps_4heap, ps_6bdb, ps_7ndb will be affected by that change and show 3 additional lines, but nothing else will change. mysql-test/include/ps_modify1.inc: Initialization of three user variables, with values derived from ps_query and ps_modify mysql-test/r/ps_2myisam.result: updated result set mysql-test/r/ps_3innodb.result: updated result set mysql-test/r/ps_4heap.result: updated result sset mysql-test/r/ps_6bdb.result: updated result set mysql-test/r/ps_7ndb.result: updated result set --- mysql-test/include/ps_modify1.inc | 3 +++ mysql-test/r/ps_2myisam.result | 3 +++ mysql-test/r/ps_3innodb.result | 3 +++ mysql-test/r/ps_4heap.result | 3 +++ mysql-test/r/ps_6bdb.result | 3 +++ mysql-test/r/ps_7ndb.result | 3 +++ 6 files changed, 18 insertions(+) diff --git a/mysql-test/include/ps_modify1.inc b/mysql-test/include/ps_modify1.inc index 5fba7faa59a..345654b2d66 100644 --- a/mysql-test/include/ps_modify1.inc +++ b/mysql-test/include/ps_modify1.inc @@ -65,6 +65,9 @@ execute stmt1 using @1000, @duplicate, @5; select a,b from t1 where a >= 1000 order by a ; delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; --disable_warnings diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 24c1102306f..c2799c6faed 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1688,6 +1688,9 @@ a b 1003 duplicate three 1004 duplicate four delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; drop table if exists t2; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index ad2912529a5..034cd75ea4b 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1671,6 +1671,9 @@ a b 1003 duplicate three 1004 duplicate four delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; drop table if exists t2; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 123e3d58b38..60a9ddd2bf2 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1672,6 +1672,9 @@ a b 1003 duplicate three 1004 duplicate four delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; drop table if exists t2; diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 5f2419bdda5..baf273c84c0 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1671,6 +1671,9 @@ a b 1003 duplicate three 1004 duplicate four delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; drop table if exists t2; diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 41c55cac0ca..3dbe3ed6218 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1671,6 +1671,9 @@ a b 1003 duplicate three 1004 duplicate four delete from t1 where a >= 1000 ; +set @1=1 ; +set @2=2 ; +set @100=100 ; set @float=1.00; set @five='five' ; drop table if exists t2; From 33959dc1a4fa638e67bb98892a466692b9ba402e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Dec 2004 12:36:01 +0100 Subject: [PATCH 03/20] fix for bug #7285: Disable start of embedded server when need to connect to an external server with mysqld. libmysql/libmysql.c: fix for bug #7285: Disable start of embedded server when need to connect to an external server with libmysqld. Calling mysql_server_init with a negative value for argc will not start the embedded server. --- libmysql/libmysql.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a71e99a5642..b180e86392d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -158,7 +158,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef EMBEDDED_LIBRARY - result= init_embedded_server(argc, argv, groups); + if (argc > -1) + result= init_embedded_server(argc, argv, groups); #endif } #ifdef THREAD From da2c55b3abf214af17624e82d9963ddf8f3851c0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Dec 2004 18:04:51 +0200 Subject: [PATCH 04/20] Test for BUG#6054. The bug itsel is fixed by the fix for #5837. mysql-test/r/update.result: test results mysql-test/t/update.test: bug test --- mysql-test/r/update.result | 6 ++++++ mysql-test/t/update.test | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index c9405d71237..08b7f942ccc 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -203,3 +203,9 @@ colC colA colD colE colF 3 4433 10005 492 500 DROP TABLE t1; DROP TABLE t2; +drop table if exists t1, t2; +create table t1 (c1 int, c2 char(6), c3 int); +create table t2 (c1 int, c2 char(6)); +insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); +update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; +update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 1850564418c..fdf6a57cc11 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -155,3 +155,12 @@ SELECT * FROM t2; DROP TABLE t1; DROP TABLE t2; +# +# Bug #6054 +# +drop table if exists t1, t2; +create table t1 (c1 int, c2 char(6), c3 int); +create table t2 (c1 int, c2 char(6)); +insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); +update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; +update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; From 8722bb9a09a1b1c84f909fc6079601127237028a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Dec 2004 18:44:39 +0200 Subject: [PATCH 05/20] Moved drop table statement to the end. mysql-test/r/update.result: moved drop statement mysql-test/t/update.test: moved drop statement --- mysql-test/r/update.result | 1 + mysql-test/t/update.test | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 08b7f942ccc..2d0903a4dae 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -209,3 +209,4 @@ create table t2 (c1 int, c2 char(6)); insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; +drop table t1, t2; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index fdf6a57cc11..62439dcc51b 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -158,9 +158,9 @@ DROP TABLE t2; # # Bug #6054 # -drop table if exists t1, t2; create table t1 (c1 int, c2 char(6), c3 int); create table t2 (c1 int, c2 char(6)); insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1"; update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10; +drop table t1, t2; From 1b17ba5244d654cdcc5171fbd6e777e5a1a2f34a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Dec 2004 20:26:24 +0100 Subject: [PATCH 06/20] Have 'mysql-test-run' write a list of all failed tests at the end, if run with '--force'. mysql-test/mysql-test-run.sh: Backport an improvement from 4.1: If the tool is run with '--force', give a list of all test cases that failed at the end. This is essential for automated analysis of the build logs file. --- mysql-test/mysql-test-run.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index d47560fe7a6..b760309bb5b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -4,6 +4,7 @@ # Sligtly updated by Monty # Cleaned up again by Matt # Fixed by Sergei +# List of failed cases (--force) backported from 4.1 by Joerg # :-) #++ @@ -202,6 +203,7 @@ MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log MYSQL_MANAGER_USER=root NO_SLAVE=0 USER_TEST= +FAILED_CASES= EXTRA_MASTER_OPT="" EXTRA_MYSQL_TEST_OPT="" @@ -1333,7 +1335,7 @@ run_testcase () show_failed_diff $result_file $ECHO if [ x$FORCE != x1 ] ; then - $ECHO "Aborting. To continue, re-run with '--force'." + $ECHO "Aborting: $tname failed. To continue, re-run with '--force'." $ECHO if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] then @@ -1342,7 +1344,7 @@ run_testcase () fi exit 1 fi - + FAILED_CASES="$FAILED_CASES $tname" if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] then mysql_restart @@ -1485,4 +1487,10 @@ $ECHO [ "$DO_GCOV" ] && gcov_collect # collect coverage information [ "$DO_GPROF" ] && gprof_collect # collect coverage information -exit 0 +if [ $TOT_FAIL -ne 0 ]; then + $ECHO "mysql-test-run: *** Failing the test(s):$FAILED_CASES" + $ECHO + exit 1 +else + exit 0 +fi From 1780c9b349452c9a06a572800a299495e733ed20 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Dec 2004 12:03:08 +0100 Subject: [PATCH 07/20] removed more duplicated commands for management server --- ndb/src/mgmclient/CommandInterpreter.cpp | 38 --- ndb/src/mgmsrv/CommandInterpreter.cpp | 300 +---------------------- ndb/src/mgmsrv/CommandInterpreter.hpp | 77 ------ 3 files changed, 7 insertions(+), 408 deletions(-) diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 0c7fe642e54..550830da56f 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -110,7 +110,6 @@ public: void executeRestart(int processId, const char* parameters, bool all); void executeLogLevel(int processId, const char* parameters, bool all); void executeError(int processId, const char* parameters, bool all); - void executeTrace(int processId, const char* parameters, bool all); void executeLog(int processId, const char* parameters, bool all); void executeLogIn(int processId, const char* parameters, bool all); void executeLogOut(int processId, const char* parameters, bool all); @@ -729,7 +728,6 @@ static const CommandInterpreter::CommandFunctionPair commands[] = { #ifdef ERROR_INSERT ,{ "ERROR", &CommandInterpreter::executeError } #endif - ,{ "TRACE", &CommandInterpreter::executeTrace } ,{ "LOG", &CommandInterpreter::executeLog } ,{ "LOGIN", &CommandInterpreter::executeLogIn } ,{ "LOGOUT", &CommandInterpreter::executeLogOut } @@ -1676,42 +1674,6 @@ void CommandInterpreter::executeError(int processId, ndb_mgm_insert_error(m_mgmsrv, processId, errorNo, NULL); } -//***************************************************************************** -//***************************************************************************** -void -CommandInterpreter::executeTrace(int /*processId*/, - const char* /*parameters*/, bool /*all*/) -{ -#if 0 - if (emptyString(parameters)) { - ndbout << "Missing trace number." << endl; - return; - } - - char* newpar = my_strdup(parameters,MYF(MY_WME)); - My_auto_ptr ap1(newpar); - char* firstParameter = strtok(newpar, " "); - - - int traceNo; - if (! convert(firstParameter, traceNo)) { - ndbout << "Expected an integer." << endl; - return; - } - char* allAfterFirstParameter = strtok(NULL, "\0"); - - if (! emptyString(allAfterFirstParameter)) { - ndbout << "Nothing expected after trace number." << endl; - return; - } - - int result = _mgmtSrvr.setTraceNo(processId, traceNo); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } -#endif -} - //***************************************************************************** //***************************************************************************** diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index 24b64457649..0b28defa196 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -104,7 +104,6 @@ int CommandInterpreter::readAndExecute() { int processId; if (! convert(firstToken, processId)) { ndbout << "Invalid command: " << _line << "." << endl; - ndbout << "Type HELP for help." << endl << endl; return true; } if (processId < 0) { @@ -120,20 +119,9 @@ int CommandInterpreter::readAndExecute() { static const CommandInterpreter::CommandFunctionPair commands[] = { - { "START", &CommandInterpreter::executeStart } - ,{ "RESTART", &CommandInterpreter::executeRestart } - ,{ "STOP", &CommandInterpreter::executeStop } -#ifdef ERROR_INSERT - ,{ "ERROR", &CommandInterpreter::executeError } -#endif - ,{ "TRACE", &CommandInterpreter::executeTrace } - ,{ "LOG", &CommandInterpreter::executeLog } - ,{ "LOGIN", &CommandInterpreter::executeLogIn } + { "LOGIN", &CommandInterpreter::executeLogIn } ,{ "LOGOUT", &CommandInterpreter::executeLogOut } ,{ "LOGOFF", &CommandInterpreter::executeLogOff } - ,{ "TESTON", &CommandInterpreter::executeTestOn } - ,{ "TESTOFF", &CommandInterpreter::executeTestOff } - ,{ "DUMP", &CommandInterpreter::executeDumpState } }; @@ -170,16 +158,14 @@ CommandInterpreter::analyseAfterFirstToken(int processId, if(fun == 0){ ndbout << "Invalid command: " << secondToken << "." << endl; - ndbout << "Type HELP for help." << endl << endl; return; } if(processId == -1){ executeForAll(command, fun, allAfterSecondToken); } else { - if(strcmp(command, "STATUS") != 0) - ndbout << "Executing " << command << " on node: " - << processId << endl << endl; + ndbout << "Executing " << command << " on node: " + << processId << endl << endl; (this->*fun)(processId, allAfterSecondToken, false); ndbout << endl; } @@ -190,18 +176,11 @@ CommandInterpreter::executeForAll(const char * cmd, ExecuteFunction fun, const char * allAfterSecondToken){ NodeId nodeId = 0; - if(strcmp(cmd, "STOP") == 0 || - strcmp(cmd, "RESTART") == 0){ - ndbout << "Executing " << cmd << " on all nodes" << endl << "\n"; + while(_mgmtSrvr.getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)){ + ndbout << "Executing " << cmd << " on node: " + << nodeId << endl << endl; (this->*fun)(nodeId, allAfterSecondToken, true); - } else { - while(_mgmtSrvr.getNextNodeId(&nodeId, NDB_MGM_NODE_TYPE_NDB)){ - if(strcmp(cmd, "STATUS") != 0) - ndbout << "Executing " << cmd << " on node: " - << nodeId << endl << endl; - (this->*fun)(nodeId, allAfterSecondToken, true); - ndbout << endl; - } // for + ndbout << endl; } } @@ -271,233 +250,6 @@ bool CommandInterpreter::parseBlockSpecification(const char* allAfterLog, return true; } -//***************************************************************************** -//***************************************************************************** - -void -stopCallback(int nodeId, void * anyData, int errCode){ - if(errCode == 0){ - if(nodeId == 0) - ndbout << "\nCluster has shutdown" << endl; - else - ndbout << "\nNode " << nodeId << " has shutdown" << endl; - } else { - MgmtSrvr * mgm = (MgmtSrvr *)anyData; - char err_str[1024]; - ndbout << "Node " << nodeId << " has not shutdown: " - << mgm->getErrorText(errCode,err_str,sizeof(err_str)) << endl; - } -} - -//***************************************************************************** -//***************************************************************************** -void CommandInterpreter::executeStop(int processId, - const char* parameters, bool all) { - - (void)parameters; // Don't want compiler warning - - int result = 0; - if(all) - result = _mgmtSrvr.stop((int *)0, false, stopCallback, this); - else - result = _mgmtSrvr.stopNode(processId, false, stopCallback, this); - - if(result != 0) - ndbout << get_error_text(result) << endl; -} - - -void CommandInterpreter::executeStart(int processId, const char* parameters, - bool all) { - (void)all; // Don't want compiler warning - - if (! emptyString(parameters)) { - ndbout << "No parameters expected to this command." << endl; - return; - } - - int result = _mgmtSrvr.start(processId); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } -} - -void -CommandInterpreter::executeRestart(int processId, const char* parameters, - bool all) { - - bool nostart = false; - bool initialstart = false; - - if(parameters != 0 && strlen(parameters) != 0){ - char * tmpString = strdup(parameters); - char * tmpPtr = 0; - char * item = strtok_r(tmpString, " ", &tmpPtr); - while(item != NULL){ - if(strcmp(item, "-N") == 0) - nostart = true; - if(strcmp(item, "-I") == 0) - initialstart = true; - item = strtok_r(NULL, " ", &tmpPtr); - } - free(tmpString); - } - int result; - if(all) - result = _mgmtSrvr.restart(nostart, initialstart, false, - 0, stopCallback, this); - else - result = _mgmtSrvr.restartNode(processId, nostart, initialstart, false, - stopCallback, - this); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } -} - -void -CommandInterpreter::executeDumpState(int processId, const char* parameters, - bool all) { - - (void)all; // Don't want compiler warning - - if(parameters == 0 || strlen(parameters) == 0){ - ndbout << "Expected argument" << endl; - return; - } - - Uint32 no = 0; - Uint32 pars[25]; - - char * tmpString = strdup(parameters); - char * tmpPtr = 0; - char * item = strtok_r(tmpString, " ", &tmpPtr); - int error; - while(item != NULL){ - if (0x0 <= my_strtoll10(item, NULL, &error) && my_strtoll10(item, NULL, &error) <= 0xffffffff) { - pars[no] = my_strtoll10(item, NULL, &error); - } else { - ndbout << "Illegal value in argument to signal." << endl - << "(Value must be between 0 and 0xffffffff.)" - << endl; - return; - } - no++; - item = strtok_r(NULL, " ", &tmpPtr); - } - ndbout << "Sending dump signal with data:" << endl; - for (Uint32 i=0; i blocks; - if (! parseBlockSpecification(parameters, blocks)) { - return; - } - - int result = _mgmtSrvr.setSignalLoggingMode(processId, MgmtSrvr::InOut, blocks); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } - -} - - - -//****************************************************************************** -//****************************************************************************** void CommandInterpreter::executeLogIn(int processId, const char* parameters, bool all) { @@ -554,41 +306,3 @@ void CommandInterpreter::executeLogOff(int processId, } } - -//****************************************************************************** -//****************************************************************************** -void CommandInterpreter::executeTestOn(int processId, - const char* parameters, bool all) { - - (void)all; // Don't want compiler warning - - if (! emptyString(parameters)) { - ndbout << "No parameters expected to this command." << endl; - return; - } - - int result = _mgmtSrvr.startSignalTracing(processId); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } - -} - -//****************************************************************************** -//****************************************************************************** -void CommandInterpreter::executeTestOff(int processId, - const char* parameters, bool all) { - - (void)all; // Don't want compiler warning - - if (! emptyString(parameters)) { - ndbout << "No parameters expected to this command." << endl; - return; - } - - int result = _mgmtSrvr.stopSignalTracing(processId); - if (result != 0) { - ndbout << get_error_text(result) << endl; - } - -} diff --git a/ndb/src/mgmsrv/CommandInterpreter.hpp b/ndb/src/mgmsrv/CommandInterpreter.hpp index 1cd80c5d3ae..0eb39758969 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.hpp +++ b/ndb/src/mgmsrv/CommandInterpreter.hpp @@ -17,52 +17,21 @@ #ifndef CommandInterpreter_H #define CommandInterpreter_H -//***************************************************************************** -// Author: Peter Lind -//***************************************************************************** - #include #include #include class MgmtSrvr; -/** - * @class CommandInterpreter - * @brief Reads command line in management client - * - * This class has one public method which reads a command line - * from a stream. It then interpret that commmand line and calls a suitable - * method in the MgmtSrvr class which executes the command. - * - * For command syntax, see the HELP command. - */ class CommandInterpreter { public: - /** - * Constructor - * @param mgmtSrvr: Management server to use when executing commands - */ CommandInterpreter(MgmtSrvr& mgmtSrvr); - - /** - * Reads one line from the stream, parse the line to find - * a command and then calls a suitable method which executes - * the command. - * - * @return true until quit/bye/exit has been typed - */ int readAndExecute(); private: char m_err_str[1024]; const char *get_error_text(int err_no); - /** - * Read a string, and return a pointer to it. - * - * @return NULL on EOF. - */ char *readline_gets () { static char linebuffer[254]; @@ -89,61 +58,15 @@ private: return (line_read); } - /** - * Analyse the command line, after the first token. - * - * @param processId: DB process id to send command to or -1 if - * command will be sent to all DB processes. - * @param allAfterFirstToken: What the client gave after the - * first token on the command line - */ void analyseAfterFirstToken(int processId, char* allAfterFirstTokenCstr); - - /** - * Parse the block specification part of the LOG* commands, - * things after LOG*: [BLOCK = {ALL|+}] - * - * @param allAfterLog: What the client gave after the second token - * (LOG*) on the command line - * @param blocks, OUT: ALL or name of all the blocks - * @return: true if correct syntax, otherwise false - */ bool parseBlockSpecification(const char* allAfterLog, Vector& blocks); - - /** - * A bunch of execute functions: Executes one of the commands - * - * @param processId: DB process id to send command to - * @param parameters: What the client gave after the command name - * on the command line. - * For example if complete input from user is: "1 LOGLEVEL 22" then the - * parameters argument is the string with everything after LOGLEVEL, in this - * case "22". Each function is responsible to check the parameters argument. - */ - void executeHelp(char* parameters); - void executeShow(char* parameters); - void executeRun(char* parameters); - void executeInfo(char* parameters); public: - void executeStop(int processId, const char* parameters, bool all); - void executeStart(int processId, const char* parameters, bool all); - void executeRestart(int processId, const char* parameters, bool all); - void executeError(int processId, const char* parameters, bool all); - void executeTrace(int processId, const char* parameters, bool all); - void executeLog(int processId, const char* parameters, bool all); void executeLogIn(int processId, const char* parameters, bool all); void executeLogOut(int processId, const char* parameters, bool all); void executeLogOff(int processId, const char* parameters, bool all); - void executeTestOn(int processId, const char* parameters, bool all); - void executeTestOff(int processId, const char* parameters, bool all); - void executeStatus(int processId, const char* parameters, bool all); - void executeDumpState(int processId, const char* parameters, bool all); - /** - * A execute function definition - */ public: typedef void (CommandInterpreter::* ExecuteFunction)(int processId, const char * param, From 7b592c9e2416792fd17997a8f44eadb939c2629a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Dec 2004 12:27:08 +0100 Subject: [PATCH 08/20] added TRACE to managemnt server removed TRACE from management client ndb/src/mgmclient/CommandInterpreter.cpp: removed TRACE from management client ndb/src/mgmsrv/CommandInterpreter.cpp: added TRACE to managemnt server ndb/src/mgmsrv/CommandInterpreter.hpp: added TRACE to managemnt server --- ndb/src/mgmclient/CommandInterpreter.cpp | 1 - ndb/src/mgmsrv/CommandInterpreter.cpp | 39 +++++++++++++++++++++++- ndb/src/mgmsrv/CommandInterpreter.hpp | 1 + 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 550830da56f..cbf7776fe06 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -340,7 +340,6 @@ static const char* helpTextDebug = #ifdef ERROR_INSERT " ERROR Inject error into NDB node\n" #endif -" TRACE Set trace number\n" " LOG [BLOCK = {ALL|+}] Set logging on in & out signals\n" " LOGIN [BLOCK = {ALL|+}] Set logging on in signals\n" " LOGOUT [BLOCK = {ALL|+}] Set logging on out signals\n" diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index 0b28defa196..686155415d5 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -119,7 +119,8 @@ int CommandInterpreter::readAndExecute() { static const CommandInterpreter::CommandFunctionPair commands[] = { - { "LOGIN", &CommandInterpreter::executeLogIn } + { "TRACE", &CommandInterpreter::executeTrace } + ,{ "LOGIN", &CommandInterpreter::executeLogIn } ,{ "LOGOUT", &CommandInterpreter::executeLogOut } ,{ "LOGOFF", &CommandInterpreter::executeLogOff } }; @@ -306,3 +307,39 @@ void CommandInterpreter::executeLogOff(int processId, } } + +void CommandInterpreter::executeTrace(int processId, + const char* parameters, bool all) { + + (void)all; // Don't want compiler warning + + if (emptyString(parameters)) { + ndbout << "Missing trace number." << endl; + return; + } + + char* newpar = strdup(parameters); + char* firstParameter = strtok(newpar, " "); + + + int traceNo; + if (! convert(firstParameter, traceNo)) { + ndbout << "Expected an integer." << endl; + free(newpar); + return; + } + + char* allAfterFirstParameter = strtok(NULL, "\0"); + + if (! emptyString(allAfterFirstParameter)) { + ndbout << "Nothing expected after trace number." << endl; + free(newpar); + return; + } + + int result = _mgmtSrvr.setTraceNo(processId, traceNo); + if (result != 0) { + ndbout << get_error_text(result) << endl; + } + free(newpar); +} diff --git a/ndb/src/mgmsrv/CommandInterpreter.hpp b/ndb/src/mgmsrv/CommandInterpreter.hpp index 0eb39758969..6b67d1a5a5f 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.hpp +++ b/ndb/src/mgmsrv/CommandInterpreter.hpp @@ -63,6 +63,7 @@ private: Vector& blocks); public: + void executeTrace(int processId, const char* parameters, bool all); void executeLogIn(int processId, const char* parameters, bool all); void executeLogOut(int processId, const char* parameters, bool all); void executeLogOff(int processId, const char* parameters, bool all); From 71981ad774c92552ce300389f519fc9a410b3686 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Dec 2004 17:03:15 +0100 Subject: [PATCH 09/20] Delete files which were accidently created within the last push BitKeeper/deleted/.del-tool_test.test~7a0c705c995ee523: Delete: mysql-test/t/tool_test.test BitKeeper/deleted/.del-tool_test.result~ec1f972349e9e18: Delete: mysql-test/r/tool_test.result BitKeeper/deleted/.del-ps_12func.test~78bc82c8a4a1ccae: Delete: mysql-test/t/ps_12func.test BitKeeper/deleted/.del-ps_12func.result~d8cce403c6cb460e: Delete: mysql-test/r/ps_12func.result BitKeeper/deleted/.del-patchwork-check.inc~45d0d076850f5c5b: Delete: mysql-test/include/patchwork-check.inc --- mysql-test/include/patchwork-check.inc | 330 -- mysql-test/r/ps_12func.result | 4748 ------------------------ mysql-test/r/tool_test.result | 223 -- mysql-test/t/ps_12func.test | 867 ----- mysql-test/t/tool_test.test | 105 - 5 files changed, 6273 deletions(-) delete mode 100644 mysql-test/include/patchwork-check.inc delete mode 100644 mysql-test/r/ps_12func.result delete mode 100644 mysql-test/r/tool_test.result delete mode 100644 mysql-test/t/ps_12func.test delete mode 100644 mysql-test/t/tool_test.test diff --git a/mysql-test/include/patchwork-check.inc b/mysql-test/include/patchwork-check.inc deleted file mode 100644 index b11db7fa50d..00000000000 --- a/mysql-test/include/patchwork-check.inc +++ /dev/null @@ -1,330 +0,0 @@ -###################### patchwork-check.inc ############################# -# # -# Basic routine for the generation and execution of prepared and non # -# prepared SQL statements. # -# # -# Purpose: Simplify the check of complex statements with different # -# sets of parameters (data type, value) # -# # -######################################################################## - -# -# NOTE: PLEASE BE VERY CAREFULL, WHEN CHANGING OR USING ;-) THIS ROUTINE. -# -# Please be aware, that this routine -# - will be sourced by several test case files stored within the -# directory 'mysql-test/t'. So every change here will affect -# several test cases. -# - does not check its own prequisites -# - modifies the content and the data type of the -# uservariables @var_1 ... @var_ -# -# Please preserve the '___' naming of the the auxiliary variables. -# These names should avoid that a test case writer accidently creates a -# variable with the same name. -# - -# naming conventions: -# stmt_c_ --> statement with constants like "select 1 " -# stmt_uv_ --> statement with uservariables like "select @var_1 " -# stmt_ph_ --> prepared statement with placeholders like "select ? " - - -# -# Explanation how to use this routine by an example: -# -# Content of the caller script: -# .... -# set @stmt_part1= 'SELECT f1 + ' -# set @stmt_part2= ' from t1 where f2= ' ; -# set @stmt_part3= '' ; -# set @string_1= "1"; set @type_1= "BIGINT"; -# set @string_2= "-2.3E-4"; set @type_2= "DOUBLE"; -# set @max_var_number= 2; -# --source include/patchwork-check.inc -# -# # The next testing rounds could start with -# set @string_1= "NULL"; set @type_1= "BIGINT"; -# set @string_2= "-2.3E-4"; set @type_2= "DOUBLE"; -# --source include/patchwork-check.inc -# -# set @string_1= "1"; set @type_1= "BIGINT"; -# set @string_2= "NULL"; set @type_2= "LONGTEXT"; -# --source include/patchwork-check.inc -# -# Statements and uservariables to be produced and executed by this routine -# 1. Statements with constants -# 1.1 stmt1= SELECT f1 + 1 from t1 where f2= -2.3E-4 ; -# 1.2 stmt1 as prepared statement -# 2. Statements with uservariables -# @var_n should be of data type @type_n (if possible) and have the -# content @string_n . -# 2.1 stmt2= SELECT f1 + @var_1 from t1 where f2= @var_2 -# 2.2 stmt2 as prepared statement -# 3. prepared statement with placeholders -# prepare stmt1 from 'SELECT f1 + ? from t1 where f2= ?' -# execute stmt1 using @var_1, @var_2 -# -# Every prepared statement variant of the "patchwork" is 3 times executed. -# -# -# Please have also also a look into -# - t/tooltest.test , which checks or -# - t/ps_12func.test , which contains test cases using -# this routine. -# - - -############## -# -# Prerequisites: -# -# The caller script must set the following uservariables: -# -# The statement pieces: @stmt_part1, @stmt_part2, ... , @stmt_part -# -# The parameter values: @string_1, ... , @string_ -# The parameter value should fit to the data type ! -# UPPER(@stmt_part1) = 'NULL' will cause (SQL) NULL as content. -# -# The parameter data types: @type_1, ... , @type_ -# valid types are: BIGINT, DOUBLE, LONGTEXT, LONGBLOB -# -# Attention: All other type assignments will lead to a -# uservariable of type LONGTEXT !! -# -# The number of parameter values must be published via -# set @max_var_number= ; -# -# Attention: This routine does not perform any check of the content -# of these variables. -# - -############## -# -# How is intended uservariable generated: -# -# Step 1: generate a uservariable of the intended type -# -# UPPER(@type_) statement -# BIGINT set @var_= 0 -# DOUBLE' set @var_idx_= 0.0 -# LONGTEXT' set @var_= "INIT" -# LONGBLOB' set @var_= CAST("INIT" AS BINARY) -# set @var_= "INIT" -# -# Step 2: assign the value to the uservariable -# -# IF ( UPPER(@string_) != 'NULL') -# UPPER(@type_) -# BIGINT set @var_= CEIL(@string_) -# DOUBLE set @var_= @string_ + 0.0 -# LONGTEXT set @var_= @string_ -# LONGBLOB set @var_= CAST(@string_ AS BINARY) -# set @var_= @string_ -# ELSE -# set @var_= NULL -# - - -# -# How to debug this routine if something goes wrong: -# -# 1. Put the line '--disable_abort_on_error' into the caller script -# --> There will be no abort of mysqltest, if a statement fails. -# You will get a protocol (in most cases). -# 2. Put the line 'set $__debug_= 1 ;' into the caller script . -# The next call of patchwork-check.inc will print -# the type and content of generated uservariables and statements. -# 3. disable the '--disable_query_log' option some lines below -# -# and please be patient towards this routine, it is far away from being perfect. -# - - -# Suppress the majority of the huge output concerning the statement and -# uservariable generation ---disable_query_log - -let $__idx_= 1 ; -eval set @__stmt_c_= @stmt_part_$__idx_ ; -# If the number of variables is greater 0, we need also -# - the statement with uservariables (stmt_uv) and -# - the prepared statement with placeholders (stmt_ph) and -# - the execute for the prepared statement with placeholders (execute_stmt_ph) -let $__with_var_= `select @max_var_number > 0`; -while ($__with_var_) -{ - eval set @__stmt_uv_= @stmt_part_$__idx_ ; - eval set @__stmt_ph_= @stmt_part_$__idx_ ; - set @__execute_stmt_ph= 'execute __stmt_ph_ using ' ; - let $__num_= `select @max_var_number`; - while ($__num_) - { - ##### Generate the Uservariables - eval set @__my_init_= CASE UPPER(@type_$__idx_) - WHEN 'BIGINT' THEN 'set @var_$__idx_= 0' - WHEN 'DOUBLE' THEN 'set @var_$__idx_= 0.0' - WHEN 'LONGTEXT' THEN 'set @var_$__idx_= "INIT"' - WHEN 'LONGBLOB' THEN 'set @var_$__idx_= CAST("INIT" AS BINARY)' - ELSE 'set @var_$__idx_= "INIT"' END; - # select @__my_init_ as "@__my_init_ is: " ; - let $__my_init_= `select @__my_init_`; - eval $__my_init_ ; - - eval set @__my_init_= CASE UPPER(@type_$__idx_) - WHEN 'BIGINT' THEN - "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',CEIL(@string_$__idx_),NULL)" - WHEN 'DOUBLE' THEN - "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_ + 0.0,NULL)" - WHEN 'LONGTEXT' THEN - "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_,NULL)" - WHEN 'LONGBLOB' THEN - "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',CAST(@string_$__idx_ AS BINARY),NULL)" - ELSE - "set @var_$__idx_= IF(UPPER(@string_$__idx_)!='NULL',@string_$__idx_,NULL)" END; - let $__my_init_= `select @__my_init_`; - eval $__my_init_ ; - - ##### concat the variable to the statements - ## with Constants - # 1. replace ugly NULLs like 'NuLl' with 'NULL' for better readability - # 2. Strings to be inserted into the statement must be quoted - eval set @__stmt_c_= concat( - @__stmt_c_, - IF(UPPER(@string_$__idx_)='NULL','NULL', - IF(UPPER(@type_$__idx_)='LONGTEXT' or UPPER(@type_$__idx_)='LONGBLOB', - concat('''',@string_$__idx_,''''), @string_$__idx_ - ))) ; - ## with Uservariables - eval set @__stmt_uv_= concat(@__stmt_uv_, '@var_$__idx_') ; - ## with placeholders - eval set @__stmt_ph_= concat(@__stmt_ph_, '?') ; - - ##### complete the execute for the prepared statement with placeholders - eval set @__execute_stmt_ph= concat(@__execute_stmt_ph, '@var_$__idx_,') ; - - inc $__idx_ ; - ##### concat the next part of the statement to the statements - eval set @__stmt_c_= concat(@__stmt_c_, @stmt_part_$__idx_ ); - eval set @__stmt_uv_= concat(@__stmt_uv_, @stmt_part_$__idx_ ); - eval set @__stmt_ph_= concat(@__stmt_ph_, @stmt_part_$__idx_ ); - - dec $__num_ ; - } - # @__execute_stmt_ph contains a trailing ',' which must be cut away - set @__execute_stmt_ph= substr(@__execute_stmt_ph,1,length(@__execute_stmt_ph) - 1); - dec $__with_var_ ; -} - -while ($__debug_) -{ - ### Print debug informations for patchwork with variables - let $__with_var_= `select @max_var_number > 0`; - while ($__with_var_) - { - ### Print out the content of the statement variables - eval select "--------------------------------------" - as "the content of the statement variables" - union select concat('@__stmt_c_ is: ',@__stmt_c_) - union select concat('@__stmt_uv_ is: ',@__stmt_uv_) - union select concat('@__stmt_ph_ is: ',@__stmt_ph_) - union select concat('@__execute_stmt_ph is: ',@__execute_stmt_ph); - - - ### Print out the content of the uservariables - select '--------------------------------------' - as "the content of the parameter variables"; - set @__parameter_= 'select '; - let $__num_= `select @max_var_number`; - let $__idx_= 1 ; - while ($__num_) - { - eval select @type_$__idx_ as type, - @string_$__idx_ as string, - @var_$__idx_ as uservariable ; - eval set @__parameter_= concat(@__parameter_, '@var_$__idx_ ,'); - inc $__idx_ ; - - dec $__num_ ; - } - # @__parameter_ contains a trailing ',' which must be cut away - set @__parameter_= substr(@__parameter_,1,length(@__parameter_) - 1); - let $__aux_= `select @__parameter_` ; - eval $__aux_ ; - - - ### Create a table from the uservariables and print out the column types - let $__aux_= `select concat('CREATE TABLE t9 AS ',@__parameter_)` ; - --disable_warnings - drop table if exists t9; - --enable_warnings - eval $__aux_ ; - show create table t9; - drop table t9; - - dec $__with_var_ ; - } - ### Print debug informations for patchwork without variables - ### stmt_uv, stmt_ph, execute_stmt_ph and uservariables do NOT exist - let $__with_var_= `select @max_var_number = 0`; - while ($__with_var_) - { - ### Print out the content of the statement variables - eval select "--------------------------------------" - as "the content of the statement variable" - union select concat('@__stmt_c_ is: ',@__stmt_c_) ; - - dec $__with_var_ ; - } - - - dec $__debug_ ; -} - -## copy the statements and the execute into $variables -# (__stmt_ph_ is not needed) -## + generate the prepared statements ---enable_query_log -let $__stmt_c_= `select @__stmt_c_`; -eval prepare __stmt_c_ from @__stmt_c_ ; -let $__with_var_= `select @max_var_number > 0`; -while ($__with_var_) -{ - let $__stmt_uv_= `select @__stmt_uv_`; - eval prepare __stmt_uv_ from @__stmt_uv_ ; - let $__execute_ph= `select @__execute_stmt_ph`; - eval prepare __stmt_ph_ from @__stmt_ph_ ; - dec $__with_var_ ; -} - - -##### The execution of all statements -## statement with Constants -eval $__stmt_c_ ; -## prepared statement with Constants -execute __stmt_c_ ; -# Try to detect if the prior executes damaged the parse tree by -# two additional executes . -execute __stmt_c_ ; -execute __stmt_c_ ; -let $__with_var_= `select @max_var_number > 0`; -while ($__with_var_) -{ - ## statement with Uservariables - eval $__stmt_uv_ ; - ## prepared statement with Uservariables - execute __stmt_uv_ ; - # Try to detect if the prior executes damaged the parse tree by - # two additional executes . - execute __stmt_uv_ ; - execute __stmt_uv_ ; - ## prepared statement with placeholders - eval $__execute_ph ; - # Try to detect if the prior executes damaged the parse tree by - # two additional executes . - eval $__execute_ph ; - eval $__execute_ph ; - - dec $__with_var_ ; -} diff --git a/mysql-test/r/ps_12func.result b/mysql-test/r/ps_12func.result deleted file mode 100644 index 881d5392edd..00000000000 --- a/mysql-test/r/ps_12func.result +++ /dev/null @@ -1,4748 +0,0 @@ -use test; - -###### Variations on ROUND(X,D) ###### - -set @stmt_part_1= 'select ROUND(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ') as my_col' ; -set @max_var_number= 2; -set @string_1= '11.298' ; -set @type_1= 'DOUBLE' ; -set @type_2= 'BIGINT' ; -set @string_2= '1' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,1) as my_col ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -set @string_2= '3' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,3) as my_col ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -set @string_2= '4' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,4) as my_col ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -set @string_2= '0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,0) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -set @string_2= '-1' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-1) as my_col ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -set @string_2= '-2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-2) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -set @string_2= '-3' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-3) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'DOUBLE' ; -set @string_2= '1.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,1.0) as my_col ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -set @string_2= '3.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,3.0) as my_col ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -execute __stmt_c_ ; -my_col -11.298 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_uv_ ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.298 -set @string_2= '4.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,4.0) as my_col ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -execute __stmt_c_ ; -my_col -11.2980 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_uv_ ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.2980 -set @string_2= '0.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,0.0) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11 -set @string_2= '-1.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-1.0) as my_col ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -10 -set @string_2= '-2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-2.0) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -set @string_2= '-3.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,-3.0) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -0 -set @string_2= '1.1' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,1.1) as my_col ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -execute __stmt_c_ ; -my_col -11.3 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.3 -set @string_2= '1.9' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,1.9) as my_col ; -my_col -11.30 -execute __stmt_c_ ; -my_col -11.30 -execute __stmt_c_ ; -my_col -11.30 -execute __stmt_c_ ; -my_col -11.30 -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_uv_ ; -my_col -11.3 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.30 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.30 -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -11.30 -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.298,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -set @type_2= 'BIGINT' ; -set @string_2= '2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_1= 'NULL' ; -set @type_1= 'DOUBLE' ; -set @type_2= 'BIGINT' ; -set @string_2= '2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @type_2= 'BIGINT' ; -set @string_2= '2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= '-2.0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,-2.0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ,@var_2) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2 ; -my_col -NULL -set @stmt_part_1= 'select ROUND(' ; -set @stmt_part_2= ') as my_col' ; -set @max_var_number= 1; -set @string_1= '11' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select ROUND(@var_1 ) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -set @string_1= '-11' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(-11) as my_col ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -select ROUND(@var_1 ) as my_col ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -set @string_1= '0' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(0) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -set @string_1= '11.49' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(11.49) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select ROUND(@var_1 ) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -set @string_1= '10.51' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(10.51) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select ROUND(@var_1 ) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -execute __stmt_ph_ using @var_1 ; -my_col -11 -set @string_1= '0.0' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(0.0) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select ROUND(@var_1 ) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -set @string_1= 'NULL' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select ROUND(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -set @string_1= '-11.49' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(-11.49) as my_col ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -select ROUND(@var_1 ) as my_col ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -set @string_1= '-10.51' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select ROUND(-10.51) as my_col ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -execute __stmt_c_ ; -my_col --11 -select ROUND(@var_1 ) as my_col ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_uv_ ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -execute __stmt_ph_ using @var_1 ; -my_col --11 -set @stmt_part_2= 'select ROUND() as my_col' ; -set @max_var_number= 0; -prepare __stmt_c_ from @__stmt_c_ ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -select ROUND( ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -execute __stmt_c_ ; -ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE -execute __stmt_c_ ; -ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE -execute __stmt_c_ ; -ERROR HY000: Unknown prepared statement handler (__stmt_c_) given to EXECUTE - -###### Variations on CONCAT_WS(separator,str1,str2,...) ###### - -set @stmt_part_1= 'select CONCAT_WS(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ') as my_col' ; -set @max_var_number= 3; -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S','My','QL') as my_col ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS(NULL,'My','QL') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS(NULL,'My','QL') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS(NULL,'My','QL') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'NULL' ; -set @type_2= 'LONGBLOB' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S',NULL,'QL') as my_col ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -set @type_2= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S',NULL,'QL') as my_col ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -set @type_2= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S',NULL,'QL') as my_col ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -execute __stmt_c_ ; -my_col -QL -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_uv_ ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -QL -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'NULL' ; -set @type_3= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S','My',NULL) as my_col ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S','My',NULL) as my_col ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -set @type_3= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S','My',NULL) as my_col ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -execute __stmt_c_ ; -my_col -My -select CONCAT_WS(@var_1 ,@var_2,@var_3) as my_col ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_uv_ ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -My -set @stmt_part_1= "select CONCAT_WS('S',IF(" ; -set @stmt_part_2= ' IS NULL, ' ; -set @stmt_part_3= ' , ' ; -set @stmt_part_4= "),'QL') as my_col" ; -set @max_var_number= 3; -set @string_1= 'My' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'X' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'My' ; -set @type_3= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONCAT_WS('S',IF('My' IS NULL, 'X' , 'My'),'QL') as my_col ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -select CONCAT_WS('S',IF(@var_1 IS NULL, @var_2 , @var_3),'QL') as my_col ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -MySQL -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= 'X' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'My' ; -set @type_3= 'LONGTEXT' ; - -###### Variations on CHAR(N,...) ###### - -set @stmt_part_1= 'select CHAR(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ',' ; -set @stmt_part_6= ') as my_col' ; -set @max_var_number= 5; -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CHAR(77,121,83,81,76) as my_col ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -execute __stmt_c_ ; -my_col -MySQL -select CHAR(@var_1 ,@var_2,@var_3,@var_4,@var_5) as my_col ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_uv_ ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; -my_col -MySQL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5 ; -my_col -MySQL -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; -set @string_4= 'NULL' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= 'NULL' ; -set @type_5= 'BIGINT' ; -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; - -###### Variations on CHAR_LENGTH ###### - -set @stmt_part_1= 'select CHAR_LENGTH(' ; -set @stmt_part_2= ') as my_col' ; -set @max_var_number= 1; -set @string_1= 'MySQL' ; -set @type_1= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CHAR_LENGTH('MySQL') as my_col ; -my_col -5 -execute __stmt_c_ ; -my_col -5 -execute __stmt_c_ ; -my_col -5 -execute __stmt_c_ ; -my_col -5 -select CHAR_LENGTH(@var_1 ) as my_col ; -my_col -5 -execute __stmt_uv_ ; -my_col -5 -execute __stmt_uv_ ; -my_col -5 -execute __stmt_uv_ ; -my_col -5 -execute __stmt_ph_ using @var_1 ; -my_col -5 -execute __stmt_ph_ using @var_1 ; -my_col -5 -execute __stmt_ph_ using @var_1 ; -my_col -5 -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CHAR_LENGTH(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CHAR_LENGTH(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CHAR_LENGTH(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CHAR_LENGTH(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CHAR_LENGTH(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CHAR_LENGTH(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL - -###### Variations on FIELD(str,str1,str2,str3,...) ###### - -set @stmt_part_1= 'select FIELD(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ') as my_col' ; -set @max_var_number= 4; -set @string_1= 'Hit' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '1it' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'Hit' ; -set @type_3= 'LONGTEXT' ; -set @string_4= '3it' ; -set @type_4= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select FIELD('Hit','1it','Hit','3it') as my_col ; -my_col -2 -execute __stmt_c_ ; -my_col -2 -execute __stmt_c_ ; -my_col -2 -execute __stmt_c_ ; -my_col -2 -select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -2 -execute __stmt_uv_ ; -my_col -2 -execute __stmt_uv_ ; -my_col -2 -execute __stmt_uv_ ; -my_col -2 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -2 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -2 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -2 -set @string_1= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select FIELD(NULL,'1it','Hit','3it') as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 -set @string_3= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select FIELD(NULL,'1it',NULL,'3it') as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select FIELD(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -0 - -###### Variations on INSERT(str,pos,len,newstr) ###### - -set @stmt_part_1= "select INSERT(" ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ") as my_col" ; -set @max_var_number= 4; -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,4,'1234') as my_col ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -set @string_2= '+30.0E-1' ; -set @type_2= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',+30.0E-1,4,'1234') as my_col ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '+40.0E-1' ; -set @type_3= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,+40.0E-1,'1234') as my_col ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -execute __stmt_c_ ; -my_col -AB1234GHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_uv_ ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234GHI -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT(NULL,3,4,'1234') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'NULL' ; -set @type_2= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',NULL,4,'1234') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,NULL,'1234') as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= 'NULL' ; -set @type_4= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,4,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -NULL -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -set @string_2= '15' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',15,4,'1234') as my_col ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -set @string_2= '0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',0,4,'1234') as my_col ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -set @string_2= '-1' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',-1,4,'1234') as my_col ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -execute __stmt_c_ ; -my_col -ABCDEFGHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_uv_ ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -ABCDEFGHI -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -set @string_3= '10' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,10,'1234') as my_col ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 -set @string_3= '5' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,5,'1234') as my_col ; -my_col -AB1234HI -execute __stmt_c_ ; -my_col -AB1234HI -execute __stmt_c_ ; -my_col -AB1234HI -execute __stmt_c_ ; -my_col -AB1234HI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234HI -execute __stmt_uv_ ; -my_col -AB1234HI -execute __stmt_uv_ ; -my_col -AB1234HI -execute __stmt_uv_ ; -my_col -AB1234HI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234HI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234HI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234HI -set @string_3= '0' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,0,'1234') as my_col ; -my_col -AB1234CDEFGHI -execute __stmt_c_ ; -my_col -AB1234CDEFGHI -execute __stmt_c_ ; -my_col -AB1234CDEFGHI -execute __stmt_c_ ; -my_col -AB1234CDEFGHI -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234CDEFGHI -execute __stmt_uv_ ; -my_col -AB1234CDEFGHI -execute __stmt_uv_ ; -my_col -AB1234CDEFGHI -execute __stmt_uv_ ; -my_col -AB1234CDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234CDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234CDEFGHI -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234CDEFGHI -set @string_3= '-1' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select INSERT('ABCDEFGHI',3,-1,'1234') as my_col ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -execute __stmt_c_ ; -my_col -AB1234 -select INSERT(@var_1 ,@var_2,@var_3,@var_4) as my_col ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_uv_ ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4 ; -my_col -AB1234 - -###### Variations on BIN(N) ###### - -set @stmt_part_1= "select BIN(" ; -set @stmt_part_2= ") as my_col" ; -set @max_var_number= 1; -set @string_1= '12' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(12) as my_col ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -select BIN(@var_1 ) as my_col ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select BIN(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -set @string_1= '2147483648' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(2147483648) as my_col ; -my_col -10000000000000000000000000000000 -execute __stmt_c_ ; -my_col -10000000000000000000000000000000 -execute __stmt_c_ ; -my_col -10000000000000000000000000000000 -execute __stmt_c_ ; -my_col -10000000000000000000000000000000 -select BIN(@var_1 ) as my_col ; -my_col -10000000000000000000000000000000 -execute __stmt_uv_ ; -my_col -10000000000000000000000000000000 -execute __stmt_uv_ ; -my_col -10000000000000000000000000000000 -execute __stmt_uv_ ; -my_col -10000000000000000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -10000000000000000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -10000000000000000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -10000000000000000000000000000000 -set @string_1= '0' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(0) as my_col ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -execute __stmt_c_ ; -my_col -0 -select BIN(@var_1 ) as my_col ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_uv_ ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -execute __stmt_ph_ using @var_1 ; -my_col -0 -set @string_1= '-1' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(-1) as my_col ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_c_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_c_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_c_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -select BIN(@var_1 ) as my_col ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_uv_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_uv_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_uv_ ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_ph_ using @var_1 ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_ph_ using @var_1 ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -execute __stmt_ph_ using @var_1 ; -my_col -1111111111111111111111111111111111111111111111111111111111111111 -set @string_1= '9000000000000000000' ; -set @type_1= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(9000000000000000000) as my_col ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_c_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_c_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_c_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -select BIN(@var_1 ) as my_col ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_uv_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_uv_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_uv_ ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -execute __stmt_ph_ using @var_1 ; -my_col -111110011100110011011000101000011100010100001000000000000000000 -set @string_1= '12.9E-0' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(12.9E-0) as my_col ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -select BIN(@var_1 ) as my_col ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -set @string_1= '0.129E+2' ; -set @type_1= 'DOUBLE' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIN(0.129E+2) as my_col ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -execute __stmt_c_ ; -my_col -1100 -select BIN(@var_1 ) as my_col ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_uv_ ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 -execute __stmt_ph_ using @var_1 ; -my_col -1100 - -###### Variations on BIT_LENGT(str) ###### - -set @stmt_part_1= "select BIT_LENGTH(" ; -set @stmt_part_2= ") as my_col" ; -set @max_var_number= 1; -set @string_1= 'text' ; -set @type_1= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIT_LENGTH('text') as my_col ; -my_col -32 -execute __stmt_c_ ; -my_col -32 -execute __stmt_c_ ; -my_col -32 -execute __stmt_c_ ; -my_col -32 -select BIT_LENGTH(@var_1 ) as my_col ; -my_col -32 -execute __stmt_uv_ ; -my_col -32 -execute __stmt_uv_ ; -my_col -32 -execute __stmt_uv_ ; -my_col -32 -execute __stmt_ph_ using @var_1 ; -my_col -32 -execute __stmt_ph_ using @var_1 ; -my_col -32 -execute __stmt_ph_ using @var_1 ; -my_col -32 -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select BIT_LENGTH(NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select BIT_LENGTH(@var_1 ) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ; -my_col -NULL - -###### Variations on CONV(N,from_base,to_base) ###### - -set @stmt_part_1= "select CONV(" ; -set @stmt_part_2= "," ; -set @stmt_part_3= "," ; -set @stmt_part_4= ") as my_col" ; -set @max_var_number= 3; -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(37,10,10) as my_col ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -set @string_1= '-37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(-37,10,10) as my_col ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -set @string_1= CAST(CAST(-37 AS unsigned INTEGER) AS CHAR); -set @type_1= 'LONGTEXT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV('18446744073709551579',10,10) as my_col ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -execute __stmt_c_ ; -my_col -18446744073709551579 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_uv_ ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -18446744073709551579 -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(37,10,-10) as my_col ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -set @string_1= '-37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(-37,10,-10) as my_col ; -my_col --37 -execute __stmt_c_ ; -my_col --37 -execute __stmt_c_ ; -my_col --37 -execute __stmt_c_ ; -my_col --37 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col --37 -execute __stmt_uv_ ; -my_col --37 -execute __stmt_uv_ ; -my_col --37 -execute __stmt_uv_ ; -my_col --37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col --37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col --37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col --37 -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,10,11) as my_col ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,11,10) as my_col ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -execute __stmt_c_ ; -my_col -9 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_uv_ ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -9 -set @string_1= '10' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(10,10,11) as my_col ; -my_col -A -execute __stmt_c_ ; -my_col -A -execute __stmt_c_ ; -my_col -A -execute __stmt_c_ ; -my_col -A -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -A -execute __stmt_uv_ ; -my_col -A -execute __stmt_uv_ ; -my_col -A -execute __stmt_uv_ ; -my_col -A -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -A -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -A -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -A -set @string_1= 'A' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV('A',11,10) as my_col ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -set @string_1= '11' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(11,10,11) as my_col ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -execute __stmt_c_ ; -my_col -10 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_uv_ ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -10 -set @string_1= '10' ; -set @type_1= 'BIGINT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(10,11,10) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '36' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(37,10,36) as my_col ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -execute __stmt_c_ ; -my_col -11 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_uv_ ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -11 -set @string_1= '11' ; -set @type_1= 'BIGINT' ; -set @string_2= '36' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(11,36,10) as my_col ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -execute __stmt_c_ ; -my_col -37 -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_uv_ ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -37 -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(NULL,10,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '37' ; -set @string_2= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(37,NULL,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_2= '10' ; -set @string_3= 'NULL' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(37,10,NULL) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_3= '10' ; -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '37' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,37,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '1' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,1,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '0' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,0,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '-1' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,-1,10) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '37' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,10,37) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '1' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,10,1) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '0' ; -set @type_2= 'BIGINT' ; -set @string_3= '0' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,0,0) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-1' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,10,-1) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-37' ; -set @type_3= 'BIGINT' ; -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -select CONV(9,10,-37) as my_col ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -execute __stmt_c_ ; -my_col -NULL -select CONV(@var_1 ,@var_2,@var_3) as my_col ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_uv_ ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3 ; -my_col -NULL diff --git a/mysql-test/r/tool_test.result b/mysql-test/r/tool_test.result deleted file mode 100644 index 7be7645d8eb..00000000000 --- a/mysql-test/r/tool_test.result +++ /dev/null @@ -1,223 +0,0 @@ -use test ; -set @stmt_part_1= 'SELECT 1 as "my_fine_statement"' ; -set @max_var_number= 0; -the content of the statement variable --------------------------------------- -@__stmt_c_ is: SELECT 1 as "my_fine_statement" -prepare __stmt_c_ from @__stmt_c_ ; -SELECT 1 as "my_fine_statement" ; -my_fine_statement -1 -execute __stmt_c_ ; -my_fine_statement -1 -execute __stmt_c_ ; -my_fine_statement -1 -execute __stmt_c_ ; -my_fine_statement -1 -set @stmt_part_1= 'SELECT ' ; -set @stmt_part_2= ' + ' ; -set @stmt_part_3= ' + ' ; -set @stmt_part_4= ' + ' ; -set @stmt_part_5= ' + ' ; -set @stmt_part_6= ' + ' ; -set @stmt_part_7= ' + ' ; -set @stmt_part_8= ' + ' ; -set @stmt_part_9= ' as "my_fine_statement"' ; -set @max_var_number= 8; -set @string_1= '1' ; -set @type_1= 'BIGINT' ; -set @string_2= 'nULL' ; -set @type_2= 'BIGINT' ; -set @string_3= '2.0' ; -set @type_3= 'DOUBLE' ; -set @string_4= 'NuLL' ; -set @type_4= 'DOUBLE' ; -set @string_5= 'TEXT' ; -set @type_5= 'LONGTEXT' ; -set @string_6= 'NUlL' ; -set @type_6= 'LONGTEXT' ; -set @string_7= 'BLOB' ; -set @type_7= 'LONGBLOB' ; -set @string_8= 'NULl' ; -set @type_8= 'LONGBLOB' ; -set @var_1= 'YYYYYYYY' ; -set @var_2= 'YYYYYYYY' ; -set @var_3= 'YYYYYYYY' ; -set @var_4= 'YYYYYYYY' ; -set @var_5= 'YYYYYYYY' ; -set @var_6= 'YYYYYYYY' ; -set @var_7= 'YYYYYYYY' ; -set @var_8= 'YYYYYYYY' ; -the content of the statement variables --------------------------------------- -@__stmt_c_ is: SELECT 1 + NULL + 2.0 + NULL + 'TEXT' + NULL + 'BLOB' + NULL as "my_fine_statement" -@__stmt_uv_ is: SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" -@__stmt_ph_ is: SELECT ? + ? + ? + ? + ? + ? + ? + ? as "my_fine_statement" -@__execute_stmt_ph is: execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 -the content of the parameter variables --------------------------------------- -type string uservariable -BIGINT 1 1 -type string uservariable -BIGINT nULL NULL -type string uservariable -DOUBLE 2.0 2 -type string uservariable -DOUBLE NuLL NULL -type string uservariable -LONGTEXT TEXT TEXT -type string uservariable -LONGTEXT NUlL NULL -type string uservariable -LONGBLOB BLOB BLOB -type string uservariable -LONGBLOB NULl NULL -@var_1 @var_2 @var_3 @var_4 @var_5 @var_6 @var_7 @var_8 -1 NULL 2 NULL TEXT NULL BLOB NULL -Table Create Table -t9 CREATE TABLE `t9` ( - `@var_1` bigint(20) default NULL, - `@var_2` bigint(20) default NULL, - `@var_3` double default NULL, - `@var_4` double default NULL, - `@var_5` longtext, - `@var_6` longtext, - `@var_7` longblob, - `@var_8` longblob -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -SELECT 1 + NULL + 2.0 + NULL + 'TEXT' + NULL + 'BLOB' + NULL as "my_fine_statement" ; -my_fine_statement -NULL -execute __stmt_c_ ; -my_fine_statement -NULL -execute __stmt_c_ ; -my_fine_statement -NULL -execute __stmt_c_ ; -my_fine_statement -NULL -SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" ; -my_fine_statement -NULL -execute __stmt_uv_ ; -my_fine_statement -NULL -execute __stmt_uv_ ; -my_fine_statement -NULL -execute __stmt_uv_ ; -my_fine_statement -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -NULL -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -NULL -set @string_1= '1.0' ; -set @type_1= 'DOUBLE' ; -set @string_2= '3.0' ; -set @type_2= 'DOUBLE' ; -set @string_3= '2' ; -set @type_3= 'BIGINT' ; -set @string_4= '4' ; -set @type_4= 'BIGINT' ; -set @string_5= '5' ; -set @type_5= 'BIGINT' ; -set @string_6= '6' ; -set @type_6= 'DOUBLE' ; -set @string_7= '7' ; -set @type_7= 'DOUBLE' ; -set @string_8= '8' ; -set @type_8= 'DOUBLE' ; -set @var_1= 'YYYYYYYY' ; -set @var_2= 'YYYYYYYY' ; -set @var_3= 'YYYYYYYY' ; -set @var_4= 'YYYYYYYY' ; -set @var_5= 'YYYYYYYY' ; -set @var_6= 'YYYYYYYY' ; -set @var_7= 'YYYYYYYY' ; -set @var_8= 'YYYYYYYY' ; -the content of the statement variables --------------------------------------- -@__stmt_c_ is: SELECT 1.0 + 3.0 + 2 + 4 + 5 + 6 + 7 + 8 as "my_fine_statement" -@__stmt_uv_ is: SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" -@__stmt_ph_ is: SELECT ? + ? + ? + ? + ? + ? + ? + ? as "my_fine_statement" -@__execute_stmt_ph is: execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 -the content of the parameter variables --------------------------------------- -type string uservariable -DOUBLE 1.0 1 -type string uservariable -DOUBLE 3.0 3 -type string uservariable -BIGINT 2 2 -type string uservariable -BIGINT 4 4 -type string uservariable -BIGINT 5 5 -type string uservariable -DOUBLE 6 6 -type string uservariable -DOUBLE 7 7 -type string uservariable -DOUBLE 8 8 -@var_1 @var_2 @var_3 @var_4 @var_5 @var_6 @var_7 @var_8 -1 3 2 4 5 6 7 8 -Table Create Table -t9 CREATE TABLE `t9` ( - `@var_1` double default NULL, - `@var_2` double default NULL, - `@var_3` bigint(20) default NULL, - `@var_4` bigint(20) default NULL, - `@var_5` bigint(20) default NULL, - `@var_6` double default NULL, - `@var_7` double default NULL, - `@var_8` double default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -prepare __stmt_c_ from @__stmt_c_ ; -prepare __stmt_uv_ from @__stmt_uv_ ; -prepare __stmt_ph_ from @__stmt_ph_ ; -SELECT 1.0 + 3.0 + 2 + 4 + 5 + 6 + 7 + 8 as "my_fine_statement" ; -my_fine_statement -36.0 -execute __stmt_c_ ; -my_fine_statement -36.0 -execute __stmt_c_ ; -my_fine_statement -36.0 -execute __stmt_c_ ; -my_fine_statement -36.0 -SELECT @var_1 + @var_2 + @var_3 + @var_4 + @var_5 + @var_6 + @var_7 + @var_8 as "my_fine_statement" ; -my_fine_statement -36 -execute __stmt_uv_ ; -my_fine_statement -36 -execute __stmt_uv_ ; -my_fine_statement -36 -execute __stmt_uv_ ; -my_fine_statement -36 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -36 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -36 -execute __stmt_ph_ using @var_1 ,@var_2,@var_3,@var_4,@var_5,@var_6,@var_7,@var_8 ; -my_fine_statement -36 diff --git a/mysql-test/t/ps_12func.test b/mysql-test/t/ps_12func.test deleted file mode 100644 index 65abffe946c..00000000000 --- a/mysql-test/t/ps_12func.test +++ /dev/null @@ -1,867 +0,0 @@ -##################### ps_12func.test ##################### -# # -# Prepared Statement tests of functions # -# # -# Non prepared variants are also checked # -# # -# Checked functions: # -# # -# ROUND(X,D) and ROUND(X) # -# CONCAT_WS(separator,str1,str2,...) # -# CHAR(N,...) # -# CHAR_LENGTH(str) # -# FIELD(str,str1,str2,str3,...) # -# INSERT(str,pos,len,newstr) # -# BIN(N) # -# BIT_LENGTH(str) # -# CONV(N,from_base,to_base) # -# # -########################################################## - -use test; - -# "--disable_abort_on_error" is definitely needed, because there are some tests -# which intentional produce statements with wrong syntax and it is not -# possible to put a "--error " just before the execution calls -# within patchwork-test.inc . ---disable_abort_on_error - -##### ROUND(X,D) ---disable_query_log -select concat('###### Variations on ROUND(X,D) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= 'select ROUND(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ') as my_col' ; -set @max_var_number= 2; - - -#------------------------------------------------------------------ -# first parameter 11.298 (DOUBLE) , ROUND( m.n , p ) m = 2 ; n = 3 -# Variations on parameter2 -#------------------------------------------------------------------ -set @string_1= '11.298' ; -set @type_1= 'DOUBLE' ; -## data type BIGINT, if possible -set @type_2= 'BIGINT' ; -# p < n -set @string_2= '1' ; ---source include/patchwork-check.inc -# p = n -set @string_2= '3' ; ---source include/patchwork-check.inc -# p > n -set @string_2= '4' ; ---source include/patchwork-check.inc -# p = 0 -set @string_2= '0' ; ---source include/patchwork-check.inc -# -p < m -set @string_2= '-1' ; ---source include/patchwork-check.inc -# -p = m -set @string_2= '-2' ; ---source include/patchwork-check.inc -# -p > m -set @string_2= '-3' ; ---source include/patchwork-check.inc -# -p = NULL -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -## data type DOUBLE, if possible -set @type_2= 'DOUBLE' ; -# p < n -set @string_2= '1.0' ; ---source include/patchwork-check.inc -# p = n -set @string_2= '3.0' ; ---source include/patchwork-check.inc -# p > n -set @string_2= '4.0' ; ---source include/patchwork-check.inc -# p = 0 -set @string_2= '0.0' ; ---source include/patchwork-check.inc -# -p < m -set @string_2= '-1.0' ; ---source include/patchwork-check.inc -# -p = m -set @string_2= '-2.0' ; ---source include/patchwork-check.inc -# -p > m -set @string_2= '-3.0' ; ---source include/patchwork-check.inc -# ugly values -set @string_2= '1.1' ; ---source include/patchwork-check.inc -set @string_2= '1.9' ; ---source include/patchwork-check.inc -# -p = NULL -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -## data type LONGBLOB, content NULL -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - - -#------------------------------------------------------------------ -# first parameter data type BIGINT, content NULL -# Variations on parameter2 -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; - -set @type_2= 'BIGINT' ; -set @string_2= '2' ; ---source include/patchwork-check.inc -set @string_2= '-2' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; ---source include/patchwork-check.inc -set @string_2= '-2.0' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - - -#------------------------------------------------------------------ -# first parameter data type DOUBLE, content NULL -# Variations on parameter2 -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'DOUBLE' ; - -set @type_2= 'BIGINT' ; -set @string_2= '2' ; ---source include/patchwork-check.inc -set @string_2= '-2' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; ---source include/patchwork-check.inc -set @string_2= '-2.0' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - - -#------------------------------------------------------------------ -# first parameter data type LONGBLOB, content NULL -# Variations on parameter2 -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; - -set @type_2= 'BIGINT' ; -set @string_2= '2' ; ---source include/patchwork-check.inc -set @string_2= '-2' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'DOUBLE' ; -set @string_2= '2.0' ; ---source include/patchwork-check.inc -set @string_2= '-2.0' ; ---source include/patchwork-check.inc -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -set @type_2= 'LONGBLOB' ; -set @string_2= 'NULL' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# ROUND(D) Returns the argument X, rounded to the nearest integer. -#------------------------------------------------------------------ -set @stmt_part_1= 'select ROUND(' ; -set @stmt_part_2= ') as my_col' ; -set @max_var_number= 1; -## test cases with BIGINT -set @string_1= '11' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '-11' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '0' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -## test cases with BIGINT -set @string_1= '11.49' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= '10.51' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= '0.0' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= 'NULL' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= '-11.49' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= '-10.51' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -## Incomplete statement -set @stmt_part_2= 'select ROUND() as my_col' ; -set @max_var_number= 0; ---source include/patchwork-check.inc - -##### CONCAT_WS(separator,str1,str2,...) -# Example: CONCAT_WS('S','My','QL') ---disable_query_log -select concat('###### Variations on CONCAT_WS(separator,str1,str2,...) ######') -as '' union select ''; ---enable_query_log -set @stmt_part_1= 'select CONCAT_WS(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ') as my_col' ; -set @max_var_number= 3; - -### common case -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -### The separator (first parameter) is NULL. -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; ---source include/patchwork-check.inc -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc - -### The first string (second parameter) is NULL. -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'NULL' ; -set @type_2= 'LONGBLOB' ; -set @string_3= 'QL' ; -set @type_3= 'LONGTEXT' ; ---source include/patchwork-check.inc -set @type_2= 'BIGINT' ; ---source include/patchwork-check.inc -set @type_2= 'DOUBLE' ; ---source include/patchwork-check.inc - -### The second string (third parameter) is NULL. -set @string_1= 'S' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'My' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'NULL' ; -set @type_3= 'LONGTEXT' ; ---source include/patchwork-check.inc -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @type_3= 'DOUBLE' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# some complicated things -#------------------------------------------------------------------ -# select concat_ws('S',IF(parameter1=NULL,parameter2,parameter3),'QL') -set @stmt_part_1= "select CONCAT_WS('S',IF(" ; -set @stmt_part_2= ' IS NULL, ' ; -set @stmt_part_3= ' , ' ; -set @stmt_part_4= "),'QL') as my_col" ; -set @max_var_number= 3; - -# common case -set @string_1= 'My' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'X' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'My' ; -set @type_3= 'LONGTEXT' ; ---source include/patchwork-check.inc - -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= 'X' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'My' ; -set @type_3= 'LONGTEXT' ; -# deactivated because of -# Bug#6297 : prepared statement, wrong handling of IS NULL -# let $__debug_= 1; -# --source include/patchwork-check.inc - -##### CHAR(N,...) -# Example(Manual): SELECT CHAR(77,121,83,81,'76'); ---disable_query_log -select concat('###### Variations on CHAR(N,...) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= 'select CHAR(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ',' ; -set @stmt_part_6= ') as my_col' ; -set @max_var_number= 5; - -### common case -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -# Only the first parameter is NULL. -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -##### ugly maybe wrong result -# Bug#6317: string function CHAR, parameter is NULL, wrong result -#--source include/patchwork-check.inc - -## Only one non first/last parameter is NULL. -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -# Bug#6317: string function CHAR, parameter is NULL, wrong result -#--source include/patchwork-check.inc - -## Two neighbour parameters in the middle are NULL. -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; -set @string_4= 'NULL' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -# Bug#6317: string function CHAR, parameter is NULL, wrong result -#--source include/patchwork-check.inc - -## Only the last parameter is NULL. -set @string_1= '77' ; -set @type_1= 'BIGINT' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= 'NULL' ; -set @type_5= 'BIGINT' ; -# Bug#6317: string function CHAR, parameter is NULL, wrong result -#--source include/patchwork-check.inc - -## The first parameter is NULL with bad type. -set @string_1= 'NULL' ; -set @type_1= 'LONGBLOB' ; -set @string_2= '121' ; -set @type_2= 'BIGINT' ; -set @string_3= '83' ; -set @type_3= 'BIGINT' ; -set @string_4= '81' ; -set @type_4= 'BIGINT' ; -set @string_5= '76' ; -set @type_5= 'BIGINT' ; -# Bug#6317: string function CHAR, parameter is NULL, wrong result -#--source include/patchwork-check.inc - - -##### CHAR_LENGTH(str) ---disable_query_log -select concat('###### Variations on CHAR_LENGTH ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= 'select CHAR_LENGTH(' ; -set @stmt_part_2= ') as my_col' ; -set @max_var_number= 1; - -### common case -set @string_1= 'MySQL' ; -set @type_1= 'LONGTEXT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; ---source include/patchwork-check.inc -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc - - -##### FIELD(str,str1,str2,str3,...) ---disable_query_log -select concat('###### Variations on FIELD(str,str1,str2,str3,...) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= 'select FIELD(' ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ') as my_col' ; -set @max_var_number= 4; - -### common case -set @string_1= 'Hit' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '1it' ; -set @type_2= 'LONGTEXT' ; -set @string_3= 'Hit' ; -set @type_3= 'LONGTEXT' ; -set @string_4= '3it' ; -set @type_4= 'LONGTEXT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -# string to search for is NULL, all other strings not NULL -set @string_1= 'NULL' ; -# Bug#6321: strange error, string function FIELD(, .. ---source include/patchwork-check.inc -# string to search for and one of the other is NULL -set @string_3= 'NULL' ; -# Bug#6321: strange error, string function FIELD(, .. ---source include/patchwork-check.inc - - -##### INSERT(str,pos,len,newstr) -# Manual Example: SELECT INSERT('Quadratic', 3, 4, 'What') -> 'QuWhattic' ---disable_query_log -select concat('###### Variations on INSERT(str,pos,len,newstr) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= "select INSERT(" ; -set @stmt_part_2= ',' ; -set @stmt_part_3= ',' ; -set @stmt_part_4= ',' ; -set @stmt_part_5= ") as my_col" ; -set @max_var_number= 4; - -### common case (modified manual example) -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# Try DOUBLE instead of BIGINT for pos and len -#------------------------------------------------------------------ -set @string_2= '+30.0E-1' ; -set @type_2= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '+40.0E-1' ; -set @type_3= 'DOUBLE' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; ---source include/patchwork-check.inc -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= 'NULL' ; -set @type_2= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= 'NULL' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= 'NULL' ; -set @type_4= 'LONGTEXT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# Variations on the second parameter (start position) -#------------------------------------------------------------------ -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -# start position > length of the first string (9) -set @string_2= '15' ; ---source include/patchwork-check.inc -# start position = 0 -set @string_2= '0' ; ---source include/patchwork-check.inc -# start position < 0 -set @string_2= '-1' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# Variations on the third parameter (# of chars of string one to be replaced) -#------------------------------------------------------------------ -set @string_1= 'ABCDEFGHI' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '3' ; -set @type_2= 'BIGINT' ; -set @string_3= '4' ; -set @type_3= 'BIGINT' ; -set @string_4= '1234' ; -set @type_4= 'LONGTEXT' ; -## chars to be replaced > length of the second string -# start pos (3) + replace length(10) > length of first string(9) -set @string_3= '10' ; ---source include/patchwork-check.inc -# start pos (3) + chars to be replaced (5) < length of first string(9) -set @string_3= '5' ; ---source include/patchwork-check.inc -# chars to be replaced = 0 -set @string_3= '0' ; ---source include/patchwork-check.inc -# chars to be replaced < 0 -set @string_3= '-1' ; ---source include/patchwork-check.inc - - -##### BIN(N) -# manual example: SELECT BIN(12); -> '1100' ---disable_query_log -select concat('###### Variations on BIN(N) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= "select BIN(" ; -set @stmt_part_2= ") as my_col" ; -set @max_var_number= 1; - -set @string_1= '12' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -#### Variations on the parameter -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '2147483648' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '0' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '-1' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9000000000000000000' ; -set @type_1= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '12.9E-0' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc -set @string_1= '0.129E+2' ; -set @type_1= 'DOUBLE' ; ---source include/patchwork-check.inc - -##### BIT_LENGTH(str) -# Manual example: SELECT BIT_LENGTH('text'); -> 32 ---disable_query_log -select concat('###### Variations on BIT_LENGT(str) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= "select BIT_LENGTH(" ; -set @stmt_part_2= ") as my_col" ; -set @max_var_number= 1; - -set @string_1= 'text' ; -set @type_1= 'LONGTEXT' ; ---source include/patchwork-check.inc - -# try NULL -set @string_1= 'NULL' ; -set @type_1= 'LONGTEXT' ; ---source include/patchwork-check.inc - - -##### CONV(N,from_base,to_base) -# Manual example: SELECT CONV(-17,10,-18); -> '-H' ---disable_query_log -select concat('###### Variations on CONV(N,from_base,to_base) ######') as '' -union select ''; ---enable_query_log -set @stmt_part_1= "select CONV(" ; -set @stmt_part_2= "," ; -set @stmt_part_3= "," ; -set @stmt_part_4= ") as my_col" ; -set @max_var_number= 3; - -#------------------------------------------------------------------ -# Manual: If to_base is a negative number, N is regarded as a signed number. -# Otherwise, N is treated as unsigned. -# Experiments with positive/negative number/to_base -#------------------------------------------------------------------ -# number positive written, to_base positive -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -# number negative written, to_base positive -set @string_1= '-37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -# The last result (unsigned) BIGINT 18446744073709551579 might be surprising. -# The next statements could give an explanation. -set @string_1= CAST(CAST(-37 AS unsigned INTEGER) AS CHAR); -set @type_1= 'LONGTEXT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -# number positive written, to_base negative -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -# number negative written, to_base negative -set @string_1= '-37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# conversions to and from the exotic 11 based number system -#------------------------------------------------------------------ -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '10' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= 'A' ; -set @type_1= 'LONGTEXT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '11' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '11' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '10' ; -set @type_1= 'BIGINT' ; -set @string_2= '11' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# Try the maximum base value 36 -#------------------------------------------------------------------ -set @string_1= '37' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '36' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '11' ; -set @type_1= 'BIGINT' ; -set @string_2= '36' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# NULL at different parameter positions -#------------------------------------------------------------------ -set @string_1= 'NULL' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '37' ; -set @string_2= 'NULL' ; ---source include/patchwork-check.inc -set @string_2= '10' ; -set @string_3= 'NULL' ; ---source include/patchwork-check.inc -set @string_3= '10' ; - -#------------------------------------------------------------------ -# The rule for from_base is: 2 <= from_base <= 36 -# Try values outside of this range. -#------------------------------------------------------------------ -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '37' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '1' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '0' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '-1' ; -set @type_2= 'BIGINT' ; -set @string_3= '10' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc - -#------------------------------------------------------------------ -# The rule for to_base is: 2<= ABS(to_base) <= 36 -# Try values outside of this range. -#------------------------------------------------------------------ -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '37' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '1' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '0' ; -set @type_2= 'BIGINT' ; -set @string_3= '0' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-1' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc -set @string_1= '9' ; -set @type_1= 'BIGINT' ; -set @string_2= '10' ; -set @type_2= 'BIGINT' ; -set @string_3= '-37' ; -set @type_3= 'BIGINT' ; ---source include/patchwork-check.inc - - diff --git a/mysql-test/t/tool_test.test b/mysql-test/t/tool_test.test deleted file mode 100644 index b28eae2c17d..00000000000 --- a/mysql-test/t/tool_test.test +++ /dev/null @@ -1,105 +0,0 @@ -########################### tool_test.test ############################# -# # -# Test sequences for the check of mysqltest based test tools # -# # -# Checked routines: # -# include/patchwork-check.inc # -# # -######################################################################## - -##### Check of include/patchwork-check.inc -# -use test ; ---disable_abort_on_error - -#----------------------------------------------------------------------- -# Simple test (special case): -# The statement is made of only one piece and does not contain variables. -#----------------------------------------------------------------------- -set @stmt_part_1= 'SELECT 1 as "my_fine_statement"' ; -set @max_var_number= 0; -# switch debug output on (Attention: patchwork-check.inc will switch it off) -let $__debug_= 1; ---source include/patchwork-check.inc - -#----------------------------------------------------------------------- -# Test case with many statement pieces and variables of all in -# include/patchwork-check.inc available data types. -#----------------------------------------------------------------------- -set @stmt_part_1= 'SELECT ' ; -set @stmt_part_2= ' + ' ; -set @stmt_part_3= ' + ' ; -set @stmt_part_4= ' + ' ; -set @stmt_part_5= ' + ' ; -set @stmt_part_6= ' + ' ; -set @stmt_part_7= ' + ' ; -set @stmt_part_8= ' + ' ; -set @stmt_part_9= ' as "my_fine_statement"' ; -set @max_var_number= 8; - -set @string_1= '1' ; -set @type_1= 'BIGINT' ; -set @string_2= 'nULL' ; -set @type_2= 'BIGINT' ; -set @string_3= '2.0' ; -set @type_3= 'DOUBLE' ; -set @string_4= 'NuLL' ; -set @type_4= 'DOUBLE' ; -set @string_5= 'TEXT' ; -set @type_5= 'LONGTEXT' ; -set @string_6= 'NUlL' ; -set @type_6= 'LONGTEXT' ; -set @string_7= 'BLOB' ; -set @type_7= 'LONGBLOB' ; -set @string_8= 'NULl' ; -set @type_8= 'LONGBLOB' ; - -# Initialization of all uservariables to the data type LONGTEXT and content, -# which will not be repeated within the following tests. -# 'include/patchwork-check.inc' MUST destroy all these settings. -# That is why this initialization is NOT needed within test cases -# calling include/patchwork-check.inc . -set @var_1= 'YYYYYYYY' ; -set @var_2= 'YYYYYYYY' ; -set @var_3= 'YYYYYYYY' ; -set @var_4= 'YYYYYYYY' ; -set @var_5= 'YYYYYYYY' ; -set @var_6= 'YYYYYYYY' ; -set @var_7= 'YYYYYYYY' ; -set @var_8= 'YYYYYYYY' ; - -# switch debug output on (Attention: patchwork-check.inc will switch it off) -let $__debug_= 1; ---source include/patchwork-check.inc - -### Execute the statement with more useful content of the variables. -set @string_1= '1.0' ; -set @type_1= 'DOUBLE' ; -set @string_2= '3.0' ; -set @type_2= 'DOUBLE' ; -set @string_3= '2' ; -set @type_3= 'BIGINT' ; -set @string_4= '4' ; -set @type_4= 'BIGINT' ; -set @string_5= '5' ; -set @type_5= 'BIGINT' ; -set @string_6= '6' ; -set @type_6= 'DOUBLE' ; -set @string_7= '7' ; -set @type_7= 'DOUBLE' ; -set @string_8= '8' ; -set @type_8= 'DOUBLE' ; - -# Initialization -set @var_1= 'YYYYYYYY' ; -set @var_2= 'YYYYYYYY' ; -set @var_3= 'YYYYYYYY' ; -set @var_4= 'YYYYYYYY' ; -set @var_5= 'YYYYYYYY' ; -set @var_6= 'YYYYYYYY' ; -set @var_7= 'YYYYYYYY' ; -set @var_8= 'YYYYYYYY' ; - -# switch debug output on (Attention: include/patchwork-check.inc switches it off) -let $__debug_= 1; ---source include/patchwork-check.inc From 9a202517f562adc467e0b461d898bbcd6edee77a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Dec 2004 23:37:43 +0100 Subject: [PATCH 10/20] Fix for BUG#7358: removing warning reporting of mysqldump 4.1.8 when calling SHOW CREATE DATABASE, as we deal almost gracefully with it (back to behaviour of 4.1.7). Warning was not fatal: mysqldump continued. And the good thing is that it helped spot that starting from 4.1.7, SHOW CREATE DATABASE failed (if --single-transaction and first db has non-empty InnoDB table and there is a second db) and thus mysqldump produced CREATE DATABASE statements missing the CHARACTER SET clause. Removing the bug which was in the server, and the warning reporting in mysqldump (compatibility with old servers). client/mysqldump.c: don't report errors as we deal almost gracefully with them (back to code of 4.1.7) mysql-test/r/flush_block_commit.result: result update mysql-test/t/flush_block_commit.test: let's verify that SHOW CREATE DATABASE succeeds even if connection has open transaction. sql/sql_parse.cc: There is no reason to forbid SHOW CREATE DATABASE if connection has an open transaction --- client/mysqldump.c | 2 +- mysql-test/r/flush_block_commit.result | 8 ++++++++ mysql-test/t/flush_block_commit.test | 8 ++++++++ sql/sql_parse.cc | 5 ----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 11892a3458f..c36f9d3e23e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1914,7 +1914,7 @@ static int init_dumping(char *database) sprintf(qbuf,"SHOW CREATE DATABASE IF NOT EXISTS %s", qdatabase); - if (mysql_query_with_error_report(sock, &dbinfo, qbuf)) + if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) { /* Old server version, dump generic CREATE DATABASE */ fprintf(md_result_file, diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result index 4a7575d8f7a..2e9f1920937 100644 --- a/mysql-test/r/flush_block_commit.result +++ b/mysql-test/r/flush_block_commit.result @@ -28,4 +28,12 @@ commit; unlock tables; flush tables with read lock; unlock tables; +begin; +select * from t1; +a +1 +10 +show create database test; +Database Create Database +test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ drop table t1; diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test index ac14b7b98bc..87715452089 100644 --- a/mysql-test/t/flush_block_commit.test +++ b/mysql-test/t/flush_block_commit.test @@ -1,6 +1,7 @@ # Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing # transactions. # We verify that we did not introduce a deadlock. +# This is intended to mimick how mysqldump and innobackup work. -- source include/have_innodb.inc @@ -63,4 +64,11 @@ unlock tables; connection con2; flush tables with read lock; # bug caused hang here unlock tables; + +# BUG#7358 SHOW CREATE DATABASE fails if open transaction + +begin; +select * from t1; +show create database test; + drop table t1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8dc1339993e..55d26a68116 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3249,11 +3249,6 @@ purposes internal to the MySQL server", MYF(0)); } if (check_access(thd,SELECT_ACL,lex->name,0,1,0)) break; - if (thd->locked_tables || thd->active_transaction()) - { - send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); - goto error; - } res=mysqld_show_create_db(thd,lex->name,&lex->create_info); break; } From 4f9a0a06a8d60d68022fb813b59df8aacd5e4460 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 02:07:32 +0000 Subject: [PATCH 11/20] Bug#7391 - Multi-table UPDATE security regression Add in missing privilege checks. Tests for the privileges. mysql-test/r/grant.result: Bug#7391 - Multi-table UPDATE security regression Tests column, table and db level access mysql-test/t/grant.test: Bug#7391 - Multi-table UPDATE security regression Tests column, table and db level access sql/sql_update.cc: Bug#7391 - Multi-table UPDATE security regression Add in missing privilege checks. --- mysql-test/r/grant.result | 64 ++++++++++++++++++++++++++++++++++ mysql-test/t/grant.test | 72 +++++++++++++++++++++++++++++++++++++++ sql/sql_update.cc | 20 +++++++++++ 3 files changed, 156 insertions(+) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index f0e5d16e916..2a433e3d5db 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -156,3 +156,67 @@ select host,db,user,select_priv,insert_priv from mysql.db where db="db6123"; host db user select_priv insert_priv delete from mysql.user where user='test6123'; drop database db6123; +create database mysqltest_1; +create database mysqltest_2; +create table mysqltest_1.t1 select 1 a, 2 q; +create table mysqltest_1.t2 select 1 b, 2 r; +create table mysqltest_2.t1 select 1 c, 2 s; +create table mysqltest_2.t2 select 1 d, 2 t; +grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; +grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; +grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; +grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; +show grants for mysqltest_3@localhost; +Grants for mysqltest_3@localhost +GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' +GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost' +GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost' +GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost' +GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost' +update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; +UPDATE command denied to user: 'mysqltest_3@localhost' for column 'q' in table 't1' +update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; +select command denied to user: 'mysqltest_3@localhost' for table 't1' +update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; +UPDATE command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1' +update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; +SELECT command denied to user: 'mysqltest_3@localhost' for column 's' in table 't1' +update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; +update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; +select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; +a q b r +10 2 1 2 +select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; +c s d t +1 2 10 2 +revoke all on mysqltest_1.t1 from mysqltest_3@localhost; +revoke all on mysqltest_1.t2 from mysqltest_3@localhost; +revoke all on mysqltest_2.t1 from mysqltest_3@localhost; +revoke all on mysqltest_2.t2 from mysqltest_3@localhost; +grant all on mysqltest_2.* to mysqltest_3@localhost; +grant select on *.* to mysqltest_3@localhost; +flush privileges; +use mysqltest_1; +update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; +update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; +UPDATE command denied to user: 'mysqltest_3@localhost' for column 'a' in table 't1' +use mysqltest_2; +update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; +Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1' +update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; +Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1' +update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; +Access denied for user: 'mysqltest_3@localhost' to database 'mysqltest_1' +select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; +a q b r +10 2 1 2 +select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; +c s d t +500 2 600 2 +delete from mysql.user where user='mysqltest_3'; +delete from mysql.db where user="mysqltest_3"; +delete from mysql.tables_priv where user="mysqltest_3"; +delete from mysql.columns_priv where user="mysqltest_3"; +flush privileges; +drop database mysqltest_1; +drop database mysqltest_2; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 21173a356ce..d9b4be04de3 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -2,6 +2,8 @@ drop table if exists t1; --enable_warnings +connect (master,localhost,root,,); +connection master; # # Test that SSL options works properly # @@ -114,3 +116,73 @@ grant usage on db6123.* to test6123 identified by 'magic123'; select host,db,user,select_priv,insert_priv from mysql.db where db="db6123"; delete from mysql.user where user='test6123'; drop database db6123; + +# +# Bug#7391: Cross-database multi-table UPDATE security problem +# +create database mysqltest_1; +create database mysqltest_2; +create table mysqltest_1.t1 select 1 a, 2 q; +create table mysqltest_1.t2 select 1 b, 2 r; +create table mysqltest_2.t1 select 1 c, 2 s; +create table mysqltest_2.t2 select 1 d, 2 t; + +#test the column privileges +grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; +grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; +grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; +grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; +connect (conn1,localhost,mysqltest_3,,); +connection conn1; +show grants for mysqltest_3@localhost; +--error 1143 +update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; +--error 1142 +update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; +--error 1143 +update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; +--error 1143 +update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; +#the following two should work +update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; +update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; +connection master; +select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; +select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; +revoke all on mysqltest_1.t1 from mysqltest_3@localhost; +revoke all on mysqltest_1.t2 from mysqltest_3@localhost; +revoke all on mysqltest_2.t1 from mysqltest_3@localhost; +revoke all on mysqltest_2.t2 from mysqltest_3@localhost; + +#test the db/table level privileges +grant all on mysqltest_2.* to mysqltest_3@localhost; +grant select on *.* to mysqltest_3@localhost; +flush privileges; +disconnect conn1; +connect (conn2,localhost,mysqltest_3,,); +connection conn2; +use mysqltest_1; +update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; +# the following failed before, should fail now. +--error 1143 +update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; +use mysqltest_2; +#the following used to succeed, it must fail now. +--error 1044 +update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; +--error 1044 +update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; +--error 1044 +update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; +#lets see the result +connection master; +select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; +select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; + +delete from mysql.user where user='mysqltest_3'; +delete from mysql.db where user="mysqltest_3"; +delete from mysql.tables_priv where user="mysqltest_3"; +delete from mysql.columns_priv where user="mysqltest_3"; +flush privileges; +drop database mysqltest_1; +drop database mysqltest_2; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index cdcc90e8651..f7355f2e9b6 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -465,21 +465,34 @@ int mysql_multi_update(THD *thd, */ for (tl= table_list ; tl ; tl=tl->next) { + TABLE_LIST *save= tl->next; TABLE *table= tl->table; + uint wants; + tl->next= 0; if (update_map & table->map) { DBUG_PRINT("info",("setting table `%s` for update", tl->alias)); tl->lock_type= thd->lex.lock_option; tl->updating= 1; + wants= UPDATE_ACL; } else { DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias)); tl->lock_type= TL_READ; tl->updating= 0; + wants= SELECT_ACL; } if (!using_lock_tables) tl->table->reginfo.lock_type= tl->lock_type; + + if (check_access(thd, wants, tl->db, &tl->grant.privilege, 0, 0) || + (grant_option && check_grant(thd, wants, tl, 0, 0))) + { + tl->next= save; + DBUG_RETURN(0); + } + tl->next= save; } /* Relock the tables with the correct modes */ @@ -541,6 +554,13 @@ int mysql_multi_update(THD *thd, } } + /* + If we have no WHERE clause, make it true otherwise the Select + examines the privileges + */ + if (!conds) + conds= new Item_int("1", 1LL, 1); + if (!(result=new multi_update(thd, table_list, fields, values, handle_duplicates))) DBUG_RETURN(-1); From c6be66530a1391c88b250c6212fb8a26084778c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 02:34:11 +0000 Subject: [PATCH 12/20] Remove bogus lines --- sql/sql_update.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f7355f2e9b6..4f7e34ec74f 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -554,13 +554,6 @@ int mysql_multi_update(THD *thd, } } - /* - If we have no WHERE clause, make it true otherwise the Select - examines the privileges - */ - if (!conds) - conds= new Item_int("1", 1LL, 1); - if (!(result=new multi_update(thd, table_list, fields, values, handle_duplicates))) DBUG_RETURN(-1); From c892bc8beabfd218ae99bcd93a23b5c02849ff7f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Dec 2004 22:25:35 -0500 Subject: [PATCH 13/20] my-innodb-heavy-4G.cnf.sh: I fixed the typos in the transaction-isolation comments. I fixed the spelling mistakes in the comment. It had tripped up a support customer as they couldn't start the server with transaction-isolation= read-commited support-files/my-innodb-heavy-4G.cnf.sh: I fixed the typos in the transaction-isolation comments. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + support-files/my-innodb-heavy-4G.cnf.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index f4e5f08ae63..c5d9551ebf1 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -104,6 +104,7 @@ magnus@neptunus.(none) magnus@shellback.(none) marko@hundin.mysql.fi mats@mysql.com +matt@booty.(none) matt@mysql.com matthias@three.local.lan miguel@hegel.(none) diff --git a/support-files/my-innodb-heavy-4G.cnf.sh b/support-files/my-innodb-heavy-4G.cnf.sh index 6def311f474..062d106ce6a 100644 --- a/support-files/my-innodb-heavy-4G.cnf.sh +++ b/support-files/my-innodb-heavy-4G.cnf.sh @@ -177,7 +177,7 @@ default_table_type = MYISAM thread_stack = 192K # Set the default transaction isolation level. Levels available are: -# READ-UNCOMMITED, READ-COMMITED, REPEATABLE-READ, SERIALIZABLE +# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE transaction_isolation = REPEATABLE-READ # Maximum size for internal (in-memory) temporary tables. If a table From 2ca011d4608bac018986e0509c9d74ddafca50ec Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 13:45:19 +0200 Subject: [PATCH 14/20] Simplify code during review --- sql/sql_select.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2df0d45f8ed..eda4ce73186 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4951,10 +4951,7 @@ join_read_system(JOIN_TAB *tab) table->file->print_error(error,MYF(0)); return 1; } - if (tab->on_expr) - mark_as_null_row(tab->table); - else - table->null_row=1; // Why do this for inner join? + mark_as_null_row(tab->table); empty_record(table); // Make empty record return -1; } @@ -4984,10 +4981,7 @@ join_read_const(JOIN_TAB *tab) } if (error) { - if (tab->on_expr) - mark_as_null_row(tab->table); - else - table->null_row=1; + mark_as_null_row(tab->table); empty_record(table); if (error != HA_ERR_KEY_NOT_FOUND) { From 63e472550347b990d26f92af1e874a57bf0a6201 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 11:57:17 +0000 Subject: [PATCH 15/20] Fix test --- mysql-test/r/update.result | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 2d0903a4dae..7810d52d156 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -203,7 +203,6 @@ colC colA colD colE colF 3 4433 10005 492 500 DROP TABLE t1; DROP TABLE t2; -drop table if exists t1, t2; create table t1 (c1 int, c2 char(6), c3 int); create table t2 (c1 int, c2 char(6)); insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20); From b1eb45210bc2259cec791252259f2496d70a7161 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 15:15:41 +0000 Subject: [PATCH 16/20] Fix test results --- mysql-test/r/grant.result | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 38f7ca13a4b..d6d5a3e99ea 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -359,13 +359,13 @@ GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost' GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost' GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost' update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; -ERROR 42000: UPDATE command denied to user 'mysqltest_3@localhost' for column 'q' in table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1' update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; -ERROR 42000: SELECT command denied to user 'mysqltest_3@localhost' for column 'd' in table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2' update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; -ERROR 42000: UPDATE command denied to user 'mysqltest_3@localhost' for column 'c' in table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; -ERROR 42000: SELECT command denied to user 'mysqltest_3@localhost' for column 's' in table 't1' +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1' update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; @@ -384,14 +384,14 @@ flush privileges; use mysqltest_1; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; -ERROR 42000: UPDATE command denied to user 'mysqltest_3@localhost' for column 'a' in table 't1' +ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1' use mysqltest_2; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; -ERROR 42000: Access denied for user 'mysqltest_3@localhost' to database 'mysqltest_1' +ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; -ERROR 42000: Access denied for user 'mysqltest_3@localhost' to database 'mysqltest_1' +ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; -ERROR 42000: Access denied for user 'mysqltest_3@localhost' to database 'mysqltest_1' +ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1' select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; a q b r 10 2 1 2 From d8432ada2c6b4a7550e17053d3824736ee75ddea Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 14:22:20 -0600 Subject: [PATCH 17/20] fill_help_tables.sh: Convert @samp{c} to 'c', not c. scripts/fill_help_tables.sh: Convert @samp{c} to 'c', not c. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + scripts/fill_help_tables.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c5d9551ebf1..782259dea02 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -159,6 +159,7 @@ nick@nick.leippe.com papa@gbichot.local patg@krsna.patg.net paul@central.snake.net +paul@frost.snake.net paul@ice.local paul@ice.snake.net paul@kite-hub.kitebird.com diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh index 51edfc8af78..fbe7c597b34 100644 --- a/scripts/fill_help_tables.sh +++ b/scripts/fill_help_tables.sh @@ -203,7 +203,7 @@ sub prepare_name $a =~ s/\@command\{((.|\n)+?)\}/$1/go; $a =~ s/\@code\{((.|\n)+?)\}/$1/go; $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/$1/go; + $a =~ s/\@samp\{(.+?)\}/'$1'/go; $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; @@ -254,7 +254,7 @@ sub prepare_description $a =~ s/\@command\{((.|\n)+?)\}/$1/go; $a =~ s/\@code\{((.|\n)+?)\}/$1/go; $a =~ s/\@strong\{(.+?)\}/$1/go; - $a =~ s/\@samp\{(.+?)\}/$1/go; + $a =~ s/\@samp\{(.+?)\}/'$1'/go; $a =~ s/\@emph\{((.|\n)+?)\}/\/$1\//go; $a =~ s/\@xref\{((.|\n)+?)\}/See also : [$1]/go; $a =~ s/\@ref\{((.|\n)+?)\}/[$1]/go; From b824756c00b235bc6825d561c833ffed2f2e0d38 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Dec 2004 14:30:00 -0600 Subject: [PATCH 18/20] mysql.cc: Fix up mysql help messages. client/mysql.cc: Fix up mysql help messages. --- client/mysql.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 8e9dd84c8f0..0ea0f10f5d7 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1677,7 +1677,7 @@ static int com_server_help(String *buffer __attribute__((unused)), if (num_fields == 2) { put_info("Many help items for your request exist.", INFO_INFO); - put_info("To make a more specific request, please type 'help ',\nwhere item is one of the following", INFO_INFO); + put_info("To make a more specific request, please type 'help ',\nwhere is one of the following", INFO_INFO); num_name= 0; num_cat= 1; last_char= '_'; @@ -1685,7 +1685,7 @@ static int com_server_help(String *buffer __attribute__((unused)), else if ((cur= mysql_fetch_row(result))) { tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]); - put_info("For more information, type 'help ', where item is one of the following", INFO_INFO); + put_info("For more information, type 'help ', where is one of the following", INFO_INFO); num_name= 1; num_cat= 2; print_help_item(&cur,1,2,&last_char); From 6cbcd3423afd72961d7f04c5536426ba92e24db8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 19 Dec 2004 20:28:52 +0300 Subject: [PATCH 19/20] Fix assertion failure in client_test when linked with the embedded library: stmt_update_metadata (used when we update max_length in mysql_stmt_store_result) needs valid row->length. libmysqld/lib_sql.cc: row->length is asserted to be valid in stmt_update_metadata --- libmysqld/lib_sql.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 8092d87b97c..917bcada564 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -710,6 +710,7 @@ bool Protocol_prep::write() } cur->data= (MYSQL_ROW)(((char *)cur) + sizeof(MYSQL_ROWS)); memcpy(cur->data, packet->ptr()+1, packet->length()-1); + cur->length= packet->length(); /* To allow us to do sanity checks */ *data->prev_ptr= cur; data->prev_ptr= &cur->next; From 8c01aba776c21448f1f10be51200cd2d1ebd2ab5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Dec 2004 12:36:14 +0100 Subject: [PATCH 20/20] added config parameter Group on connection moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection moved all private things to impl class added opts for shared memory and node selection changed opts handling somewhat; introduced enum for options and common handling of option variables added checks for transporter support automatic addition of shared mem transporters moved wait_until_ready code to cluster connection added control of usage of new node selection method ndb/include/mgmapi/mgmapi_config_parameters.h: added config parameter Group on connection ndb/include/ndbapi/Ndb.hpp: moved NdbWaiter, m_ndb_cluster_connection, to impl class moved node selection things to cluster connection ndb/include/ndbapi/ndb_cluster_connection.hpp: moved all private things to impl class ndb/include/util/ndb_opts.h: added opts for shared memory and node selection ndb/src/kernel/vm/Configuration.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmclient/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/mgmsrv/ConfigInfo.cpp: added checks for transporter support automatic addition of shared mem transporters ndb/src/mgmsrv/MgmtSrvr.cpp: in alloc node id first choose connection with specified hostname ndb/src/mgmsrv/main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/src/ndbapi/DictCache.hpp: added include file ndb/src/ndbapi/Ndb.cpp: enabled using new node selection method moved wait_until_ready code to cluster connection moved node selection (hint) to cluster connection removed start transaction dgroup ndb/src/ndbapi/NdbDictionaryImpl.hpp: removed and added inclusde files ndb/src/ndbapi/NdbImpl.hpp: moved things from Ndb into Impl class moved waiter things to new file NdbWaiter.hpp ndb/src/ndbapi/NdbScanOperation.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbif.cpp: ndbwaiter is no in impl class ndb/src/ndbapi/Ndbinit.cpp: moved some Ndb things into impl class ndb/src/ndbapi/TransporterFacade.hpp: changed friend declaration ndb/src/ndbapi/ndb_cluster_connection.cpp: moved node selection things to cluster connection moved things from cluster connection to cluster connection impl class ndb/test/ndbapi/testNdbApi.cpp: removed start transaction dgroup ndb/tools/delete_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/desc.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_index.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/drop_tab.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/listTables.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/restore/restore_main.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_all.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/select_count.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables ndb/tools/waiter.cpp: changed opts handling somewhat; introduced enum for options and common handling of option variables sql/ha_ndbcluster.cc: added control of usage of new node selection method sql/mysqld.cc: added control of usage of new node selection method --- ndb/include/mgmapi/mgmapi_config_parameters.h | 1 + ndb/include/ndbapi/Ndb.hpp | 83 --- ndb/include/ndbapi/ndb_cluster_connection.hpp | 31 +- ndb/include/util/ndb_opts.h | 77 ++- ndb/src/kernel/vm/Configuration.cpp | 12 +- ndb/src/mgmclient/main.cpp | 6 +- ndb/src/mgmsrv/ConfigInfo.cpp | 184 +++++- ndb/src/mgmsrv/MgmtSrvr.cpp | 15 + ndb/src/mgmsrv/main.cpp | 56 +- ndb/src/ndbapi/DictCache.hpp | 1 + ndb/src/ndbapi/Ndb.cpp | 266 ++------ ndb/src/ndbapi/NdbDictionaryImpl.hpp | 2 +- ndb/src/ndbapi/NdbImpl.hpp | 75 +-- ndb/src/ndbapi/NdbScanOperation.cpp | 16 +- ndb/src/ndbapi/NdbWaiter.hpp | 102 +++ ndb/src/ndbapi/Ndbif.cpp | 56 +- ndb/src/ndbapi/Ndbinit.cpp | 36 +- ndb/src/ndbapi/TransporterFacade.hpp | 2 +- ndb/src/ndbapi/ndb_cluster_connection.cpp | 618 +++++++++++++++--- .../ndbapi/ndb_cluster_connection_impl.hpp | 100 +++ ndb/test/ndbapi/testNdbApi.cpp | 8 + ndb/tools/delete_all.cpp | 6 +- ndb/tools/desc.cpp | 6 +- ndb/tools/drop_index.cpp | 6 +- ndb/tools/drop_tab.cpp | 6 +- ndb/tools/listTables.cpp | 8 +- ndb/tools/restore/restore_main.cpp | 5 +- ndb/tools/select_all.cpp | 6 +- ndb/tools/select_count.cpp | 6 +- ndb/tools/waiter.cpp | 6 +- sql/ha_ndbcluster.cc | 21 +- sql/mysqld.cc | 46 +- 32 files changed, 1242 insertions(+), 627 deletions(-) create mode 100644 ndb/src/ndbapi/NdbWaiter.hpp create mode 100644 ndb/src/ndbapi/ndb_cluster_connection_impl.hpp diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 6a0cd376355..406bdb1a110 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -110,6 +110,7 @@ #define CFG_CONNECTION_SERVER_PORT 406 #define CFG_CONNECTION_HOSTNAME_1 407 #define CFG_CONNECTION_HOSTNAME_2 408 +#define CFG_CONNECTION_GROUP 409 #define CFG_TCP_SERVER 452 #define CFG_TCP_SEND_BUFFER_SIZE 454 diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp index 1c9c2db5d6b..766409d64e2 100644 --- a/ndb/include/ndbapi/Ndb.hpp +++ b/ndb/include/ndbapi/Ndb.hpp @@ -901,23 +901,6 @@ typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*); NDB_MAX_SCHEMA_NAME_SIZE + \ NDB_MAX_TAB_NAME_SIZE*2 -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL -class NdbWaiter { -public: - NdbWaiter(); - ~NdbWaiter(); - - void wait(int waitTime); - void nodeFail(Uint32 node); - void signal(Uint32 state); - - Uint32 m_node; - Uint32 m_state; - void * m_mutex; - struct NdbCondition * m_condition; -}; -#endif - /** * @class Ndb * @brief Represents the NDB kernel and is the main class of the NDB API. @@ -1199,39 +1182,6 @@ public: const char * keyData = 0, Uint32 keyLen = 0); -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - /** - * This method is a modification of Ndb::startTransaction, - * in which we use only the first two chars of keyData to - * select transaction coordinator. - * This is referred to as a distribution group. - * There are two ways to use the method: - * - In the first, the two characters are used directly as - * the distribution key, and - * - in the second the distribution is calculated as: - * (10 * (char[0] - 0x30) + (char[1] - 0x30)). - * Thus, in the second way, the two ASCII digits '78' - * will provide the distribution key = 78. - * - * @note Transaction priorities are not yet supported. - * - * @param aPrio Priority of the transaction.
- * Priority 0 is the highest priority and is used for short transactions - * with requirements on low delay.
- * Priority 1 is a medium priority for short transactions.
- * Priority 2 is a medium priority for long transactions.
- * Priority 3 is a low priority for long transactions. - * @param keyData is a string of which the two first characters - * is used to compute which fragement the data is stored in. - * @param type is the type of distribution group.
- * 0 means direct usage of the two characters, and
- * 1 means the ASCII digit variant. - * @return NdbConnection, or NULL if it failed. - */ - NdbConnection* startTransactionDGroup(Uint32 aPrio, - const char * keyData, int type); -#endif - /** * When a transactions is completed, the transaction has to be closed. * @@ -1586,8 +1536,6 @@ private: /****************************************************************************** * These are the private variables in this class. *****************************************************************************/ - Ndb_cluster_connection *m_ndb_cluster_connection; - NdbConnection** thePreparedTransactionsArray; NdbConnection** theSentTransactionsArray; NdbConnection** theCompletedTransactionsArray; @@ -1601,8 +1549,6 @@ private: Uint32 theNextConnectNode; - NdbWaiter theWaiter; - bool fullyQualifiedNames; // Ndb database name. @@ -1658,35 +1604,6 @@ private: InitConfigError } theInitState; - /** - * Computes fragement id for primary key - * - * Note that keydata has to be "shaped" as it is being sent in KEYINFO - */ - Uint32 computeFragmentId(const char * keyData, Uint32 keyLen); - Uint32 getFragmentId(Uint32 hashValue); - - /** - * Make a guess to which node is the primary for the fragment - */ - Uint32 guessPrimaryNode(Uint32 fragmentId); - - /** - * Structure containing values for guessing primary node - */ - struct StartTransactionNodeSelectionData { - StartTransactionNodeSelectionData(): - fragment2PrimaryNodeMap(0) {}; - Uint32 kValue; - Uint32 hashValueMask; - Uint32 hashpointerValue; - Uint32 noOfFragments; - Uint32 * fragment2PrimaryNodeMap; - - void init(Uint32 noOfNodes, Uint8 nodeIds[]); - void release(); - } startTransactionNodeSelectionData; - NdbApiSignal* theCommitAckSignal; diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp index db1cd0b119e..1b1c8575656 100644 --- a/ndb/include/ndbapi/ndb_cluster_connection.hpp +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -18,13 +18,7 @@ #ifndef CLUSTER_CONNECTION_HPP #define CLUSTER_CONNECTION_HPP -class TransporterFacade; -class ConfigRetriever; -struct NdbThread; - -extern "C" { - void* run_ndb_cluster_connection_connect_thread(void*); -} +struct Ndb_cluster_connection_node_iter; class Ndb_cluster_connection { public: @@ -32,16 +26,27 @@ public: ~Ndb_cluster_connection(); int connect(int no_retries, int retry_delay_in_seconds, int verbose); int start_connect_thread(int (*connect_callback)(void)= 0); + + // add check coupled to init state of cluster connection + // timeout_after_first_alive negative - ok only if all alive + // timeout_after_first_alive positive - ok if some alive + int wait_until_ready(int timeout_for_first_alive, + int timeout_after_first_alive); + const char *get_connectstring(char *buf, int buf_sz) const; int get_connected_port() const; const char *get_connected_host() const; + + void set_optimized_node_selection(int val); + + Uint32 no_db_nodes(); + private: - friend void* run_ndb_cluster_connection_connect_thread(void*); - void connect_thread(); - TransporterFacade *m_facade; - ConfigRetriever *m_config_retriever; - NdbThread *m_connect_thread; - int (*m_connect_callback)(void); + friend class Ndb; + friend class NdbImpl; + friend class Ndb_cluster_connection_impl; + class Ndb_cluster_connection_impl & m_impl; + Ndb_cluster_connection(Ndb_cluster_connection_impl&); }; #endif diff --git a/ndb/include/util/ndb_opts.h b/ndb/include/util/ndb_opts.h index f7ae3b5489e..4bac36f5e5e 100644 --- a/ndb/include/util/ndb_opts.h +++ b/ndb/include/util/ndb_opts.h @@ -17,47 +17,62 @@ #ifndef _NDB_OPTS_H #define _NDB_OPTS_H +#include #include #include #include #include +#define NDB_STD_OPTS_VARS \ +const char *opt_connect_str= 0;\ +my_bool opt_ndb_shm;\ +my_bool opt_ndb_optimized_node_selection + +#define NDB_STD_OPTS_OPTIONS \ +OPT_NDB_SHM= 256,\ +OPT_NDB_OPTIMIZED_NODE_SELECTION + +#define OPT_NDB_CONNECTSTRING 'c' + +#ifdef NDB_SHM_TRANSPORTER +#define OPT_NDB_SHM_DEFAULT 1 +#else +#define OPT_NDB_SHM_DEFAULT 0 +#endif + +#define NDB_STD_OPTS_COMMON \ + { "usage", '?', "Display this help and exit.", \ + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ + { "help", '?', "Display this help and exit.", \ + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ + { "version", 'V', "Output version information and exit.", 0, 0, 0, \ + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ + { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \ + "Set connect string for connecting to ndb_mgmd. " \ + "Syntax: \"[nodeid=;][host=][:]\". " \ + "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ + (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ + { "ndb-shm", OPT_NDB_SHM,\ + "Allow optimizing using shared memory connections when available",\ + (gptr*) &opt_ndb_shm, (gptr*) &opt_ndb_shm, 0,\ + GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\ + {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\ + "Select nodes for transactions in a more optimal way",\ + (gptr*) &opt_ndb_optimized_node_selection,\ + (gptr*) &opt_ndb_optimized_node_selection, 0,\ + GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\ + { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\ + (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,\ + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } + #ifndef DBUG_OFF #define NDB_STD_OPTS(prog_name) \ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "usage", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "help", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "version", 'V', "Output version information and exit.", 0, 0, 0, \ - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "ndb-connectstring", 'c', \ - "Set connect string for connecting to ndb_mgmd. " \ - "Syntax: \"[nodeid=;][host=][:]\". " \ - "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ - { "connect-string", 'c', "same as --ndb-connectstring",\ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } + NDB_STD_OPTS_COMMON #else -#define NDB_STD_OPTS(prog_name) \ - { "usage", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "help", '?', "Display this help and exit.", \ - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "version", 'V', "Output version information and exit.", 0, 0, 0, \ - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \ - { "ndb-connectstring", 'c', \ - "Set connect string for connecting to ndb_mgmd. " \ - "Syntax: \"[nodeid=;][host=][:]\". " \ - "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, \ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ - { "connect-string", 'c', "same as --ndb-connectstring",\ - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0,\ - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 } +#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON #endif #endif /*_NDB_OPTS_H */ diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 3de84bb0566..29255fc9837 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -46,7 +46,13 @@ extern "C" { #include extern EventLogger g_eventLogger; -static const char* opt_connect_str= 0; +enum ndbd_options { + NDB_STD_OPTS_OPTIONS, + OPT_INITIAL, + OPT_NODAEMON +}; + +NDB_STD_OPTS_VARS; static int _daemon, _no_daemon, _initial, _no_start; /** * Arguments to NDB process @@ -54,7 +60,7 @@ static int _daemon, _no_daemon, _initial, _no_start; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndbd"), - { "initial", 256, + { "initial", OPT_INITIAL, "Perform initial start of ndbd, including cleaning the file system. " "Consult documentation before using this", (gptr*) &_initial, (gptr*) &_initial, 0, @@ -66,7 +72,7 @@ static struct my_option my_long_options[] = { "daemon", 'd', "Start ndbd as daemon (default)", (gptr*) &_daemon, (gptr*) &_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, - { "nodaemon", 257, + { "nodaemon", OPT_NODAEMON, "Do not start ndbd as daemon, provided for testing purposes", (gptr*) &_no_daemon, (gptr*) &_no_daemon, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index 84e27790705..9417c03805f 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -56,9 +56,13 @@ handler(int sig){ } } +enum ndb_mgm_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char default_prompt[]= "ndb_mgm> "; static unsigned _try_reconnect; -static char *opt_connect_str= 0; static const char *prompt= default_prompt; static char *opt_execute_str= 0; diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp index ab2e34f6d3a..800ffe2e361 100644 --- a/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -23,6 +23,8 @@ #include "InitConfigFileParser.hpp" #include +extern my_bool opt_ndb_shm; + #define MAX_LINE_LENGTH 255 #define KEY_INTERNAL 0 #define MAX_INT_RNIL 0xfffffeff @@ -79,6 +81,7 @@ static bool transformSystem(InitConfigFileParser::Context & ctx, const char *); static bool transformExternalSystem(InitConfigFileParser::Context & ctx, const char *); static bool transformNode(InitConfigFileParser::Context & ctx, const char *); static bool transformExtNode(InitConfigFileParser::Context & ctx, const char *); +static bool checkConnectionSupport(InitConfigFileParser::Context & ctx, const char *); static bool transformConnection(InitConfigFileParser::Context & ctx, const char *); static bool applyDefaultValues(InitConfigFileParser::Context & ctx, const char *); static bool checkMandatory(InitConfigFileParser::Context & ctx, const char *); @@ -108,6 +111,11 @@ ConfigInfo::m_SectionRules[] = { { "REP", transformNode, 0 }, { "EXTERNAL REP", transformExtNode, 0 }, + { "TCP", checkConnectionSupport, 0 }, + { "SHM", checkConnectionSupport, 0 }, + { "SCI", checkConnectionSupport, 0 }, + { "OSE", checkConnectionSupport, 0 }, + { "TCP", transformConnection, 0 }, { "SHM", transformConnection, 0 }, { "SCI", transformConnection, 0 }, @@ -130,6 +138,8 @@ ConfigInfo::m_SectionRules[] = { { "TCP", fixHostname, "HostName1" }, { "TCP", fixHostname, "HostName2" }, + { "SHM", fixHostname, "HostName1" }, + { "SHM", fixHostname, "HostName2" }, { "SCI", fixHostname, "HostName1" }, { "SCI", fixHostname, "HostName2" }, { "SHM", fixHostname, "HostName1" }, @@ -197,6 +207,9 @@ static bool sanity_checks(Vector§ions, static bool add_node_connections(Vector§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); +static bool set_connection_priorities(Vector§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data); static bool add_server_ports(Vector§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data); @@ -208,6 +221,7 @@ const ConfigInfo::ConfigRule ConfigInfo::m_ConfigRules[] = { { sanity_checks, 0 }, { add_node_connections, 0 }, + { set_connection_priorities, 0 }, { add_server_ports, 0 }, { check_node_vs_replicas, 0 }, { 0, 0 } @@ -1582,6 +1596,17 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { MANDATORY, 0, 0 }, + { + CFG_CONNECTION_GROUP, + "Group", + "TCP", + "", + ConfigInfo::CI_USED, + false, + ConfigInfo::CI_INT, + "55", + "0", "200" }, + { CFG_CONNECTION_SEND_SIGNAL_ID, "SendSignalId", @@ -1747,6 +1772,17 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { MANDATORY, 0, 0 }, + { + CFG_CONNECTION_GROUP, + "Group", + "SHM", + "", + ConfigInfo::CI_USED, + false, + ConfigInfo::CI_INT, + "35", + "0", "200" }, + { CFG_CONNECTION_SEND_SIGNAL_ID, "SendSignalId", @@ -1780,7 +1816,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::CI_USED, false, ConfigInfo::CI_INT, - MANDATORY, + "0", "0", STR_VALUE(MAX_INT_RNIL) }, @@ -1857,6 +1893,17 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "0", STR_VALUE(MAX_INT_RNIL) }, + { + CFG_CONNECTION_GROUP, + "Group", + "SCI", + "", + ConfigInfo::CI_USED, + false, + ConfigInfo::CI_INT, + "15", + "0", "200" }, + { CFG_CONNECTION_HOSTNAME_1, "HostName1", @@ -2680,12 +2727,51 @@ transformExtNode(InitConfigFileParser::Context & ctx, const char * data){ return true; } +/** + * Connection rule: Check support of connection + */ +bool +checkConnectionSupport(InitConfigFileParser::Context & ctx, const char * data) +{ + int error= 0; + if (strcasecmp("TCP",ctx.fname) == 0) + { + // always enabled + } + else if (strcasecmp("SHM",ctx.fname) == 0) + { +#ifndef NDB_SHM_TRANSPORTER + error= 1; +#endif + } + else if (strcasecmp("SCI",ctx.fname) == 0) + { +#ifndef NDB_SCI_TRANSPORTER + error= 1; +#endif + } + else if (strcasecmp("OSE",ctx.fname) == 0) + { +#ifndef NDB_OSE_TRANSPORTER + error= 1; +#endif + } + if (error) + { + ctx.reportError("Binary not compiled with this connection support, " + "[%s] starting at line: %d", + ctx.fname, ctx.m_sectionLineno); + return false; + } + return true; +} + /** * Connection rule: Update "NoOfConnections" */ bool -transformConnection(InitConfigFileParser::Context & ctx, const char * data){ - +transformConnection(InitConfigFileParser::Context & ctx, const char * data) +{ Uint32 connections = 0; ctx.m_userProperties.get("NoOfConnections", &connections); BaseString::snprintf(ctx.pname, sizeof(ctx.pname), "Connection_%d", connections); @@ -3398,11 +3484,51 @@ sanity_checks(Vector§ions, return true; } +static void +add_a_connection(Vector§ions, + struct InitConfigFileParser::Context &ctx, + Uint32 nodeId1, Uint32 nodeId2, bool use_shm) +{ + ConfigInfo::ConfigRuleSection s; + const char *hostname1= 0, *hostname2= 0; + const Properties *tmp; + + require(ctx.m_config->get("Node", nodeId1, &tmp)); + tmp->get("HostName", &hostname1); + + require(ctx.m_config->get("Node", nodeId2, &tmp)); + tmp->get("HostName", &hostname2); + + char buf[16]; + s.m_sectionData= new Properties(true); + BaseString::snprintf(buf, sizeof(buf), "%u", nodeId1); + s.m_sectionData->put("NodeId1", buf); + BaseString::snprintf(buf, sizeof(buf), "%u", nodeId2); + s.m_sectionData->put("NodeId2", buf); + + if (use_shm && + hostname1 && hostname1[0] && + hostname2 && hostname2[0] && + strcmp(hostname1,hostname2) == 0) + { + s.m_sectionType= BaseString("SHM"); + DBUG_PRINT("info",("adding SHM connection %d %d",nodeId1,nodeId2)); + } + else + { + s.m_sectionType= BaseString("TCP"); + DBUG_PRINT("info",("adding TCP connection %d %d",nodeId1,nodeId2)); + } + + sections.push_back(s); +} + static bool add_node_connections(Vector§ions, struct InitConfigFileParser::Context &ctx, const char * rule_data) { + DBUG_ENTER("add_node_connections"); Uint32 i; Properties * props= ctx.m_config; Properties p_connections(true); @@ -3427,9 +3553,10 @@ add_node_connections(Vector§ions, ctx.m_userProperties.get("NoOfNodes", &nNodes); Properties p_db_nodes(true); - Properties p_api_mgm_nodes(true); + Properties p_api_nodes(true); + Properties p_mgm_nodes(true); - Uint32 i_db= 0, i_api_mgm= 0, n; + Uint32 i_db= 0, i_api= 0, i_mgm= 0, n; for (i= 0, n= 0; n < nNodes; i++){ const Properties * tmp; if(!props->get("Node", i, &tmp)) continue; @@ -3440,9 +3567,10 @@ add_node_connections(Vector§ions, if (strcmp(type,DB_TOKEN) == 0) p_db_nodes.put("", i_db++, i); - else if (strcmp(type,API_TOKEN) == 0 || - strcmp(type,MGM_TOKEN) == 0) - p_api_mgm_nodes.put("", i_api_mgm++, i); + else if (strcmp(type,API_TOKEN) == 0) + p_api_nodes.put("", i_api++, i); + else if (strcmp(type,MGM_TOKEN) == 0) + p_mgm_nodes.put("", i_mgm++, i); } Uint32 nodeId1, nodeId2, dummy; @@ -3451,39 +3579,39 @@ add_node_connections(Vector§ions, for (Uint32 j= i+1;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; if(!p_connections2.get("", nodeId1+nodeId2<<16, &dummy)) { - ConfigInfo::ConfigRuleSection s; - s.m_sectionType= BaseString("TCP"); - s.m_sectionData= new Properties(true); - char buf[16]; - BaseString::snprintf(buf, sizeof(buf), "%u", nodeId1); - s.m_sectionData->put("NodeId1", buf); - BaseString::snprintf(buf, sizeof(buf), "%u", nodeId2); - s.m_sectionData->put("NodeId2", buf); - sections.push_back(s); + add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm); } } } - for (i= 0; p_api_mgm_nodes.get("", i, &nodeId1); i++){ + for (i= 0; p_api_nodes.get("", i, &nodeId1); i++){ if(!p_connections.get("", nodeId1, &dummy)) { for (Uint32 j= 0;; j++){ if(!p_db_nodes.get("", j, &nodeId2)) break; - ConfigInfo::ConfigRuleSection s; - s.m_sectionType= BaseString("TCP"); - s.m_sectionData= new Properties(true); - char buf[16]; - BaseString::snprintf(buf, sizeof(buf), "%u", nodeId1); - s.m_sectionData->put("NodeId1", buf); - BaseString::snprintf(buf, sizeof(buf), "%u", nodeId2); - s.m_sectionData->put("NodeId2", buf); - sections.push_back(s); + add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm); } } } - return true; + for (i= 0; p_mgm_nodes.get("", i, &nodeId1); i++){ + if(!p_connections.get("", nodeId1, &dummy)) { + for (Uint32 j= 0;; j++){ + if(!p_db_nodes.get("", j, &nodeId2)) break; + add_a_connection(sections,ctx,nodeId1,nodeId2,0); + } + } + } + + DBUG_RETURN(true); } +static bool set_connection_priorities(Vector§ions, + struct InitConfigFileParser::Context &ctx, + const char * rule_data) +{ + DBUG_ENTER("set_connection_priorities"); + DBUG_RETURN(true); +} static bool add_server_ports(Vector§ions, struct InitConfigFileParser::Context &ctx, diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 713dff912bb..3fcde997cb0 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -2225,9 +2225,24 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId, if (*nodeId != 0 || type != NDB_MGM_NODE_TYPE_MGM || no_mgm == 1) { // any match is ok + + if (config_hostname == 0 && + *nodeId == 0 && + type != NDB_MGM_NODE_TYPE_MGM) + { + if (!id_found) // only set if not set earlier + id_found= tmp; + continue; /* continue looking for a nodeid with specified + * hostname + */ + } + assert(id_found == 0); id_found= tmp; break; } + assert(no_mgm > 1); + assert(*nodeId != 0); + assert(type != NDB_MGM_NODE_TYPE_MGM); if (id_found) { // mgmt server may only have one match error_string.appfmt("Ambiguous node id's %d and %d.\n" "Suggest specifying node id in connectstring,\n" diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index 992e827ceaa..04c95117214 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -89,50 +89,50 @@ bool g_StopServer; extern EventLogger g_EventLogger; extern int global_mgmt_server_check; -static char *opt_connect_str= 0; + +enum ndb_mgmd_options { + NDB_STD_OPTS_OPTIONS, + OPT_INTERACTIVE, + OPT_NO_NODEID_CHECKS, + OPT_NO_DAEMON +}; +NDB_STD_OPTS_VARS; + +#if NDB_VERSION_MAJOR <= 4 +#undef OPT_NDB_CONNECTSTRING +#define OPT_NDB_CONNECTSTRING 1023 +#else + +#endif static struct my_option my_long_options[] = { -#ifndef DBUG_OFF - { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", - 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, -#endif - { "usage", '?', "Display this help and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, - { "help", '?', "Display this help and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, - { "version", 'V', "Output version information and exit.", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, - { "ndb-connectstring", 1023, - "Set connect string for connecting to ndb_mgmd. " - "Syntax: \"[nodeid=;][host=][:]\". " - "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - { "connect-string", 1023, - "same as --ndb-connectstring.", - (gptr*) &opt_connect_str, (gptr*) &opt_connect_str, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + NDB_STD_OPTS("ndb_mgmd"), { "config-file", 'f', "Specify cluster configuration file", (gptr*) &glob.config_filename, (gptr*) &glob.config_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)", (gptr*) &glob.daemon, (gptr*) &glob.daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, - { "interactive", 256, "Run interactive. Not supported but provided for testing purposes", + { "interactive", OPT_INTERACTIVE, + "Run interactive. Not supported but provided for testing purposes", (gptr*) &glob.interactive, (gptr*) &glob.interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, - { "no-nodeid-checks", 257, "Do not provide any node id checks", + { "no-nodeid-checks", OPT_NO_NODEID_CHECKS, + "Do not provide any node id checks", (gptr*) &g_no_nodeid_checks, (gptr*) &g_no_nodeid_checks, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, - { "nodaemon", 258, "Don't run as daemon, but don't read from stdin", + { "nodaemon", OPT_NO_DAEMON, + "Don't run as daemon, but don't read from stdin", (gptr*) &glob.non_interactive, (gptr*) &glob.non_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, +#if NDB_VERSION_MAJOR <= 4 { "config-file", 'c', "-c provided for backwards compatability, will be removed in 5.0." " Use -f instead", (gptr*) &glob.config_filename, (gptr*) &glob.config_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, +#endif { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void short_usage_sub(void) @@ -164,6 +164,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'c': printf("Warning: -c will be removed in 5.0, use -f instead\n"); break; + case OPT_NDB_SHM: +#ifndef NDB_SHM_TRANSPORTER + printf("Warning: binary not compiled with shared memory support,\n" + "use configure option --with-ndb-shm to enable support.\n" + "Tcp connections will now be used instead\n"); + opt_ndb_shm= 0; +#endif + break; case '?': usage(); exit(0); diff --git a/ndb/src/ndbapi/DictCache.hpp b/ndb/src/ndbapi/DictCache.hpp index a517acee56b..58c08a93e61 100644 --- a/ndb/src/ndbapi/DictCache.hpp +++ b/ndb/src/ndbapi/DictCache.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "NdbLinHash.hpp" class Ndb_local_table_info { diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index ca4592fb5eb..e9a125922c6 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -46,7 +46,6 @@ Connect to any node which has no connection at the moment. NdbConnection* Ndb::doConnect(Uint32 tConNode) { Uint32 tNode; - Uint32 i = 0;; Uint32 tAnyAlive = 0; int TretCode; @@ -65,26 +64,51 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode) // We will connect to any node. Make sure that we have connections to all // nodes. //**************************************************************************** - Uint32 tNoOfDbNodes= theImpl->theNoOfDBnodes; - Uint32 &theCurrentConnectIndex= theImpl->theCurrentConnectIndex; - UintR Tcount = 0; - do { - theCurrentConnectIndex++; - if (theCurrentConnectIndex >= tNoOfDbNodes) { - theCurrentConnectIndex = 0; - }//if - Tcount++; - tNode = theImpl->theDBnodes[theCurrentConnectIndex]; - TretCode = NDB_connect(tNode); - if ((TretCode == 1) || (TretCode == 2)) { + if (theImpl->m_optimized_node_selection) + { + Ndb_cluster_connection_node_iter &node_iter= + theImpl->m_node_iter; + theImpl->m_ndb_cluster_connection.init_get_next_node(node_iter); + while ((tNode= theImpl->m_ndb_cluster_connection.get_next_node(node_iter))) + { + TretCode= NDB_connect(tNode); + if ((TretCode == 1) || + (TretCode == 2)) + { //**************************************************************************** // We have connections now to the desired node. Return //**************************************************************************** - return getConnectedNdbConnection(tNode); - } else if (TretCode != 0) { - tAnyAlive = 1; - }//if - } while (Tcount < tNoOfDbNodes); + return getConnectedNdbConnection(tNode); + } else if (TretCode != 0) { + tAnyAlive= 1; + }//if + } + } + else // just do a regular round robin + { + Uint32 tNoOfDbNodes= theImpl->theNoOfDBnodes; + Uint32 &theCurrentConnectIndex= theImpl->theCurrentConnectIndex; + UintR Tcount = 0; + do { + theCurrentConnectIndex++; + if (theCurrentConnectIndex >= tNoOfDbNodes) + theCurrentConnectIndex = 0; + + Tcount++; + tNode= theImpl->theDBnodes[theCurrentConnectIndex]; + TretCode= NDB_connect(tNode); + if ((TretCode == 1) || + (TretCode == 2)) + { +//**************************************************************************** +// We have connections now to the desired node. Return +//**************************************************************************** + return getConnectedNdbConnection(tNode); + } else if (TretCode != 0) { + tAnyAlive= 1; + }//if + } while (Tcount < tNoOfDbNodes); + } //**************************************************************************** // We were unable to find a free connection. If no node alive we will report // error code for cluster failure otherwise connection failure. @@ -149,8 +173,8 @@ Ndb::NDB_connect(Uint32 tNode) tReturnCode = tp->sendSignal(tSignal, tNode); releaseSignal(tSignal); if (tReturnCode != -1) { - theWaiter.m_node = tNode; - theWaiter.m_state = WAIT_TC_SEIZE; + theImpl->theWaiter.m_node = tNode; + theImpl->theWaiter.m_state = WAIT_TC_SEIZE; tReturnCode = receiveResponse(); }//if } else { @@ -243,50 +267,28 @@ Ndb::waitUntilReady(int timeout) DBUG_RETURN(-1); } - do { - if ((id = theNode) != 0) { - unsigned int foundAliveNode = 0; - TransporterFacade *tp = TransporterFacade::instance(); - tp->lock_mutex(); - for (unsigned int i = 0; i < theImpl->theNoOfDBnodes; i++) { - const NodeId nodeId = theImpl->theDBnodes[i]; - //************************************************ - // If any node is answering, ndb is answering - //************************************************ - if (tp->get_node_alive(nodeId) != 0) { - foundAliveNode++; - }//if - }//for - - tp->unlock_mutex(); - if (foundAliveNode == theImpl->theNoOfDBnodes) { - DBUG_RETURN(0); - }//if - if (foundAliveNode > 0) { - noChecksSinceFirstAliveFound++; - }//if - if (noChecksSinceFirstAliveFound > 30) { - DBUG_RETURN(0); - }//if - }//if theNode != 0 + while (theNode == 0) { if (secondsCounter >= timeout) - break; + { + theError.code = 4269; + DBUG_RETURN(-1); + } NdbSleep_MilliSleep(100); milliCounter += 100; if (milliCounter >= 1000) { secondsCounter++; milliCounter = 0; }//if - } while (1); - if (id == 0) { - theError.code = 4269; + } + + if (theImpl->m_ndb_cluster_connection.wait_until_ready + (timeout-secondsCounter,30)) + { + theError.code = 4009; DBUG_RETURN(-1); } - if (noChecksSinceFirstAliveFound > 0) { - DBUG_RETURN(0); - }//if - theError.code = 4009; - DBUG_RETURN(-1); + + DBUG_RETURN(0); } /***************************************************************************** @@ -311,8 +313,8 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen) */ Uint32 nodeId; if(keyData != 0) { - Uint32 fragmentId = computeFragmentId(keyData, keyLen); - nodeId = guessPrimaryNode(fragmentId); + nodeId = 0; // guess not supported + // nodeId = m_ndb_cluster_connection->guess_primary_node(keyData, keyLen); } else { nodeId = 0; }//if @@ -373,44 +375,6 @@ Ndb::hupp(NdbConnection* pBuddyTrans) }//if }//Ndb::hupp() -NdbConnection* -Ndb::startTransactionDGroup(Uint32 aPriority, const char * keyData, int type) -{ - - char DGroup[4]; - if ((keyData == NULL) || - (type > 1)) { - theError.code = 4118; - return NULL; - }//if - if (theInitState == Initialised) { - theError.code = 0; - checkFailedNode(); - /** - * If the user supplied key data - * We will make a qualified quess to which node is the primary for the - * the fragment and contact that node - */ - Uint32 fragmentId; - if (type == 0) { - DGroup[0] = keyData[0]; - DGroup[1] = keyData[1]; - DGroup[2] = 0x30; - DGroup[3] = 0x30; - fragmentId = computeFragmentId(&DGroup[0], 4); - } else { - Uint32 hashValue = ((keyData[0] - 0x30) * 10) + (keyData[1] - 0x30); - fragmentId = getFragmentId(hashValue); - }//if - Uint32 nodeId = guessPrimaryNode(fragmentId); - NdbConnection* trans= startTransactionLocal(aPriority, nodeId); - DBUG_PRINT("exit", ("start DGroup trans: 0x%x transid: 0x%llx", - trans, trans ? trans->getTransactionId() : 0)); - return trans; - } else { - return NULL; - }//if -}//Ndb::startTransaction() NdbConnection* Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId) @@ -1010,118 +974,6 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) return ~0; } -static const Uint32 MAX_KEY_LEN_64_WORDS = 4; -static const Uint32 MAX_KEY_LEN_32_WORDS = 8; -static const Uint32 MAX_KEY_LEN_BYTES = 32; - -Uint32 -Ndb::computeFragmentId(const char * keyData, Uint32 keyLen) -{ - Uint64 tempData[MAX_KEY_LEN_64_WORDS]; - - const Uint32 usedKeyLen = (keyLen + 3) >> 2; // In words - const char * usedKeyData = 0; - - /** - * If key data buffer is not aligned (on 64 bit boundary) - * or key len is not a multiple of 4 - * Use temp data - */ - if(((((UintPtr)keyData) & 7) == 0) && ((keyLen & 3) == 0)) { - usedKeyData = keyData; - } else { - memcpy(&tempData[0], keyData, keyLen); - const int slack = keyLen & 3; - if(slack > 0) { - memset(&((char *)&tempData[0])[keyLen], 0, (4 - slack)); - }//if - usedKeyData = (char *)&tempData[0]; - }//if - - Uint32 hashValue = md5_hash((Uint64 *)usedKeyData, usedKeyLen); - - hashValue >>= startTransactionNodeSelectionData.kValue; - return getFragmentId(hashValue); -}//Ndb::computeFragmentId() - -Uint32 -Ndb::getFragmentId(Uint32 hashValue) -{ - Uint32 fragmentId = hashValue & - startTransactionNodeSelectionData.hashValueMask; - if(fragmentId < startTransactionNodeSelectionData.hashpointerValue) { - fragmentId = hashValue & - ((startTransactionNodeSelectionData.hashValueMask << 1) + 1); - }//if - return fragmentId; -} - -Uint32 -Ndb::guessPrimaryNode(Uint32 fragmentId){ - //ASSERT(((fragmentId > 0) && fragmentId < - // startTransactionNodeSelectionData.noOfFragments), "Invalid fragementId"); - - return startTransactionNodeSelectionData.fragment2PrimaryNodeMap[fragmentId]; -} - -void -Ndb::StartTransactionNodeSelectionData::init(Uint32 noOfNodes, - Uint8 nodeIds[]) { - kValue = 6; - noOfFragments = 2 * noOfNodes; - - /** - * Compute hashValueMask and hashpointerValue - */ - { - Uint32 topBit = (1 << 31); - for(int i = 31; i>=0; i--){ - if((noOfFragments & topBit) != 0) - break; - topBit >>= 1; - } - hashValueMask = topBit - 1; - hashpointerValue = noOfFragments - (hashValueMask + 1); - } - - /** - * This initialization depends on - * the fact that: - * primary node for fragment i = i % noOfNodes - * - * This algorithm should be implemented in Dbdih - */ - { - if (fragment2PrimaryNodeMap != 0) - abort(); - - fragment2PrimaryNodeMap = new Uint32[noOfFragments]; - Uint32 i; - for(i = 0; i fragment2PrimaryNodeMap[j]){ - Uint32 tmp = fragment2PrimaryNodeMap[i]; - fragment2PrimaryNodeMap[i] = fragment2PrimaryNodeMap[j]; - fragment2PrimaryNodeMap[j] = tmp; - } - - for(i = 0; i #include #include -#include "NdbImpl.hpp" +#include "NdbWaiter.hpp" #include "DictCache.hpp" class NdbDictObjectImpl { diff --git a/ndb/src/ndbapi/NdbImpl.hpp b/ndb/src/ndbapi/NdbImpl.hpp index 21a4706f890..00a8ef19f3a 100644 --- a/ndb/src/ndbapi/NdbImpl.hpp +++ b/ndb/src/ndbapi/NdbImpl.hpp @@ -17,7 +17,9 @@ #ifndef NDB_IMPL_HPP #define NDB_IMPL_HPP +#include #include +#include #include #include #include @@ -26,6 +28,8 @@ #include +#include "ndb_cluster_connection_impl.hpp" +#include "NdbDictionaryImpl.hpp" #include "ObjectMap.hpp" /** @@ -33,11 +37,16 @@ */ class NdbImpl { public: - NdbImpl(); + NdbImpl(Ndb_cluster_connection *, Ndb&); ~NdbImpl(); + Ndb_cluster_connection_impl &m_ndb_cluster_connection; + + NdbDictionaryImpl m_dictionary; + // Ensure good distribution of connects Uint32 theCurrentConnectIndex; + Ndb_cluster_connection_node_iter m_node_iter; NdbObjectIdMap theNdbObjectIdMap; @@ -46,6 +55,10 @@ public: // 1 indicates to release all connections to node Uint32 the_release_ind[MAX_NDB_NODES]; + + NdbWaiter theWaiter; + + int m_optimized_node_selection; }; #ifdef VM_TRACE @@ -113,26 +126,6 @@ Ndb::checkInitState() Uint32 convertEndian(Uint32 Data); -enum WaitSignalType { - NO_WAIT = 0, - WAIT_NODE_FAILURE = 1, // Node failure during wait - WST_WAIT_TIMEOUT = 2, // Timeout during wait - - WAIT_TC_SEIZE = 3, - WAIT_TC_RELEASE = 4, - WAIT_NDB_TAMPER = 5, - WAIT_SCAN = 6, - - // DICT stuff - WAIT_GET_TAB_INFO_REQ = 11, - WAIT_CREATE_TAB_REQ = 12, - WAIT_DROP_TAB_REQ = 13, - WAIT_ALTER_TAB_REQ = 14, - WAIT_CREATE_INDX_REQ = 15, - WAIT_DROP_INDX_REQ = 16, - WAIT_LIST_TABLES_CONF = 17 -}; - enum LockMode { Read, Update, @@ -140,44 +133,4 @@ enum LockMode { Delete }; -#include - -inline -void -NdbWaiter::wait(int waitTime) -{ - const bool forever = (waitTime == -1); - const NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime; - while (1) { - if (m_state == NO_WAIT || m_state == WAIT_NODE_FAILURE) - break; - if (forever) { - NdbCondition_Wait(m_condition, (NdbMutex*)m_mutex); - } else { - if (waitTime <= 0) { - m_state = WST_WAIT_TIMEOUT; - break; - } - NdbCondition_WaitTimeout(m_condition, (NdbMutex*)m_mutex, waitTime); - waitTime = maxTime - NdbTick_CurrentMillisecond(); - } - } -} - -inline -void -NdbWaiter::nodeFail(Uint32 aNodeId){ - if (m_state != NO_WAIT && m_node == aNodeId){ - m_state = WAIT_NODE_FAILURE; - NdbCondition_Signal(m_condition); - } -} - -inline -void -NdbWaiter::signal(Uint32 state){ - m_state = state; - NdbCondition_Signal(m_condition); -} - #endif diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index 88208409c08..a90c9f524a2 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -528,8 +528,8 @@ int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend) /** * No completed... */ - theNdb->theWaiter.m_node = nodeId; - theNdb->theWaiter.m_state = WAIT_SCAN; + theNdb->theImpl->theWaiter.m_node = nodeId; + theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { continue; @@ -1358,8 +1358,8 @@ NdbIndexScanOperation::next_result_ordered(bool fetchAllowed, Uint32 tmp = m_sent_receivers_count; s_idx = m_current_api_receiver; while(m_sent_receivers_count > 0 && !theError.code){ - theNdb->theWaiter.m_node = nodeId; - theNdb->theWaiter.m_state = WAIT_SCAN; + theNdb->theImpl->theWaiter.m_node = nodeId; + theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); if (return_code == 0 && seq == tp->getNodeSequence(nodeId)) { continue; @@ -1506,8 +1506,8 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){ */ while(theError.code == 0 && m_sent_receivers_count) { - theNdb->theWaiter.m_node = nodeId; - theNdb->theWaiter.m_state = WAIT_SCAN; + theNdb->theImpl->theWaiter.m_node = nodeId; + theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); switch(return_code){ case 0: @@ -1576,8 +1576,8 @@ NdbScanOperation::close_impl(TransporterFacade* tp, bool forceSend){ */ while(m_sent_receivers_count+m_api_receivers_count+m_conf_receivers_count) { - theNdb->theWaiter.m_node = nodeId; - theNdb->theWaiter.m_state = WAIT_SCAN; + theNdb->theImpl->theWaiter.m_node = nodeId; + theNdb->theImpl->theWaiter.m_state = WAIT_SCAN; int return_code = theNdb->receiveResponse(WAITFOR_SCAN_TIMEOUT); switch(return_code){ case 0: diff --git a/ndb/src/ndbapi/NdbWaiter.hpp b/ndb/src/ndbapi/NdbWaiter.hpp new file mode 100644 index 00000000000..8b7b2a75879 --- /dev/null +++ b/ndb/src/ndbapi/NdbWaiter.hpp @@ -0,0 +1,102 @@ +/* Copyright (C) 2003 MySQL AB + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef NDB_WAITER_HPP +#define NDB_WAITER_HPP + +#include +#include +#include +#include +#include +#include +#include + +#include + +enum WaitSignalType { + NO_WAIT = 0, + WAIT_NODE_FAILURE = 1, // Node failure during wait + WST_WAIT_TIMEOUT = 2, // Timeout during wait + + WAIT_TC_SEIZE = 3, + WAIT_TC_RELEASE = 4, + WAIT_NDB_TAMPER = 5, + WAIT_SCAN = 6, + + // DICT stuff + WAIT_GET_TAB_INFO_REQ = 11, + WAIT_CREATE_TAB_REQ = 12, + WAIT_DROP_TAB_REQ = 13, + WAIT_ALTER_TAB_REQ = 14, + WAIT_CREATE_INDX_REQ = 15, + WAIT_DROP_INDX_REQ = 16, + WAIT_LIST_TABLES_CONF = 17 +}; + +class NdbWaiter { +public: + NdbWaiter(); + ~NdbWaiter(); + + void wait(int waitTime); + void nodeFail(Uint32 node); + void signal(Uint32 state); + + Uint32 m_node; + Uint32 m_state; + void * m_mutex; + struct NdbCondition * m_condition; +}; + +inline +void +NdbWaiter::wait(int waitTime) +{ + const bool forever = (waitTime == -1); + const NDB_TICKS maxTime = NdbTick_CurrentMillisecond() + waitTime; + while (1) { + if (m_state == NO_WAIT || m_state == WAIT_NODE_FAILURE) + break; + if (forever) { + NdbCondition_Wait(m_condition, (NdbMutex*)m_mutex); + } else { + if (waitTime <= 0) { + m_state = WST_WAIT_TIMEOUT; + break; + } + NdbCondition_WaitTimeout(m_condition, (NdbMutex*)m_mutex, waitTime); + waitTime = maxTime - NdbTick_CurrentMillisecond(); + } + } +} + +inline +void +NdbWaiter::nodeFail(Uint32 aNodeId){ + if (m_state != NO_WAIT && m_node == aNodeId){ + m_state = WAIT_NODE_FAILURE; + NdbCondition_Signal(m_condition); + } +} + +inline +void +NdbWaiter::signal(Uint32 state){ + m_state = state; + NdbCondition_Signal(m_condition); +} + +#endif diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index 232e55662f0..a4f233709c4 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -209,8 +209,6 @@ void Ndb::connected(Uint32 ref) tmpTheNode, theImpl->theNoOfDBnodes, theFirstTransId)); - startTransactionNodeSelectionData.init(theImpl->theNoOfDBnodes, - theImpl->theDBnodes); theCommitAckSignal = new NdbApiSignal(theMyRef); theDictionary->m_receiver.m_reference= theMyRef; @@ -251,7 +249,7 @@ Ndb::report_node_failure(Uint32 node_id) theImpl->the_release_ind[node_id] = 1; // must come after theImpl->the_release_ind[0] = 1; - theWaiter.nodeFail(node_id); + theImpl->theWaiter.nodeFail(node_id); return; }//Ndb::report_node_failure() @@ -330,7 +328,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) NdbConnection* tCon; int tReturnCode = -1; const Uint32* tDataPtr = aSignal->getDataPtr(); - const Uint32 tWaitState = theWaiter.m_state; + const Uint32 tWaitState = theImpl->theWaiter.m_state; const Uint32 tSignalNumber = aSignal->readSignalNumber(); const Uint32 tFirstData = *tDataPtr; const Uint32 tLen = aSignal->getLength(); @@ -401,7 +399,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) break; case NdbReceiver::NDB_SCANRECEIVER: tCon->theScanningOp->receiver_delivered(tRec); - theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? + theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? (Uint32) NO_WAIT : tWaitState); break; default: @@ -598,7 +596,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) }//if tReturnCode = tCon->receiveTCSEIZECONF(aSignal); if (tReturnCode != -1) { - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; } else { goto InvalidSignal; }//if @@ -618,7 +616,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) }//if tReturnCode = tCon->receiveTCSEIZEREF(aSignal); if (tReturnCode != -1) { - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; } else { return; }//if @@ -638,7 +636,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) }//if tReturnCode = tCon->receiveTCRELEASECONF(aSignal); if (tReturnCode != -1) { - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; }//if break; } @@ -656,7 +654,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) }//if tReturnCode = tCon->receiveTCRELEASEREF(aSignal); if (tReturnCode != -1) { - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; }//if break; } @@ -708,7 +706,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) return; tReturnCode = tCon->receiveDIHNDBTAMPER(aSignal); if (tReturnCode != -1) - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; break; } case GSN_SCAN_TABCONF: @@ -730,7 +728,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) tLen - ScanTabConf::SignalLength); } if (tReturnCode != -1 && tWaitState == WAIT_SCAN) - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; break; } else { goto InvalidSignal; @@ -749,7 +747,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) if (tCon->checkMagicNumber() == 0){ tReturnCode = tCon->receiveSCAN_TABREF(aSignal); if (tReturnCode != -1 && tWaitState == WAIT_SCAN){ - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; } break; } @@ -774,7 +772,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) switch(com){ case 1: tCon->theScanningOp->receiver_delivered(tRec); - theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? + theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ? (Uint32) NO_WAIT : tWaitState); break; case 0: @@ -838,16 +836,16 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3]) goto InvalidSignal; }//switch - if (theWaiter.m_state == NO_WAIT) { + if (theImpl->theWaiter.m_state == NO_WAIT) { // Wake up the thread waiting for response - NdbCondition_Signal(theWaiter.m_condition); + NdbCondition_Signal(theImpl->theWaiter.m_condition); }//if return; InvalidSignal: #ifdef VM_TRACE ndbout_c("Ndbif: Error Ndb::handleReceivedSignal " - "(GSN=%d, theWaiter.m_state=%d)" + "(GSN=%d, theImpl->theWaiter.m_state=%d)" " sender = (Block: %d Node: %d)", tSignalNumber, tWaitState, @@ -895,7 +893,7 @@ Ndb::completedTransaction(NdbConnection* aCon) if ((theMinNoOfEventsToWakeUp != 0) && (theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) { theMinNoOfEventsToWakeUp = 0; - NdbCondition_Signal(theWaiter.m_condition); + NdbCondition_Signal(theImpl->theWaiter.m_condition); return; }//if } else { @@ -1155,9 +1153,9 @@ void Ndb::waitCompletedTransactions(int aMilliSecondsToWait, int noOfEventsToWaitFor) { - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; /** - * theWaiter.m_state = NO_WAIT; + * theImpl->theWaiter.m_state = NO_WAIT; * To ensure no messup with synchronous node fail handling * (see ReportFailure) */ @@ -1166,8 +1164,8 @@ Ndb::waitCompletedTransactions(int aMilliSecondsToWait, theMinNoOfEventsToWakeUp = noOfEventsToWaitFor; do { if (waitTime < 1000) waitTime = 1000; - NdbCondition_WaitTimeout(theWaiter.m_condition, - (NdbMutex*)theWaiter.m_mutex, + NdbCondition_WaitTimeout(theImpl->theWaiter.m_condition, + (NdbMutex*)theImpl->theWaiter.m_mutex, waitTime); if (theNoOfCompletedTransactions >= (Uint32)noOfEventsToWaitFor) { break; @@ -1273,23 +1271,23 @@ Ndb::receiveResponse(int waitTime){ int tResultCode; TransporterFacade::instance()->checkForceSend(theNdbBlockNumber); - theWaiter.wait(waitTime); + theImpl->theWaiter.wait(waitTime); - if(theWaiter.m_state == NO_WAIT) { + if(theImpl->theWaiter.m_state == NO_WAIT) { tResultCode = 0; } else { #ifdef VM_TRACE - ndbout << "ERR: receiveResponse - theWaiter.m_state = "; - ndbout << theWaiter.m_state << endl; + ndbout << "ERR: receiveResponse - theImpl->theWaiter.m_state = "; + ndbout << theImpl->theWaiter.m_state << endl; #endif - if (theWaiter.m_state == WAIT_NODE_FAILURE){ + if (theImpl->theWaiter.m_state == WAIT_NODE_FAILURE){ tResultCode = -2; } else { tResultCode = -1; } - theWaiter.m_state = NO_WAIT; + theImpl->theWaiter.m_state = NO_WAIT; } return tResultCode; }//Ndb::receiveResponse() @@ -1321,8 +1319,8 @@ Ndb::sendRecSignal(Uint16 node_id, if (tp->check_send_size(node_id, send_size)) { return_code = tp->sendSignal(aSignal, node_id); if (return_code != -1) { - theWaiter.m_node = node_id; - theWaiter.m_state = aWaitState; + theImpl->theWaiter.m_node = node_id; + theImpl->theWaiter.m_state = aWaitState; return_code = receiveResponse(); } else { return_code = -3; diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index 9754c25ab15..e1af7bd4cc5 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -50,7 +50,9 @@ Ndb(const char* aDataBase); Parameters: aDataBase : Name of the database. Remark: Connect to the database. ***************************************************************************/ -Ndb::Ndb( const char* aDataBase , const char* aSchema) { +Ndb::Ndb( const char* aDataBase , const char* aSchema) + : theImpl(NULL) +{ DBUG_ENTER("Ndb::Ndb()"); DBUG_PRINT("enter",("(old)Ndb::Ndb this=0x%x", this)); if (theNoOfNdbObjects < 0) @@ -66,6 +68,7 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) { Ndb::Ndb( Ndb_cluster_connection *ndb_cluster_connection, const char* aDataBase , const char* aSchema) + : theImpl(NULL) { DBUG_ENTER("Ndb::Ndb()"); DBUG_PRINT("enter",("Ndb::Ndb this=0x%x", this)); @@ -82,7 +85,10 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, { DBUG_ENTER("Ndb::setup"); - m_ndb_cluster_connection= ndb_cluster_connection; + assert(theImpl == NULL); + theImpl= new NdbImpl(ndb_cluster_connection,*this); + theDictionary= &(theImpl->m_dictionary); + thePreparedTransactionsArray= NULL; theSentTransactionsArray= NULL; theCompletedTransactionsArray= NULL; @@ -93,8 +99,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, theMaxNoOfTransactions= 0; theMinNoOfEventsToWakeUp= 0; prefixEnd= NULL; - theImpl= NULL; - theDictionary= NULL; theConIdleList= NULL; theOpIdleList= NULL; theScanOpIdleList= NULL; @@ -153,14 +157,12 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, prefixEnd = prefixName + (len < (int) sizeof(prefixName) ? len : sizeof(prefixName) - 1); - theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr; + theImpl->theWaiter.m_mutex = TransporterFacade::instance()->theMutexPtr; // Signal that the constructor has finished OK if (theInitState == NotConstructed) theInitState = NotInitialised; - theImpl = new NdbImpl(); - { NdbGlobalEventBufferHandle *h= NdbGlobalEventBuffer_init(NDB_MAX_ACTIVE_EVENTS); @@ -171,11 +173,6 @@ void Ndb::setup(Ndb_cluster_connection *ndb_cluster_connection, theGlobalEventBufferHandle = h; } - theDictionary = new NdbDictionaryImpl(*this); - if (theDictionary == NULL) { - ndbout_c("Ndb cailed to allocate dictionary"); - exit(-1); - } DBUG_VOID_RETURN; } @@ -201,8 +198,6 @@ Ndb::~Ndb() DBUG_PRINT("enter",("Ndb::~Ndb this=0x%x",this)); doDisconnect(); - delete theDictionary; - NdbGlobalEventBuffer_drop(theGlobalEventBufferHandle); if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){ @@ -245,7 +240,6 @@ Ndb::~Ndb() freeSignal(); releaseTransactionArrays(); - startTransactionNodeSelectionData.release(); delete []theConnectionArray; if(theCommitAckSignal != NULL){ @@ -292,14 +286,20 @@ NdbWaiter::~NdbWaiter(){ NdbCondition_Destroy(m_condition); } -NdbImpl::NdbImpl() : theNdbObjectIdMap(1024,1024), - theCurrentConnectIndex(0), - theNoOfDBnodes(0) +NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection, + Ndb& ndb) + : m_ndb_cluster_connection(ndb_cluster_connection->m_impl), + m_dictionary(ndb), + theCurrentConnectIndex(0), + theNdbObjectIdMap(1024,1024), + theNoOfDBnodes(0) { int i; for (i = 0; i < MAX_NDB_NODES; i++) { the_release_ind[i] = 0; } + m_optimized_node_selection= + m_ndb_cluster_connection.m_optimized_node_selection; } NdbImpl::~NdbImpl() diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 5680e3a6f03..99edea846c1 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -127,7 +127,7 @@ private: friend class ExtSender; ///< @todo Hack to be able to sendSignalUnCond friend class GrepSS; friend class Ndb; - friend class Ndb_cluster_connection; + friend class Ndb_cluster_connection_impl; int sendSignalUnCond(NdbApiSignal *, NodeId nodeId); diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index f436ee56ede..98a52786aab 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -18,7 +18,9 @@ #include #include -#include +#include "ndb_cluster_connection_impl.hpp" +#include +#include #include #include #include @@ -26,6 +28,8 @@ #include #include #include +#include +#include static int g_run_connect_thread= 0; @@ -35,13 +39,226 @@ NdbMutex *ndb_global_event_buffer_mutex= NULL; NdbMutex *ndb_print_state_mutex= NULL; #endif +/* + * Ndb_cluster_connection + */ + Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string) + : m_impl(* new Ndb_cluster_connection_impl(connect_string)) +{ +} + +Ndb_cluster_connection::Ndb_cluster_connection +(Ndb_cluster_connection_impl& impl) : m_impl(impl) +{ +} + +Ndb_cluster_connection::~Ndb_cluster_connection() +{ + Ndb_cluster_connection_impl *tmp = &m_impl; + if (this != tmp) + delete tmp; +} + +int Ndb_cluster_connection::get_connected_port() const +{ + if (m_impl.m_config_retriever) + return m_impl.m_config_retriever->get_mgmd_port(); + return -1; +} + +const char *Ndb_cluster_connection::get_connected_host() const +{ + if (m_impl.m_config_retriever) + return m_impl.m_config_retriever->get_mgmd_host(); + return 0; +} + +const char *Ndb_cluster_connection::get_connectstring(char *buf, + int buf_sz) const +{ + if (m_impl.m_config_retriever) + return m_impl.m_config_retriever->get_connectstring(buf,buf_sz); + return 0; +} + +extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) +{ + my_thread_init(); + g_run_connect_thread= 1; + ((Ndb_cluster_connection_impl*) me)->connect_thread(); + my_thread_end(); + NdbThread_Exit(0); + return me; +} + +int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void)) +{ + int r; + DBUG_ENTER("Ndb_cluster_connection::start_connect_thread"); + m_impl.m_connect_callback= connect_callback; + if ((r = connect(0,0,0)) == 1) + { + DBUG_PRINT("info",("starting thread")); + m_impl.m_connect_thread= + NdbThread_Create(run_ndb_cluster_connection_connect_thread, + (void**)&m_impl, 32768, "ndb_cluster_connection", + NDB_THREAD_PRIO_LOW); + } + else if (r < 0) + { + DBUG_RETURN(-1); + } + else if (m_impl.m_connect_callback) + { + (*m_impl.m_connect_callback)(); + } + DBUG_RETURN(0); +} + +void Ndb_cluster_connection::set_optimized_node_selection(int val) +{ + m_impl.m_optimized_node_selection= val; +} + +void +Ndb_cluster_connection_impl::init_get_next_node +(Ndb_cluster_connection_node_iter &iter) +{ + if (iter.scan_state != (Uint8)~0) + iter.cur_pos= iter.scan_state; + if (iter.cur_pos >= no_db_nodes()) + iter.cur_pos= 0; + iter.init_pos= iter.cur_pos; + iter.scan_state= 0; + // fprintf(stderr,"[init %d]",iter.init_pos); + return; +} + +Uint32 +Ndb_cluster_connection_impl::get_next_node(Ndb_cluster_connection_node_iter &iter) +{ + Uint32 cur_pos= iter.cur_pos; + if (cur_pos >= no_db_nodes()) + return 0; + + Ndb_cluster_connection_impl::Node *nodes= m_impl.m_all_nodes.getBase(); + Ndb_cluster_connection_impl::Node &node= nodes[cur_pos]; + + if (iter.scan_state != (Uint8)~0) + { + assert(iter.scan_state < no_db_nodes()); + if (nodes[iter.scan_state].group == node.group) + iter.scan_state= ~0; + else + return nodes[iter.scan_state++].id; + } + + // fprintf(stderr,"[%d]",node.id); + + cur_pos++; + Uint32 init_pos= iter.init_pos; + if (cur_pos == node.next_group) + { + cur_pos= nodes[init_pos].this_group; + } + + // fprintf(stderr,"[cur_pos %d]",cur_pos); + if (cur_pos != init_pos) + iter.cur_pos= cur_pos; + else + { + iter.cur_pos= node.next_group; + iter.init_pos= node.next_group; + } + return node.id; +} + +Uint32 +Ndb_cluster_connection::no_db_nodes() +{ + return m_impl.m_all_nodes.size(); +} + + +int +Ndb_cluster_connection::wait_until_ready(int timeout, + int timeout_after_first_alive) +{ + DBUG_ENTER("Ndb_cluster_connection::wait_until_ready"); + TransporterFacade *tp = TransporterFacade::instance(); + if (tp == 0) + { + DBUG_RETURN(-1); + } + if (tp->ownId() == 0) + { + DBUG_RETURN(-1); + } + int secondsCounter = 0; + int milliCounter = 0; + int noChecksSinceFirstAliveFound = 0; + do { + unsigned int foundAliveNode = 0; + tp->lock_mutex(); + for(unsigned i= 0; i < no_db_nodes(); i++) + { + //************************************************ + // If any node is answering, ndb is answering + //************************************************ + if (tp->get_node_alive(m_impl.m_all_nodes[i].id) != 0) { + foundAliveNode++; + } + } + tp->unlock_mutex(); + + if (foundAliveNode == no_db_nodes()) + { + DBUG_RETURN(0); + } + else if (foundAliveNode > 0) + { + noChecksSinceFirstAliveFound++; + if (timeout_after_first_alive >= 0) + { + if (noChecksSinceFirstAliveFound > timeout_after_first_alive) + DBUG_RETURN(0); + } + else // timeout_after_first_alive < 0 + { + if (noChecksSinceFirstAliveFound > -timeout_after_first_alive) + DBUG_RETURN(-1); + } + } + else if (secondsCounter >= timeout) + { // no alive nodes and timed out + DBUG_RETURN(-1); + } + NdbSleep_MilliSleep(100); + milliCounter += 100; + if (milliCounter >= 1000) { + secondsCounter++; + milliCounter = 0; + }//if + } while (1); +} + + + +/* + * Ndb_cluster_connection_impl + */ + +Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char * + connect_string) + : Ndb_cluster_connection(*this), + m_optimized_node_selection(1) { DBUG_ENTER("Ndb_cluster_connection"); DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%x", this)); - m_facade= TransporterFacade::theFacadeInstance= new TransporterFacade(); + m_transporter_facade= + TransporterFacade::theFacadeInstance= new TransporterFacade(); - m_config_retriever= 0; m_connect_thread= 0; m_connect_callback= 0; @@ -64,43 +281,230 @@ Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string) delete m_config_retriever; m_config_retriever= 0; } + DBUG_VOID_RETURN; } -int Ndb_cluster_connection::get_connected_port() const +Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl() { + DBUG_ENTER("~Ndb_cluster_connection"); + DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this)); + TransporterFacade::stop_instance(); + if (m_connect_thread) + { + void *status; + g_run_connect_thread= 0; + NdbThread_WaitFor(m_connect_thread, &status); + NdbThread_Destroy(&m_connect_thread); + m_connect_thread= 0; + } + if (m_transporter_facade != 0) + { + delete m_transporter_facade; + if (m_transporter_facade != TransporterFacade::theFacadeInstance) + abort(); + TransporterFacade::theFacadeInstance= 0; + } if (m_config_retriever) - return m_config_retriever->get_mgmd_port(); - return -1; + delete m_config_retriever; + + // fragmentToNodeMap.release(); + + DBUG_VOID_RETURN; } -const char *Ndb_cluster_connection::get_connected_host() const +void +Ndb_cluster_connection_impl::init_nodes_vector(Uint32 nodeid, + const ndb_mgm_configuration + &config) { - if (m_config_retriever) - return m_config_retriever->get_mgmd_host(); - return 0; + DBUG_ENTER("Ndb_cluster_connection_impl::init_nodes_vector"); + ndb_mgm_configuration_iterator iter(config, CFG_SECTION_CONNECTION); + + for(iter.first(); iter.valid(); iter.next()) + { + Uint32 nodeid1, nodeid2, remoteNodeId, group= 5; + const char * remoteHostName= 0, * localHostName= 0; + if(iter.get(CFG_CONNECTION_NODE_1, &nodeid1)) continue; + if(iter.get(CFG_CONNECTION_NODE_2, &nodeid2)) continue; + + if(nodeid1 != nodeid && nodeid2 != nodeid) continue; + remoteNodeId = (nodeid == nodeid1 ? nodeid2 : nodeid1); + + iter.get(CFG_CONNECTION_GROUP, &group); + + { + const char * host1= 0, * host2= 0; + iter.get(CFG_CONNECTION_HOSTNAME_1, &host1); + iter.get(CFG_CONNECTION_HOSTNAME_2, &host2); + localHostName = (nodeid == nodeid1 ? host1 : host2); + remoteHostName = (nodeid == nodeid1 ? host2 : host1); + } + + Uint32 type = ~0; + if(iter.get(CFG_TYPE_OF_SECTION, &type)) continue; + + switch(type){ + case CONNECTION_TYPE_SHM:{ + break; + } + case CONNECTION_TYPE_SCI:{ + break; + } + case CONNECTION_TYPE_TCP:{ + // connecting through localhost + // check if config_hostname is local + if (SocketServer::tryBind(0,remoteHostName)) + group--; // upgrade group value + break; + } + case CONNECTION_TYPE_OSE:{ + break; + } + } + m_impl.m_all_nodes.push_back(Node(group,remoteNodeId)); + DBUG_PRINT("info",("saved %d %d", group,remoteNodeId)); + for (int i= m_impl.m_all_nodes.size()-2; + i >= 0 && m_impl.m_all_nodes[i].group > m_impl.m_all_nodes[i+1].group; + i--) + { + Node tmp= m_impl.m_all_nodes[i]; + m_impl.m_all_nodes[i]= m_impl.m_all_nodes[i+1]; + m_impl.m_all_nodes[i+1]= tmp; + } + } + + int i; + Uint32 cur_group, i_group= 0; + cur_group= ~0; + for (i= (int)m_impl.m_all_nodes.size()-1; i >= 0; i--) + { + if (m_impl.m_all_nodes[i].group != cur_group) + { + cur_group= m_impl.m_all_nodes[i].group; + i_group= i+1; + } + m_impl.m_all_nodes[i].next_group= i_group; + } + cur_group= ~0; + for (i= 0; i < (int)m_impl.m_all_nodes.size(); i++) + { + if (m_impl.m_all_nodes[i].group != cur_group) + { + cur_group= m_impl.m_all_nodes[i].group; + i_group= i; + } + m_impl.m_all_nodes[i].this_group= i_group; + } +#if 0 + for (i= 0; i < (int)m_impl.m_all_nodes.size(); i++) + { + fprintf(stderr, "[%d] %d %d %d %d\n", + i, + m_impl.m_all_nodes[i].id, + m_impl.m_all_nodes[i].group, + m_impl.m_all_nodes[i].this_group, + m_impl.m_all_nodes[i].next_group); + } + + do_test(); +#endif + DBUG_VOID_RETURN; } -const char *Ndb_cluster_connection::get_connectstring(char *buf, int buf_sz) const +void +Ndb_cluster_connection_impl::do_test() { - if (m_config_retriever) - return m_config_retriever->get_connectstring(buf,buf_sz); - return 0; + Ndb_cluster_connection_node_iter iter; + int n= no_db_nodes()+5; + Uint32 *nodes= new Uint32[n+1]; + + for (int g= 0; g < n; g++) + { + for (int h= 0; h < n; h++) + { + Uint32 id; + Ndb_cluster_connection_node_iter iter2; + { + for (int j= 0; j < g; j++) + { + nodes[j]= get_next_node(iter2); + } + } + + for (int i= 0; i < n; i++) + { + init_get_next_node(iter); + fprintf(stderr, "%d dead:(", g); + id= 0; + while (id == 0) + { + if ((id= get_next_node(iter)) == 0) + break; + for (int j= 0; j < g; j++) + { + if (nodes[j] == id) + { + fprintf(stderr, " %d", id); + id= 0; + break; + } + } + } + fprintf(stderr, ")"); + if (id == 0) + { + break; + } + fprintf(stderr, " %d\n", id); + } + fprintf(stderr, "\n"); + } + } + delete [] nodes; } -extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) +int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, + int verbose) { - my_thread_init(); - g_run_connect_thread= 1; - ((Ndb_cluster_connection*) me)->connect_thread(); - my_thread_end(); - NdbThread_Exit(0); - return me; + DBUG_ENTER("Ndb_cluster_connection::connect"); + const char* error = 0; + do { + if (m_impl.m_config_retriever == 0) + DBUG_RETURN(-1); + if (m_impl.m_config_retriever->do_connect(no_retries, + retry_delay_in_seconds, + verbose)) + DBUG_RETURN(1); // mgmt server not up yet + + Uint32 nodeId = m_impl.m_config_retriever->allocNodeId(4/*retries*/, + 3/*delay*/); + if(nodeId == 0) + break; + ndb_mgm_configuration * props = m_impl.m_config_retriever->getConfig(); + if(props == 0) + break; + m_impl.m_transporter_facade->start_instance(nodeId, props); + + m_impl.init_nodes_vector(nodeId, *props); + + ndb_mgm_destroy_configuration(props); + m_impl.m_transporter_facade->connected(); + DBUG_RETURN(0); + } while(0); + + ndbout << "Configuration error: "; + const char* erString = m_impl.m_config_retriever->getErrorString(); + if (erString == 0) { + erString = "No error specified!"; + } + ndbout << erString << endl; + DBUG_RETURN(-1); } -void Ndb_cluster_connection::connect_thread() +void Ndb_cluster_connection_impl::connect_thread() { - DBUG_ENTER("Ndb_cluster_connection::connect_thread"); + DBUG_ENTER("Ndb_cluster_connection_impl::connect_thread"); int r; do { NdbSleep_SecSleep(1); @@ -120,84 +524,110 @@ void Ndb_cluster_connection::connect_thread() DBUG_VOID_RETURN; } -int Ndb_cluster_connection::start_connect_thread(int (*connect_callback)(void)) -{ - int r; - DBUG_ENTER("Ndb_cluster_connection::start_connect_thread"); - m_connect_callback= connect_callback; - if ((r = connect(0,0,0)) == 1) - { - DBUG_PRINT("info",("starting thread")); - m_connect_thread= - NdbThread_Create(run_ndb_cluster_connection_connect_thread, - (void**)this, 32768, "ndb_cluster_connection", - NDB_THREAD_PRIO_LOW); - } - else if (r < 0) - { - DBUG_RETURN(-1); - } - else if (m_connect_callback) - { - (*m_connect_callback)(); - } - DBUG_RETURN(0); -} +/* + * Hint handling to select node + * ToDo: fix this + */ -int Ndb_cluster_connection::connect(int no_retries, int retry_delay_in_seconds, int verbose) +void +Ndb_cluster_connection_impl::FragmentToNodeMap::init(Uint32 noOfNodes, + Uint8 nodeIds[]) { - DBUG_ENTER("Ndb_cluster_connection::connect"); - const char* error = 0; - do { - if (m_config_retriever == 0) - DBUG_RETURN(-1); - if (m_config_retriever->do_connect(no_retries,retry_delay_in_seconds,verbose)) - DBUG_RETURN(1); // mgmt server not up yet + kValue = 6; + noOfFragments = 2 * noOfNodes; - Uint32 nodeId = m_config_retriever->allocNodeId(4/*retries*/,3/*delay*/); - if(nodeId == 0) - break; - ndb_mgm_configuration * props = m_config_retriever->getConfig(); - if(props == 0) - break; - m_facade->start_instance(nodeId, props); - ndb_mgm_destroy_configuration(props); - m_facade->connected(); - DBUG_RETURN(0); - } while(0); + /** + * Compute hashValueMask and hashpointerValue + */ + { + Uint32 topBit = (1 << 31); + for(int i = 31; i>=0; i--){ + if((noOfFragments & topBit) != 0) + break; + topBit >>= 1; + } + hashValueMask = topBit - 1; + hashpointerValue = noOfFragments - (hashValueMask + 1); + } - ndbout << "Configuration error: "; - const char* erString = m_config_retriever->getErrorString(); - if (erString == 0) { - erString = "No error specified!"; - } - ndbout << erString << endl; - DBUG_RETURN(-1); -} - -Ndb_cluster_connection::~Ndb_cluster_connection() -{ - DBUG_ENTER("~Ndb_cluster_connection"); - DBUG_PRINT("enter",("~Ndb_cluster_connection this=0x%x", this)); - TransporterFacade::stop_instance(); - if (m_connect_thread) + /** + * This initialization depends on + * the fact that: + * primary node for fragment i = i % noOfNodes + * + * This algorithm should be implemented in Dbdih + */ { - void *status; - g_run_connect_thread= 0; - NdbThread_WaitFor(m_connect_thread, &status); - NdbThread_Destroy(&m_connect_thread); - m_connect_thread= 0; - } - if (m_facade != 0) - { - delete m_facade; - if (m_facade != TransporterFacade::theFacadeInstance) + if (fragment2PrimaryNodeMap != 0) abort(); - TransporterFacade::theFacadeInstance= 0; + + fragment2PrimaryNodeMap = new Uint32[noOfFragments]; + Uint32 i; + for(i = 0; i fragment2PrimaryNodeMap[j]){ + Uint32 tmp = fragment2PrimaryNodeMap[i]; + fragment2PrimaryNodeMap[i] = fragment2PrimaryNodeMap[j]; + fragment2PrimaryNodeMap[j] = tmp; + } + + for(i = 0; i> 2; // In words + const char * usedKeyData = 0; + + /** + * If key data buffer is not aligned (on 64 bit boundary) + * or key len is not a multiple of 4 + * Use temp data + */ + if(((((UintPtr)keyData) & 7) == 0) && ((keyLen & 3) == 0)) { + usedKeyData = keyData; + } else { + memcpy(&tempData[0], keyData, keyLen); + const int slack = keyLen & 3; + if(slack > 0) { + memset(&((char *)&tempData[0])[keyLen], 0, (4 - slack)); + }//if + usedKeyData = (char *)&tempData[0]; + }//if + + Uint32 hashValue = md5_hash((Uint64 *)usedKeyData, usedKeyLen); + + hashValue >>= fragmentToNodeMap.kValue; + + Uint32 fragmentId = hashValue & + fragmentToNodeMap.hashValueMask; + + if(fragmentId < fragmentToNodeMap.hashpointerValue) { + fragmentId = hashValue & + ((fragmentToNodeMap.hashValueMask << 1) + 1); + }//if + return fragmentId; } +template class Vector; + diff --git a/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp b/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp new file mode 100644 index 00000000000..620eac296a3 --- /dev/null +++ b/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp @@ -0,0 +1,100 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef CLUSTER_CONNECTION_IMPL_HPP +#define CLUSTER_CONNECTION_IMPL_HPP + +#include +#include + +class TransporterFacade; +class ConfigRetriever; +class NdbThread; +class ndb_mgm_configuration; + +struct Ndb_cluster_connection_node_iter { + Ndb_cluster_connection_node_iter() : scan_state(~0), + init_pos(0), + cur_pos(0) {}; + Uint8 scan_state; + Uint8 init_pos; + Uint8 cur_pos; +}; + +extern "C" { + void* run_ndb_cluster_connection_connect_thread(void*); +} + +class Ndb_cluster_connection_impl : public Ndb_cluster_connection +{ + Ndb_cluster_connection_impl(const char *connectstring); + ~Ndb_cluster_connection_impl(); + + void do_test(); + + void init_get_next_node(Ndb_cluster_connection_node_iter &iter); + Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter); + +private: + friend class Ndb; + friend class NdbImpl; + friend void* run_ndb_cluster_connection_connect_thread(void*); + friend class Ndb_cluster_connection; + + /** + * Structure containing values for guessing primary node + */ + struct FragmentToNodeMap { + FragmentToNodeMap(): + fragment2PrimaryNodeMap(0) {}; + Uint32 kValue; + Uint32 hashValueMask; + Uint32 hashpointerValue; + Uint32 noOfFragments; + Uint32 *fragment2PrimaryNodeMap; + + void init(Uint32 noOfNodes, Uint8 nodeIds[]); + void release(); + } fragmentToNodeMap; + + struct Node + { + Node(Uint32 _g= 0, Uint32 _id= 0) : this_group(0), + next_group(0), + group(_g), + id(_id) {}; + Uint32 this_group; + Uint32 next_group; + Uint32 group; + Uint32 id; + }; + + Vector m_all_nodes; + void init_nodes_vector(Uint32 nodeid, const ndb_mgm_configuration &config); + Uint32 guess_primary_node(const char * keyData, Uint32 keyLen); + + void connect_thread(); + + TransporterFacade *m_transporter_facade; + ConfigRetriever *m_config_retriever; + NdbThread *m_connect_thread; + int (*m_connect_callback)(void); + + int m_optimized_node_selection; +}; + +#endif diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp index a1ebac609b6..69e534e6860 100644 --- a/ndb/test/ndbapi/testNdbApi.cpp +++ b/ndb/test/ndbapi/testNdbApi.cpp @@ -142,14 +142,22 @@ int runTestMaxTransaction(NDBT_Context* ctx, NDBT_Step* step){ 4); break; case 2: + ndbout_c("startTransactionDGroup not supported"); + abort(); + /* pCon = pNdb->startTransactionDGroup(1, "TEST", 0); + */ break; case 3: + ndbout_c("startTransactionDGroup not supported"); + abort(); + /* pCon = pNdb->startTransactionDGroup(2, "TEST", 1); + */ break; default: diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index 046ac8005d2..cdfaf2134ff 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -24,7 +24,11 @@ static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240); -static const char* opt_connect_str= 0; +enum ndb_delete_all { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static struct my_option my_long_options[] = { diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp index c5e9efdfa8a..4bca51ee903 100644 --- a/ndb/tools/desc.cpp +++ b/ndb/tools/desc.cpp @@ -19,7 +19,11 @@ #include #include -static const char* opt_connect_str= 0; +enum ndb_desc_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static int _unqualified = 0; static struct my_option my_long_options[] = diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp index 6600811e0c4..2b7f8c1bce9 100644 --- a/ndb/tools/drop_index.cpp +++ b/ndb/tools/drop_index.cpp @@ -21,7 +21,11 @@ #include #include -static const char* opt_connect_str= 0; +enum ndb_drop_index_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static struct my_option my_long_options[] = { diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp index 0661a8c599b..2b0b6908449 100644 --- a/ndb/tools/drop_tab.cpp +++ b/ndb/tools/drop_tab.cpp @@ -21,7 +21,11 @@ #include #include -static const char* opt_connect_str= 0; +enum ndb_drop_table_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static struct my_option my_long_options[] = { diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp index ccb6967e2dc..710af66f4de 100644 --- a/ndb/tools/listTables.cpp +++ b/ndb/tools/listTables.cpp @@ -161,13 +161,17 @@ list(const char * tabname, } } -static const char* opt_connect_str= 0; +enum ndb_show_tables_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static int _loops; static int _type; static struct my_option my_long_options[] = { - NDB_STD_OPTS("ndb_desc"), + NDB_STD_OPTS("ndb_show_tables"), { "database", 'd', "Name of database table is in", (gptr*) &_dbname, (gptr*) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, diff --git a/ndb/tools/restore/restore_main.cpp b/ndb/tools/restore/restore_main.cpp index ece2b2605b4..c24ed620b71 100644 --- a/ndb/tools/restore/restore_main.cpp +++ b/ndb/tools/restore/restore_main.cpp @@ -36,7 +36,10 @@ static Vector g_consumers; static const char* ga_backupPath = "." DIR_SEPARATOR; -static const char* opt_connect_str= NULL; +enum ndb_restore_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; /** * print and restore flags diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp index 5efeed485a4..9c65750094b 100644 --- a/ndb/tools/select_all.cpp +++ b/ndb/tools/select_all.cpp @@ -36,7 +36,11 @@ int scanReadRecords(Ndb*, char delim, bool orderby); -static const char* opt_connect_str= 0; +enum ndb_select_all_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static const char* _delimiter = "\t"; static int _unqualified, _header, _parallelism, _useHexFormat, _lock, diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp index c3491f842d8..516eebda91d 100644 --- a/ndb/tools/select_count.cpp +++ b/ndb/tools/select_count.cpp @@ -32,7 +32,11 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, int* count_rows, UtilTransactions::ScanLock lock); -static const char* opt_connect_str= 0; +enum ndb_select_count_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static const char* _dbname = "TEST_DB"; static int _parallelism = 240; static int _lock = 0; diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index 5973b046f8f..4b86de36514 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -30,7 +30,11 @@ int waitClusterStatus(const char* _addr, ndb_mgm_node_status _status, unsigned int _timeout); -static const char* opt_connect_str= 0; +enum ndb_waiter_options { + NDB_STD_OPTS_OPTIONS +}; +NDB_STD_OPTS_VARS; + static int _no_contact = 0; static int _timeout = 120; static struct my_option my_long_options[] = diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 029fe31ecf7..eb201ee6ef5 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -32,6 +32,10 @@ #include #include +// options from from mysqld.cc +extern my_bool opt_ndb_optimized_node_selection; +extern const char *opt_ndbcluster_connectstring; + // Default value for parallelism static const int parallelism= 240; @@ -39,9 +43,6 @@ static const int parallelism= 240; // createable against NDB from this handler static const int max_transactions= 256; -// connectstring to cluster if given by mysqld -const char *ndbcluster_connectstring= 0; - static const char *ha_ndb_ext=".ndb"; #define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 @@ -4233,15 +4234,19 @@ bool ndbcluster_init() int res; DBUG_ENTER("ndbcluster_init"); // Set connectstring if specified - if (ndbcluster_connectstring != 0) - DBUG_PRINT("connectstring", ("%s", ndbcluster_connectstring)); + if (opt_ndbcluster_connectstring != 0) + DBUG_PRINT("connectstring", ("%s", opt_ndbcluster_connectstring)); if ((g_ndb_cluster_connection= - new Ndb_cluster_connection(ndbcluster_connectstring)) == 0) + new Ndb_cluster_connection(opt_ndbcluster_connectstring)) == 0) { - DBUG_PRINT("error",("Ndb_cluster_connection(%s)",ndbcluster_connectstring)); + DBUG_PRINT("error",("Ndb_cluster_connection(%s)", + opt_ndbcluster_connectstring)); goto ndbcluster_init_error; } + g_ndb_cluster_connection->set_optimized_node_selection + (opt_ndb_optimized_node_selection); + // Create a Ndb object to open the connection to NDB g_ndb= new Ndb(g_ndb_cluster_connection, "sys"); g_ndb->getDictionary()->set_local_table_data_size(sizeof(Ndb_table_local_info)); @@ -4256,7 +4261,7 @@ bool ndbcluster_init() DBUG_PRINT("info",("NDBCLUSTER storage engine at %s on port %d", g_ndb_cluster_connection->get_connected_host(), g_ndb_cluster_connection->get_connected_port())); - g_ndb->waitUntilReady(10); + g_ndb_cluster_connection->wait_until_ready(10,0); } else if(res == 1) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e39c902444e..5cd85113641 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -53,6 +53,11 @@ #endif #ifdef HAVE_NDBCLUSTER_DB #define OPT_NDBCLUSTER_DEFAULT 0 +#ifdef NDB_SHM_TRANSPORTER +#define OPT_NDB_SHM_DEFAULT 1 +#else +#define OPT_NDB_SHM_DEFAULT 0 +#endif #else #define OPT_NDBCLUSTER_DEFAULT 0 #endif @@ -285,6 +290,10 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_log_slave_updates= 0; my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam, opt_ndbcluster; +#ifdef HAVE_NDBCLUSTER_DB +const char *opt_ndbcluster_connectstring= 0; +my_bool opt_ndb_shm, opt_ndb_optimized_node_selection; +#endif my_bool opt_readonly, use_temp_pool, relay_log_purge; my_bool opt_sync_bdb_logs, opt_sync_frm; my_bool opt_secure_auth= 0; @@ -3998,6 +4007,7 @@ enum options_mysqld OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT, OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, + OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_SKIP_SAFEMALLOC, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, @@ -4439,24 +4449,46 @@ Disable with --skip-ndbcluster (will save memory).", #ifdef HAVE_NDBCLUSTER_DB {"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.", - (gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring, + (gptr*) &opt_ndbcluster_connectstring, + (gptr*) &opt_ndbcluster_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"ndb_autoincrement_prefetch_sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, - "Specify number of autoincrement values that are prefetched", + {"ndb-autoincrement-prefetch-sz", OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, + "Specify number of autoincrement values that are prefetched.", (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, (gptr*) &global_system_variables.ndb_autoincrement_prefetch_sz, 0, GET_INT, REQUIRED_ARG, 32, 1, 256, 0, 0, 0}, - {"ndb_force_send", OPT_NDB_FORCE_SEND, - "Force send of buffers to ndb immediately without waiting for other threads", + {"ndb-force-send", OPT_NDB_FORCE_SEND, + "Force send of buffers to ndb immediately without waiting for " + "other threads.", (gptr*) &global_system_variables.ndb_force_send, (gptr*) &global_system_variables.ndb_force_send, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"ndb_force_send", OPT_NDB_FORCE_SEND, + "same as --ndb-force-send.", + (gptr*) &global_system_variables.ndb_force_send, + (gptr*) &global_system_variables.ndb_force_send, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT, + "Use exact records count during query planning and for fast " + "select count(*), disable for faster queries.", + (gptr*) &global_system_variables.ndb_use_exact_count, + (gptr*) &global_system_variables.ndb_use_exact_count, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb_use_exact_count", OPT_NDB_USE_EXACT_COUNT, - "Use exact records count during query planning and for " - "fast select count(*)", + "same as --ndb-use-exact-count.", (gptr*) &global_system_variables.ndb_use_exact_count, (gptr*) &global_system_variables.ndb_use_exact_count, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"ndb-shm", OPT_NDB_SHM, + "Use shared memory connections when available.", + (gptr*) &opt_ndb_shm, + (gptr*) &opt_ndb_shm, + 0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0}, + {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION, + "Select nodes for transactions in a more optimal way.", + (gptr*) &opt_ndb_optimized_node_selection, + (gptr*) &opt_ndb_optimized_node_selection, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, #endif {"new", 'n', "Use very new possible 'unsafe' functions.", (gptr*) &global_system_variables.new_mode,