Commit 75b628b8 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
parents 10a081a0 4ed0b1c2
......@@ -145,7 +145,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION ||
(mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION &&
host && strcmp(host,LOCAL_HOST)))
host && *host && strcmp(host,LOCAL_HOST)))
DBUG_RETURN(cli_mysql_real_connect(mysql, host, user,
passwd, db, port,
unix_socket, client_flag));
......
############################ ps_conv.inc ##############################
# #
# Tests for prepared statements: conversion of parameters #
# #
# Please don't #
# - try to execute this script in ANSI mode, because many statements #
# will fail due to the strict type checking #
# - reuse such ugly assignments like timestamp column = float value . #
# I included them only for controlling purposes. #
########################################################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
#
# Please be aware, that this file will be sourced by several test case files
# stored within the subdirectory 't'. So every change here will affect
# several test cases.
# The MySQL User Variables do not support the simulation of all
# C-API field types.
#
# - There is no method to make an explicit assignment of a type to a variable.
# - The type of the variable can be only influenced by the writing style
# of the value.
#
# The next tests should give an example for these properties.
--disable_warnings
drop table if exists t5 ;
--enable_warnings
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
set @arg04= 'abc' ;
set @arg05= CAST('abc' as binary) ;
set @arg06= '1991-08-05' ;
set @arg07= CAST('1991-08-05' as date);
set @arg08= '1991-08-05 01:01:01' ;
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
set @arg10= unix_timestamp('1991-01-01 01:01:01');
set @arg11= YEAR('1991-01-01 01:01:01');
# This first assignment to @arg<n> fixes the type of the variable
# The second assignment sets the value to NULL, but it does not change
# the numeric types.
set @arg12= 8 ;
set @arg12= NULL ;
set @arg13= 8.0 ;
set @arg13= NULL ;
set @arg14= 'abc';
set @arg14= NULL ;
set @arg15= CAST('abc' as binary) ;
set @arg15= NULL ;
create table t5 as select
8 as const01, @arg01 as param01,
8.0 as const02, @arg02 as param02,
80.00000000000e-1 as const03, @arg03 as param03,
'abc' as const04, @arg04 as param04,
CAST('abc' as binary) as const05, @arg05 as param05,
'1991-08-05' as const06, @arg06 as param06,
CAST('1991-08-05' as date) as const07, @arg07 as param07,
'1991-08-05 01:01:01' as const08, @arg08 as param08,
CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
NULL as const12, @arg12 as param12,
@arg13 as param13,
@arg14 as param14,
@arg15 as param15;
# Bug#4788 show create table provides incorrect statement
show create table t5 ;
--vertical_results
--enable_metadata
select * from t5 ;
--disable_metadata
--horizontal_results
drop table t5 ;
# But there seems to be also an implicit conversion of C-API
# data types to a smaller number of base data types.
#
# Example: C-API for prepared statements
# CREATE TABLE abc as SELECT ? as a, ? as b, ...
#
# MYSQL_TYPE of parameter column type
# MYSQL_TYPE_TINY bigint(4)
# MYSQL_TYPE_SHORT bigint(6)
# MYSQL_TYPE_FLOAT double
# ...
#
# So we can hope that the functionality of mysqltest + user variables
# sufficient to simulate much of the behaviour of the C-API
# vis-a-vis the server.
# The main test object is the table t9, defined as follows:
#
# eval create table t9
# (
# c1 tinyint, c2 smallint, c3 mediumint, c4 int,
# c5 integer, c6 bigint, c7 float, c8 double,
# c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
# c13 date, c14 datetime, c15 timestamp(14), c16 time,
# c17 year, c18 bit, c19 bool, c20 char,
# c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
# c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
# c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
# c32 set('monday', 'tuesday', 'wednesday'),
# primary key(c1)
# ) engine = $type ;
# We test each statement in non-prepared mode and in prepared mode
# for comparison purposes.
#
# We test the following conversions:
# BIGINT -> the rest of numeric columns
# CHAR, LONGTEXT, LONGBLOB, NULL, FLOAT, REAL, DOUBLE -> numeric columns
# FLOAT, REAL, CHAR, LONGTEXT, BINARY, BIGINT -> string
# DATETIME, TIME -> text, and back
--disable_query_log
select '------ data type conversion tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
# insert a record with many NULLs
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
select * from t9 order by c1 ;
############ select @parm:= .. / select .. into @parm tests ############
--disable_query_log
select '------ select @parameter:= column ------' as test_sequence ;
--enable_query_log
# PS query to retrieve the content of the @variables
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
@arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12,
@arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20,
@arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28,
@arg29, @arg30, @arg31, @arg32" ;
# non PS statement for comparison purposes
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 1 ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# now the same procedure with the record containing so many NULLs
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 0 ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
prepare stmt1 from "select
@arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# now the same procedure with the record containing so many NULLs
set @my_key= 0 ;
execute stmt1 using @my_key ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# the next statement must fail
--error 1064
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
--disable_query_log
select '------ select column, .. into @parm,.. ------' as test_sequence ;
--enable_query_log
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 1 ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# now the same procedure with the record containing so many NULLs
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 0 ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# now the same procedure with the record containing so many NULLs
# Bug#5034: prepared "select 1 into @arg15", second execute crashes server
set @my_key= 0 ;
execute stmt1 using @my_key ;
# get as much informations about the parameters as possible
--enable_metadata
execute full_info ;
--disable_metadata
# the next statement must fail
--error 1064
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
######################### test of numeric types ##########################
# #
# c1 tinyint, c2 smallint, c3 mediumint, c4 int, #
# c5 integer, c6 bigint, c7 float, c8 double, #
# c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4), #
# #
##########################################################################
--disable_query_log
select '-- insert into numeric columns --' as test_sequence ;
--enable_query_log
######## INSERT into .. numeric columns values(BIGINT(n),BIGINT) ########
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
set @arg00= 21 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
execute stmt1 ;
set @arg00= 23;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(DOUBLE(m,n),DOUBLE) ########
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0 ) ;
set @arg00= 31.0 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
32.0, 32.0, 32.0 )" ;
execute stmt1 ;
set @arg00= 33.0;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(CHAR(n),LONGTEXT) #########
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '40', '40', '40', '40', '40', '40', '40', '40',
'40', '40', '40' ) ;
set @arg00= '41' ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '42', '42', '42', '42', '42', '42', '42', '42',
'42', '42', '42' )" ;
execute stmt1 ;
set @arg00= '43';
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(BINARY(n),LONGBLOB) ########
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
set @arg00= CAST('51' as binary) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('53' as binary) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(BIGINT,NULL) ########
# we first assign number to arg00 to set it's datatype to numeric.
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL ) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(DOUBLE,NULL) ########
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. numeric columns values(LONGBLOB,NULL) ########
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## SELECT of all inserted records ########
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c1 >= 20
order by c1 ;
--disable_query_log
select '-- select .. where numeric column = .. --' as test_sequence ;
--enable_query_log
######## SELECT .. WHERE column(numeric)=value(BIGINT(n)/BIGINT) ########
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(numeric)=value(DOUBLE(m,n)/DOUBLE) ########
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(numeric)=value(CHAR(n)/LONGTEXT) ########
select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
prepare stmt1 from "select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
execute stmt1 ;
set @arg00= '20';
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(numeric)=value(BINARY(n)/LONGBLOB) ########
select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary);
prepare stmt1 from "select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary) ";
execute stmt1 ;
set @arg00= CAST('20' as binary) ;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
delete from t9 ;
#################### Some overflow experiments ################################
# #
# MySQL Manual (July 2004) #
# - Setting a numeric column to a value that lies outside the column's range. #
# The value is clipped to the closest endpoint of the range. #
# ... #
# - For example, inserting the string '1999.0e-2' into an INT, FLOAT, #
# DECIMAL(10,6), or YEAR column results in the values 1999, 19.9921, #
# 19.992100, and 1999. #
# That means there is an anomaly if a float value is assigned via string to #
# a column of type bigint. The string will be cut from the right side to #
# a "usable" integer value. #
# #
###############################################################################
--disable_query_log
select '-- some numeric overflow experiments --' as test_sequence ;
--enable_query_log
prepare my_insert from "insert into t9
( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
# (BIGINT,FLOAT,REAL,DOUBLE) during insert
#
# Use the maximum BIGINT from the manual
set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
# Use the minimum BIGINT from the manual
#
set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
# Numeric overflow of columns(c1, c2, c3, c4, c5, c12) with type not in
# (FLOAT,REAL,DOUBLE) during insert
#
set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
# because the string is treated as written integer and
# '.11111111111111111111e+50' is cut away.
set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
# Attention: The columns(c1,c2,c3,c4,c5,c6) do not get the overflow,
# because the string is treated as written integer and
# '.11111111111111111111e+50' is cut away.
set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
--vertical_results
execute my_select ;
--horizontal_results
execute my_delete ;
########################## test of string types ##########################
# #
# c20 char, c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext, #
# c25 blob, c26 text, c27 mediumblob, c28 mediumtext, c29 longblob, #
# c30 longtext, c31 enum('one', 'two', 'three') #
# #
##########################################################################
--disable_query_log
select '-- insert into string columns --' as test_sequence ;
--enable_query_log
######## INSERT into .. string columns values(CHAR(n),LONGTEXT) ########
--disable_query_log
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 20, '20', '20', '20', '20', '20', '20', '20', '20', '20', '20', '20' ) ;
set @arg00= '21' ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 21, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 22, '22', '22', '22', '22', '22', '22', '22', '22', '22', '22', '22' )" ;
execute stmt1 ;
set @arg00= '23';
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(BINARY(n),LONGBLOB) ########
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 30, CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
CAST('30' as binary), CAST('30' as binary), CAST('30' as binary),
CAST('30' as binary), CAST('30' as binary) ) ;
set @arg00= '31' ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 31, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 32, CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
CAST('32' as binary), CAST('32' as binary), CAST('32' as binary),
CAST('32' as binary), CAST('32' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('33' as binary);
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(BIGINT(n),BIGINT) ########
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 ) ;
set @arg00= 41 ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 41, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 )" ;
execute stmt1 ;
set @arg00= 43;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 50, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0, 50.0 ) ;
set @arg00= 51.0 ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 52, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0, 52.0 )" ;
execute stmt1 ;
set @arg00= 53.0;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(DOUBLE(m,n),DOUBLE) ########
# typical float writing style
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 54, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1, 5.4e+1,
5.4e+1, 5.4e+1, 5.4e+1 ) ;
set @arg00= 5.5e+1 ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 55, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 56, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1, 5.6e+1,
5.6e+1, 5.6e+1, 5.6e+1 )" ;
execute stmt1 ;
set @arg00= 5.7e+1;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 57, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(LONGBLOB,NULL) ########
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(BIGINT,NULL) ########
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. string columns values(DOUBLE,NULL) ########
set @arg00= 8 ;
set @arg00= NULL ;
insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
--enable_query_log
######## SELECT of all inserted records ########
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
from t9 where c1 >= 20
order by c1 ;
--disable_query_log
select '-- select .. where string column = .. --' as test_sequence ;
--enable_query_log
######## SELECT .. WHERE column(string)=value(CHAR(n)/LONGTEXT) ########
set @arg00= '20';
# c20 (char) must be extended for the comparison
select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(string)=value(BINARY(n)/LONGBLOB) ########
set @arg00= CAST('20' as binary);
# c20 (char) must be extended for the comparison
select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary) ;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
c30= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary)" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
c29= ? and c30= ?";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(string)=value(BIGINT(m,n),BIGINT) ########
set @arg00= 20;
# c20 (char) must be extended for the comparison
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(string)=value(DOUBLE(m,n),DOUBLE) ########
set @arg00= 20.0;
# c20 (char) must be extended for the comparison
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
delete from t9 ;
######################### test of date/time columns ########################
# #
# c13 date, c14 datetime, c15 timestamp(14), c16 time, c17 year #
# #
############################################################################
--disable_query_log
select '-- insert into date/time columns --' as test_sequence ;
--enable_query_log
######## INSERT into .. date/time columns values(VARCHAR(19),LONGTEXT) ########
--disable_query_log
set @arg00= '1991-01-01 01:01:01' ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 20, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
'1991-01-01 01:01:01', '1991-01-01 01:01:01') ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 21, @arg00, @arg00, @arg00, @arg00, @arg00) ;
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 22, '1991-01-01 01:01:01', '1991-01-01 01:01:01', '1991-01-01 01:01:01',
'1991-01-01 01:01:01', '1991-01-01 01:01:01')" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 23, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(DATETIME,LONGBLOB) ########
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 30, CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime)) ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 31, @arg00, @arg00, @arg00, @arg00, @arg00) ;
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 32, CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime),
CAST('1991-01-01 01:01:01' as datetime))" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 33, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(BIGINT(n),BIGINT) ########
set @arg00= 2000000000 ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 40, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 ) ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 41, @arg00, @arg00, @arg00, @arg00, @arg00) ;
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 42, 2000000000, 2000000000, 2000000000, 2000000000, 2000000000 )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 43, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(DOUBLE(m,n),DOUBLE) ########
set @arg00= 1.0e+10 ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 50, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 ) ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 51, @arg00, @arg00, @arg00, @arg00, @arg00) ;
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 52, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10, 1.0e+10 )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 53, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(LONGBLOB,NULL) ########
# Attention: c15 is timestamp and the manual says:
# The first TIMESTAMP column in table row automatically is updated
# to the current timestamp when the value of any other column in the
# row is changed, unless the TIMESTAMP column explicitly is assigned
# a value other than NULL.
# That's why a fixed NOT NULL value is inserted.
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 60, NULL, NULL, '1991-01-01 01:01:01',
NULL, NULL) ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 61, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
prepare stmt1 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 62, NULL, NULL, '1991-01-01 01:01:01',
NULL, NULL)" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 63, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(BIGINT,NULL) ########
set @arg00= 8 ;
set @arg00= NULL ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 71, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 73, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
######## INSERT into .. date/time columns values(DOUBLE,NULL) ########
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 81, @arg00, @arg00, '1991-01-01 01:01:01', @arg00, @arg00) ;
prepare stmt2 from "insert into t9
( c1, c13, c14, c15, c16, c17 )
values
( 83, ?, ?, '1991-01-01 01:01:01', ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00 ;
--enable_query_log
######## SELECT of all inserted records ########
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
--disable_query_log
select '-- select .. where date/time column = .. --' as test_sequence ;
--enable_query_log
######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(date/time/..)=value(DATETIME/LONGBLOB) ########
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
######## SELECT .. WHERE column(year)=value(INT(10)/BIGINT) ########
set @arg00= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1991" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ########
set @arg00= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
......@@ -19,7 +19,7 @@
#---- Please do not alter the following table definitions -------#
--disable_warnings
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
......@@ -28,7 +28,7 @@ eval create table t1
primary key(a)
) engine = $type ;
eval create table t_many_col_types
eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......
......@@ -14,12 +14,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
# whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# (DELETE/UPDATE/...) whenever possible.
# t1 - very simple table
# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
......@@ -124,17 +124,48 @@ set @arg04=2;
--disable_warnings
drop table if exists t2;
--enable_warnings
# t2 will be of table type 'MYISAM'
create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
--disable_info
select a,b from t1 order by a ;
drop table t2 ;
# t2 is now of table type '$type'
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
#
# Test UPDATE with SUBQUERY in prepared mode
#
eval create table t2
(
a int, b varchar(30),
primary key(a)
) engine = $type ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
--disable_info
select a,b from t1 order by a ;
drop table t2 ;
## update with parameters in limit
......@@ -179,6 +210,46 @@ set @arg01='eight' ;
prepare stmt1 from 'insert into t1 values(?, ? )';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
# cases derived from client_test.c: test_null()
set @NULL= null ;
set @arg00= 'abc' ;
# execute must fail, because first column is primary key (-> not null)
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg00 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @NULL ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 10;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg01 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
## insert with two rows in values part
set @arg00=81 ;
......@@ -208,6 +279,22 @@ set @arg01=1 ;
--error 1062
execute stmt1 using @arg00, @arg01;
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
# cases derived from client_test.c: test_bug3117()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval create table t2 (id int auto_increment primary key)
ENGINE= $type ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
insert into t2 values (NULL) ;
# bug#3117
execute stmt1 ;
drop table t2 ;
## many parameters
set @1000=1000 ;
set @x1000_2="x1000_2" ;
......@@ -237,3 +324,34 @@ delete from t1 where a >= 1000 ;
## replace
--error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
## multi table statements
--disable_query_log
select '------ multi table tests ------' as test_sequence ;
--enable_query_log
# cases derived from client_test.c: test_multi
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
let $1= 3 ;
while ($1)
{
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
execute stmt_select2 ;
set @arg00= @arg00 + 1 ;
dec $1 ;
}
......@@ -20,12 +20,12 @@
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
#
# But you are encouraged to use these two tables within your statements
# (DELETE/UPDATE/...) whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# t1 - very simple table
# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
......@@ -41,6 +41,11 @@
#-------- Please be very carefull when editing behind this line ----------#
--source include/ps_renew.inc
#
# add a NULL row to t1: this row is used only in this test
insert into t1 values(0,NULL) ;
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;
......
......@@ -15,13 +15,13 @@
#
# Please do not modify (INSERT/UPDATE/DELETE) the content or the
# structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
# Such tests should be done in include/ps_modify.inc .
#
# But you are encouraged to use these two tables within your SELECT statements
# whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# t1 - very simple table
# t9 - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
......@@ -38,10 +38,18 @@
#-------- Please be very carefull when editing behind this line ----------#
################ simple select tests ################
--disable_query_log
select '------ simple select tests ------' as test_sequence ;
--enable_query_log
##### many column types, but no parameter
# heavy modified case derived from client_test.c: test_func_fields()
prepare stmt1 from ' select * from t9 ' ;
--enable_metadata
execute stmt1;
--disable_metadata
##### parameter used for keyword like SELECT (must fail)
set @arg00='SELECT' ;
# mysqltest gives no output for the next statement, Why ??
......@@ -70,6 +78,17 @@ set @arg00=1 ;
select b, a - @arg00 from t1 where a=1 ;
prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
# case derived from client_test.c: test_ps_null_param()
set @arg00=null ;
select @arg00 as my_col ;
prepare stmt1 from ' select ? as my_col';
execute stmt1 using @arg00 ;
select @arg00 + 1 as my_col ;
prepare stmt1 from ' select ? + 1 as my_col';
execute stmt1 using @arg00 ;
select 1 + @arg00 as my_col ;
prepare stmt1 from ' select 1 + ? as my_col';
execute stmt1 using @arg00 ;
## parameter is within a function
# variations on 'substr'
set @arg00='MySQL' ;
......@@ -86,7 +105,7 @@ execute stmt1 using @arg00 ;
# variations on 'concat'
set @arg00='MySQL' ;
select a , concat(@arg00,b) from t1 ;
# BUG#3796
# BUG#3796 Prepared statement, select concat(<parameter>,<column>),wrong result
prepare stmt1 from ' select a , concat(?,b) from t1 ' ;
execute stmt1 using @arg00;
#
......@@ -122,25 +141,25 @@ execute stmt1 using @arg02, @arg02 ;
# case derived from client_test.c: test_ps_conj_select()
# for BUG#3420: select returned all rows of the table
--disable_warnings
drop table if exists new_tab ;
drop table if exists t5 ;
--enable_warnings
create table new_tab (id1 int(11) not null default '0',
create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
drop table new_tab ;
drop table t5 ;
# case derived from client_test.c: test_bug1180()
# for BUG#1180 optimized away part of WHERE clause
--disable_warnings
drop table if exists new_tab ;
drop table if exists t5 ;
--enable_warnings
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
create table t5(session_id char(9) not null) ;
insert into t5 values ('abc') ;
prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
......@@ -148,7 +167,7 @@ set @arg00='1111' ;
execute stmt1 using @arg00 ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
drop table new_tab ;
drop table t5 ;
##### parameter used for keyword FROM (must fail)
......@@ -200,6 +219,12 @@ set @arg01=3 ;
select a FROM t1 where a in (@arg00,@arg01);
prepare stmt1 from ' select a FROM t1 where a in (?,?) ';
execute stmt1 using @arg00, @arg01;
# case derived from client_test.c: test_bug1500()
set @arg00= 'one' ;
set @arg01= 'two' ;
set @arg02= 'five' ;
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ;
execute stmt1 using @arg00, @arg01, @arg02 ;
# parameter in LIKE
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
......@@ -208,6 +233,24 @@ set @arg00='tw%' ;
execute stmt1 using @arg00 ;
set @arg00='%wo' ;
execute stmt1 using @arg00 ;
# case derived from client_test.c: test_ps_null_param():
# second part, comparisions with NULL placeholders in prepared
# mode
set @arg00=null ;
insert into t9 set c1= 0, c5 = NULL ;
select c5 from t9 where c5 > NULL ;
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
execute stmt1 using @arg00 ;
select c5 from t9 where c5 < NULL ;
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
execute stmt1 using @arg00 ;
select c5 from t9 where c5 = NULL ;
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
execute stmt1 using @arg00 ;
select c5 from t9 where c5 <=> NULL ;
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
execute stmt1 using @arg00 ;
delete from t9 where c1= 0 ;
##### parameter used for operator in WHERE clause (must fail)
set @arg00='>' ;
......@@ -276,6 +319,7 @@ having sum(a) <> ? ';
execute stmt1 using @arg00, @arg01, @arg02, @arg03;
################ join tests ################
--disable_query_log
select '------ join tests ------' as test_sequence ;
--enable_query_log
......@@ -301,8 +345,39 @@ prepare stmt1 from ' select first.a, ?, second.a FROM t1 first, t1 second
order by second.a, first.a';
execute stmt1 using @arg00, @arg01, @arg02;
# test case derived from client_test.c: test_join()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
let $1= 9 ;
while ($1)
{
--disable_query_log
eval select @query$1 as 'the join statement is:' ;
--enable_query_log
eval prepare stmt1 from @query$1 ;
let $2= 3 ;
while ($2)
{
execute stmt1 ;
dec $2 ;
}
dec $1 ;
}
drop table t2 ;
################ subquery tests ################
--disable_query_log
select '------ subquery tests ------' as test_sequence ;
--enable_query_log
......@@ -350,8 +425,20 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
# no parameter
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) ';
# also Bug#4000 (only BDB tables) ??
# also Bug#4000 (only BDB tables)
# Bug#4106 : ndb table, query with correlated subquery, wrong result
execute stmt1 ;
# test case derived from client_test.c: test_subqueries_ref
let $1= 3 ;
while ($1)
{
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
deallocate prepare stmt1 ;
dec $1 ;
}
###### parameter in the outer part
set @arg00='two' ;
......@@ -360,7 +447,7 @@ select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
prepare stmt1 from ' select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b) and b=? ';
# also Bug#4000 (only BDB tables) ??
# also Bug#4000 (only BDB tables)
execute stmt1 using @arg00;
###### parameter in the inner part
......@@ -390,7 +477,7 @@ select a, @arg00, b FROM t1 outer_table where
prepare stmt1 from ' select a, ?, b FROM t1 outer_table where
b=? and a = (select ? from t1 where outer_table.b = ?
and outer_table.a=a ) ' ;
# also Bug#4000 (only BDB tables) ??
# also Bug#4000 (only BDB tables)
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
###### subquery after from
......@@ -404,43 +491,76 @@ prepare stmt1 from ' select a, ?
where a=? ';
execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
###### subquery in select list
# test case derived from client_test.c: test_create_drop
--disable_warnings
drop table if exists t2 ;
--enable_warnings
create table t2 as select * from t1;
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
execute stmt1 ;
# test case derived from client_test.c: test_selecttmp()
--disable_warnings
drop table if exists t5, t6, t7 ;
--enable_warnings
create table t5 (a int , b int) ;
create table t6 like t5 ;
create table t7 like t5 ;
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
(2, -1), (3, 10) ;
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
insert into t7 values (3, 3), (2, 2), (1, 1) ;
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1) from t7 ' ;
let $1= 3 ;
while ($1)
{
execute stmt1 ;
dec $1 ;
}
drop table t5, t6, t7 ;
###### heavy modified case derived from client_test.c: test_distinct()
## no parameters
--disable_warnings
drop table if exists t2 ;
--enable_warnings
create table t2 as select * from t_many_col_types;
#insert into t2 select * from t_many_col_types;
create table t2 as select * from t9;
## unusual and complex SELECT without parameters
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
where (t9.c2 - 0e-3) = t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 ;
--disable_metadata
execute stmt1 ;
## now expand the terrible SELECT to EXPLAIN SELECT
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
execute stmt1 ;
--disable_metadata
# Bug#4271 prepared explain complex select, second executes crashes the server
execute stmt1 ;
## many parameters
## replace the constants of the complex SELECT with parameters
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
where t2.c3*?=t9.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
......@@ -459,6 +579,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
--disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
## now expand the terrible SELECT to EXPLAIN SELECT
set @stmt= concat('explain ',@stmt);
--enable_metadata
prepare stmt1 from @stmt ;
......@@ -470,6 +591,17 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
drop table t2 ;
##### test case derived from client_test.c: test_bug4079()
--error 1242
select 1 < (select a from t1) ;
prepare stmt1 from ' select 1 < (select a from t1) ' ;
--error 1242
execute stmt1 ;
# Bug#5066 embedded server, select after failed subquery provides wrong result
# (two additional records, all column values NULL)
select 1 as my_col ;
################ union tests ################
--disable_query_log
select '------ union tests ------' as test_sequence ;
--enable_query_log
......@@ -485,6 +617,16 @@ prepare stmt1 from ' select a FROM t1 where a=1
union all
select a FROM t1 where a=1 ';
execute stmt1 ;
# test case derived from client_test.c: test_bad_union()
--error 1222
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
--error 1222
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
--error 1222
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
--error 1222
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
##### everything in the first table
# one parameter as constant in the first table
......@@ -612,10 +754,13 @@ prepare stmt1 from ' select sum(a) + 200 as the_sum, ? as the_town from t1
execute stmt1 using @Oporto, @1, @2, @Lisboa, @2, @3;
################ explain select tests ################
--disable_query_log
select '------ explain select tests ------' as test_sequence ;
--enable_query_log
prepare stmt1 from ' select * from t_many_col_types ' ;
--disable_metadata
# table with many column types
prepare stmt1 from ' explain select * from t9 ' ;
--enable_metadata
execute stmt1;
--disable_metadata
......
################ include/ps_renew.inc #################
# #
# renew the content of t1 and t_many_col_types #
# renew the content of t1 and t9 #
# #
#######################################################
......@@ -13,8 +13,8 @@ insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -23,7 +23,7 @@ set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -32,3 +32,4 @@ set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
use test;
test_sequence
------ basic tests ------
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -26,8 +26,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -36,7 +36,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -45,6 +45,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
PREPARE stmt FROM ' select * from t1 where a = ? ' ;
SET @var= 2 ;
EXECUTE stmt USING @var ;
......@@ -85,6 +86,10 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from t1 where x <= 2 ' ;
ERROR 42S22: Unknown column 'x' in 'where clause'
prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
ERROR 42S22: Unknown column 'x' in 'field list'
prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
ERROR 42S22: Unknown column 'x' in 'field list'
drop table if exists not_exist ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
......@@ -100,87 +105,87 @@ prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
execute stmt1 ;
ERROR HY000: Unknown prepared statement handler (stmt1) given to EXECUTE
create table to_be_dropped
create table t5
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 1, 'original table', 1);
prepare stmt2 from ' select * from to_be_dropped ' ;
insert into t5( a, b, c) values( 1, 'original table', 1);
prepare stmt2 from ' select * from t5 ' ;
execute stmt2 ;
a b c
1 original table 1
drop table to_be_dropped ;
drop table t5 ;
execute stmt2 ;
ERROR 42S02: Table 'test.to_be_dropped' doesn't exist
create table to_be_dropped
ERROR 42S02: Table 'test.t5' doesn't exist
create table t5
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
drop table t5 ;
create table t5
(
a int primary key,
c int,
b char(30)
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
drop table t5 ;
create table t5
(
a int primary key,
b char(30),
c int,
d timestamp default current_timestamp
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
drop table t5 ;
create table t5
(
a int primary key,
d timestamp default current_timestamp,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
a b c
9 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
drop table t5 ;
create table t5
(
a timestamp default '2004-02-29 18:01:59',
b char(30),
c int
);
insert into to_be_dropped( b, c) values( 'recreated table', 9);
insert into t5( b, c) values( 'recreated table', 9);
execute stmt2 ;
a b c
2004-02-29 18:01:59 recreated table 9
drop table to_be_dropped ;
create table to_be_dropped
drop table t5 ;
create table t5
(
f1 int primary key,
f2 char(30),
f3 int
);
insert into to_be_dropped( f1, f2, f3) values( 9, 'recreated table', 9);
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
execute stmt2 ;
ERROR 42S22: Unknown column 'to_be_dropped.a' in 'field list'
drop table to_be_dropped ;
ERROR 42S22: Unknown column 't5.a' in 'field list'
drop table t5 ;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
execute stmt1 ;
a b
......@@ -205,13 +210,13 @@ prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
ERROR 42S02: Table 'test.not_exist' doesn't exist
deallocate prepare stmt1;
ERROR HY000: Unknown prepared statement handler (stmt1) given to DEALLOCATE PREPARE
create table to_be_dropped
create table t5
(
a int primary key,
b char(10)
);
prepare stmt2 from ' select a,b from to_be_dropped where a <= 2 ' ;
drop table to_be_dropped ;
prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
drop table t5 ;
deallocate prepare stmt2;
prepare stmt1 from ' select a from t1 where a <= 2 ' ;
prepare stmt2 from ' select b from t1 where a <= 2 ' ;
......@@ -268,10 +273,10 @@ prepare stmt4 from ' show table status from test like ''t2%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t2 MyISAM 9 Fixed 0 0 0 64424509439 1024 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show table status from test like ''t_many_col_types%'' ';
prepare stmt4 from ' show table status from test like ''t9%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t_many_col_types MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
t9 MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
Variable_name Value
......@@ -318,14 +323,63 @@ NDB YES/NO Alias for NDBCLUSTER
EXAMPLE YES/NO Example storage engine
ARCHIVE YES/NO Archive storage engine
CSV YES/NO CSV storage engine
drop table if exists tx;
prepare stmt1 from ' drop table if exists tx ' ;
drop table if exists t5;
prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
Warnings:
Note 1051 Unknown table 'tx'
prepare stmt1 from ' drop table tx ' ;
Note 1051 Unknown table 't5'
prepare stmt1 from ' drop table t5 ' ;
execute stmt1 ;
ERROR 42S02: Unknown table 't5'
prepare stmt1 from ' SELECT @@version ' ;
execute stmt1 ;
ERROR 42S02: Unknown table 'tx'
@@VERSION
<version>
prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
execute stmt_do ;
content of @var is:
1
execute stmt_set ;
content of @var is:
1
execute stmt_do ;
content of @var is:
1
execute stmt_set ;
content of @var is:
1
execute stmt_do ;
content of @var is:
1
execute stmt_set ;
content of @var is:
1
drop table if exists t5 ;
create table t5 (a int) ;
prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
execute stmt_do ;
content of @var is:
0
execute stmt_set ;
content of @var is:
0
execute stmt_do ;
content of @var is:
0
execute stmt_set ;
content of @var is:
0
execute stmt_do ;
content of @var is:
0
execute stmt_set ;
content of @var is:
0
drop table t5 ;
deallocate prepare stmt_do ;
deallocate prepare stmt_set ;
prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
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 '' select 1 '' at line 1
prepare stmt1 from ' execute stmt2 ' ;
......@@ -441,6 +495,38 @@ def rows 8 10 1 N 32801 0 8
def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
drop table if exists t2;
create table t2 (id smallint, name varchar(20)) ;
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
set @id= 9876 ;
set @arg00= 'MySQL - Open Source Database' ;
set @arg01= "'" ;
set @arg02= '"' ;
set @arg03= "my'sql'" ;
set @arg04= 'my"sql"' ;
insert into t2 values ( @id , @arg00 );
Warnings:
Warning 1265 Data truncated for column 'name' at row 1
insert into t2 values ( @id , @arg01 );
insert into t2 values ( @id , @arg02 );
insert into t2 values ( @id , @arg03 );
insert into t2 values ( @id , @arg04 );
prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
execute stmt1 using @id, @arg00 ;
id name
execute stmt1 using @id, @arg01 ;
id name
9876 '
execute stmt1 using @id, @arg02 ;
id name
9876 "
execute stmt1 using @id, @arg03 ;
id name
9876 my'sql'
execute stmt1 using @id, @arg04 ;
id name
9876 my"sql"
drop table t2;
test_sequence
------ create/drop/alter/rename tests ------
drop table if exists t2, t3;
......@@ -472,9 +558,21 @@ execute stmt3;
ERROR 42S01: Table 'new_t2' already exists
rename table new_t2 to t2;
drop table t2;
drop table if exists t5, t6, t7, t8 ;
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
execute stmt1 ;
ERROR HY000: Can't find file: './test/t7.frm' (errno: 2)
create table t7 (a int) ;
execute stmt1 ;
execute stmt1 ;
ERROR 42S01: Table 't6' already exists
rename table t6 to t5, t8 to t7 ;
execute stmt1 ;
drop table t6, t8 ;
test_sequence
------ big statement tests ------
select 'ABC' as my_const_col from t1 where
(select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
......@@ -523,13 +621,13 @@ select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 ;
1 = 1 ) ;
my_const_col
ABC
ABC
ABC
ABC
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
prepare stmt1 from "select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
......@@ -578,7 +676,7 @@ prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 ' ;
1 = 1 " ;
execute stmt1 ;
my_const_col
ABC
......@@ -591,7 +689,7 @@ ABC
ABC
ABC
ABC
select 'ABC' as my_const_col FROM t1 WHERE
(select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
......@@ -609,31 +707,31 @@ select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
= '1234567890123456789012345678901234567890123456789012345678901234567890' ) ;
my_const_col
ABC
ABC
ABC
ABC
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' ';
prepare stmt1 from "select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' " ;
execute stmt1 ;
my_const_col
ABC
......@@ -646,56 +744,6 @@ ABC
ABC
ABC
ABC
set @arg00= 1;
set @arg01= 1;
set @arg02= 1;
set @arg03= 1;
set @arg04= 1;
set @arg05= 1;
set @arg06= 1;
set @arg07= 1;
set @arg10= 1;
set @arg11= 1;
set @arg12= 1;
set @arg13= 1;
set @arg14= 1;
set @arg15= 1;
set @arg16= 1;
set @arg17= 1;
set @arg20= 1;
set @arg21= 1;
set @arg22= 1;
set @arg23= 1;
set @arg24= 1;
set @arg25= 1;
set @arg26= 1;
set @arg27= 1;
set @arg30= 1;
set @arg31= 1;
set @arg32= 1;
set @arg33= 1;
set @arg34= 1;
set @arg35= 1;
set @arg36= 1;
set @arg37= 1;
set @arg40= 1;
set @arg41= 1;
set @arg42= 1;
set @arg43= 1;
set @arg44= 1;
set @arg45= 1;
set @arg46= 1;
set @arg47= 1;
set @arg50= 1;
set @arg51= 1;
set @arg52= 1;
set @arg53= 1;
set @arg54= 1;
set @arg55= 1;
set @arg56= 1;
set @arg57= 1;
set @arg60= 1;
set @arg61= 1;
select 'ABC' as my_const_col FROM t1 WHERE
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
......@@ -743,4 +791,92 @@ ABC
ABC
ABC
ABC
drop table if exists t5 ;
set @col_num= 1000 ;
select @string as "" ;
create table t5( c999 int,c998 int,c997 int,c996 int,c995 int,c994 int,c993 int,c992 int,c991 int,c990 int,c989 int,c988 int,c987 int,c986 int,c985 int,c984 int,c983 int,c982 int,c981 int,c980 int,c979 int,c978 int,c977 int,c976 int,c975 int,c974 int,c973 int,c972 int,c971 int,c970 int,c969 int,c968 int,c967 int,c966 int,c965 int,c964 int,c963 int,c962 int,c961 int,c960 int,c959 int,c958 int,c957 int,c956 int,c955 int,c954 int,c953 int,c952 int,c951 int,c950 int,c949 int,c948 int,c947 int,c946 int,c945 int,c944 int,c943 int,c942 int,c941 int,c940 int,c939 int,c938 int,c937 int,c936 int,c935 int,c934 int,c933 int,c932 int,c931 int,c930 int,c929 int,c928 int,c927 int,c926 int,c925 int,c924 int,c923 int,c922 int,c921 int,c920 int,c919 int,c918 int,c917 int,c916 int,c915 int,c914 int,c913 int,c912 int,c911 int,c910 int,c909 int,c908 int,c907 int,c906 int,c905 int,c904 int,c903 int,c902 int,c901 int,c900 int,c899 int,c898 int,c897 int,c896 int,c895 int,c894 int,c893 int,c892 int,c891 int,c890 int,c889 int,c888 int,c887 int,c886 int,c885 int,c884 int,c883 int,c882 int,c881 int,c880 int,c879 int,c878 int,c877 int,c876 int,c875 int,c874 int,c873 int,c872 int,c871 int,c870 int,c869 int,c868 int,c867 int,c866 int,c865 int,c864 int,c863 int,c862 int,c861 int,c860 int,c859 int,c858 int,c857 int,c856 int,c855 int,c854 int,c853 int,c852 int,c851 int,c850 int,c849 int,c848 int,c847 int,c846 int,c845 int,c844 int,c843 int,c842 int,c841 int,c840 int,c839 int,c838 int,c837 int,c836 int,c835 int,c834 int,c833 int,c832 int,c831 int,c830 int,c829 int,c828 int,c827 int,c826 int,c825 int,c824 int,c823 int,c822 int,c821 int,c820 int,c819 int,c818 int,c817 int,c816 int,c815 int,c814 int,c813 int,c812 int,c811 int,c810 int,c809 int,c808 int,c807 int,c806 int,c805 int,c804 int,c803 int,c802 int,c801 int,c800 int,c799 int,c798 int,c797 int,c796 int,c795 int,c794 int,c793 int,c792 int,c791 int,c790 int,c789 int,c788 int,c787 int,c786 int,c785 int,c784 int,c783 int,c782 int,c781 int,c780 int,c779 int,c778 int,c777 int,c776 int,c775 int,c774 int,c773 int,c772 int,c771 int,c770 int,c769 int,c768 int,c767 int,c766 int,c765 int,c764 int,c763 int,c762 int,c761 int,c760 int,c759 int,c758 int,c757 int,c756 int,c755 int,c754 int,c753 int,c752 int,c751 int,c750 int,c749 int,c748 int,c747 int,c746 int,c745 int,c744 int,c743 int,c742 int,c741 int,c740 int,c739 int,c738 int,c737 int,c736 int,c735 int,c734 int,c733 int,c732 int,c731 int,c730 int,c729 int,c728 int,c727 int,c726 int,c725 int,c724 int,c723 int,c722 int,c721 int,c720 int,c719 int,c718 int,c717 int,c716 int,c715 int,c714 int,c713 int,c712 int,c711 int,c710 int,c709 int,c708 int,c707 int,c706 int,c705 int,c704 int,c703 int,c702 int,c701 int,c700 int,c699 int,c698 int,c697 int,c696 int,c695 int,c694 int,c693 int,c692 int,c691 int,c690 int,c689 int,c688 int,c687 int,c686 int,c685 int,c684 int,c683 int,c682 int,c681 int,c680 int,c679 int,c678 int,c677 int,c676 int,c675 int,c674 int,c673 int,c672 int,c671 int,c670 int,c669 int,c668 int,c667 int,c666 int,c665 int,c664 int,c663 int,c662 int,c661 int,c660 int,c659 int,c658 int,c657 int,c656 int,c655 int,c654 int,c653 int,c652 int,c651 int,c650 int,c649 int,c648 int,c647 int,c646 int,c645 int,c644 int,c643 int,c642 int,c641 int,c640 int,c639 int,c638 int,c637 int,c636 int,c635 int,c634 int,c633 int,c632 int,c631 int,c630 int,c629 int,c628 int,c627 int,c626 int,c625 int,c624 int,c623 int,c622 int,c621 int,c620 int,c619 int,c618 int,c617 int,c616 int,c615 int,c614 int,c613 int,c612 int,c611 int,c610 int,c609 int,c608 int,c607 int,c606 int,c605 int,c604 int,c603 int,c602 int,c601 int,c600 int,c599 int,c598 int,c597 int,c596 int,c595 int,c594 int,c593 int,c592 int,c591 int,c590 int,c589 int,c588 int,c587 int,c586 int,c585 int,c584 int,c583 int,c582 int,c581 int,c580 int,c579 int,c578 int,c577 int,c576 int,c575 int,c574 int,c573 int,c572 int,c571 int,c570 int,c569 int,c568 int,c567 int,c566 int,c565 int,c564 int,c563 int,c562 int,c561 int,c560 int,c559 int,c558 int,c557 int,c556 int,c555 int,c554 int,c553 int,c552 int,c551 int,c550 int,c549 int,c548 int,c547 int,c546 int,c545 int,c544 int,c543 int,c542 int,c541 int,c540 int,c539 int,c538 int,c537 int,c536 int,c535 int,c534 int,c533 int,c532 int,c531 int,c530 int,c529 int,c528 int,c527 int,c526 int,c525 int,c524 int,c523 int,c522 int,c521 int,c520 int,c519 int,c518 int,c517 int,c516 int,c515 int,c514 int,c513 int,c512 int,c511 int,c510 int,c509 int,c508 int,c507 int,c506 int,c505 int,c504 int,c503 int,c502 int,c501 int,c500 int,c499 int,c498 int,c497 int,c496 int,c495 int,c494 int,c493 int,c492 int,c491 int,c490 int,c489 int,c488 int,c487 int,c486 int,c485 int,c484 int,c483 int,c482 int,c481 int,c480 int,c479 int,c478 int,c477 int,c476 int,c475 int,c474 int,c473 int,c472 int,c471 int,c470 int,c469 int,c468 int,c467 int,c466 int,c465 int,c464 int,c463 int,c462 int,c461 int,c460 int,c459 int,c458 int,c457 int,c456 int,c455 int,c454 int,c453 int,c452 int,c451 int,c450 int,c449 int,c448 int,c447 int,c446 int,c445 int,c444 int,c443 int,c442 int,c441 int,c440 int,c439 int,c438 int,c437 int,c436 int,c435 int,c434 int,c433 int,c432 int,c431 int,c430 int,c429 int,c428 int,c427 int,c426 int,c425 int,c424 int,c423 int,c422 int,c421 int,c420 int,c419 int,c418 int,c417 int,c416 int,c415 int,c414 int,c413 int,c412 int,c411 int,c410 int,c409 int,c408 int,c407 int,c406 int,c405 int,c404 int,c403 int,c402 int,c401 int,c400 int,c399 int,c398 int,c397 int,c396 int,c395 int,c394 int,c393 int,c392 int,c391 int,c390 int,c389 int,c388 int,c387 int,c386 int,c385 int,c384 int,c383 int,c382 int,c381 int,c380 int,c379 int,c378 int,c377 int,c376 int,c375 int,c374 int,c373 int,c372 int,c371 int,c370 int,c369 int,c368 int,c367 int,c366 int,c365 int,c364 int,c363 int,c362 int,c361 int,c360 int,c359 int,c358 int,c357 int,c356 int,c355 int,c354 int,c353 int,c352 int,c351 int,c350 int,c349 int,c348 int,c347 int,c346 int,c345 int,c344 int,c343 int,c342 int,c341 int,c340 int,c339 int,c338 int,c337 int,c336 int,c335 int,c334 int,c333 int,c332 int,c331 int,c330 int,c329 int,c328 int,c327 int,c326 int,c325 int,c324 int,c323 int,c322 int,c321 int,c320 int,c319 int,c318 int,c317 int,c316 int,c315 int,c314 int,c313 int,c312 int,c311 int,c310 int,c309 int,c308 int,c307 int,c306 int,c305 int,c304 int,c303 int,c302 int,c301 int,c300 int,c299 int,c298 int,c297 int,c296 int,c295 int,c294 int,c293 int,c292 int,c291 int,c290 int,c289 int,c288 int,c287 int,c286 int,c285 int,c284 int,c283 int,c282 int,c281 int,c280 int,c279 int,c278 int,c277 int,c276 int,c275 int,c274 int,c273 int,c272 int,c271 int,c270 int,c269 int,c268 int,c267 int,c266 int,c265 int,c264 int,c263 int,c262 int,c261 int,c260 int,c259 int,c258 int,c257 int,c256 int,c255 int,c254 int,c253 int,c252 int,c251 int,c250 int,c249 int,c248 int,c247 int,c246 int,c245 int,c244 int,c243 int,c242 int,c241 int,c240 int,c239 int,c238 int,c237 int,c236 int,c235 int,c234 int,c233 int,c232 int,c231 int,c230 int,c229 int,c228 int,c227 int,c226 int,c225 int,c224 int,c223 int,c222 int,c221 int,c220 int,c219 int,c218 int,c217 int,c216 int,c215 int,c214 int,c213 int,c212 int,c211 int,c210 int,c209 int,c208 int,c207 int,c206 int,c205 int,c204 int,c203 int,c202 int,c201 int,c200 int,c199 int,c198 int,c197 int,c196 int,c195 int,c194 int,c193 int,c192 int,c191 int,c190 int,c189 int,c188 int,c187 int,c186 int,c185 int,c184 int,c183 int,c182 int,c181 int,c180 int,c179 int,c178 int,c177 int,c176 int,c175 int,c174 int,c173 int,c172 int,c171 int,c170 int,c169 int,c168 int,c167 int,c166 int,c165 int,c164 int,c163 int,c162 int,c161 int,c160 int,c159 int,c158 int,c157 int,c156 int,c155 int,c154 int,c153 int,c152 int,c151 int,c150 int,c149 int,c148 int,c147 int,c146 int,c145 int,c144 int,c143 int,c142 int,c141 int,c140 int,c139 int,c138 int,c137 int,c136 int,c135 int,c134 int,c133 int,c132 int,c131 int,c130 int,c129 int,c128 int,c127 int,c126 int,c125 int,c124 int,c123 int,c122 int,c121 int,c120 int,c119 int,c118 int,c117 int,c116 int,c115 int,c114 int,c113 int,c112 int,c111 int,c110 int,c109 int,c108 int,c107 int,c106 int,c105 int,c104 int,c103 int,c102 int,c101 int,c100 int,c99 int,c98 int,c97 int,c96 int,c95 int,c94 int,c93 int,c92 int,c91 int,c90 int,c89 int,c88 int,c87 int,c86 int,c85 int,c84 int,c83 int,c82 int,c81 int,c80 int,c79 int,c78 int,c77 int,c76 int,c75 int,c74 int,c73 int,c72 int,c71 int,c70 int,c69 int,c68 int,c67 int,c66 int,c65 int,c64 int,c63 int,c62 int,c61 int,c60 int,c59 int,c58 int,c57 int,c56 int,c55 int,c54 int,c53 int,c52 int,c51 int,c50 int,c49 int,c48 int,c47 int,c46 int,c45 int,c44 int,c43 int,c42 int,c41 int,c40 int,c39 int,c38 int,c37 int,c36 int,c35 int,c34 int,c33 int,c32 int,c31 int,c30 int,c29 int,c28 int,c27 int,c26 int,c25 int,c24 int,c23 int,c22 int,c21 int,c20 int,c19 int,c18 int,c17 int,c16 int,c15 int,c14 int,c13 int,c12 int,c11 int,c10 int,c9 int,c8 int,c7 int,c6 int,c5 int,c4 int,c3 int,c2 int,c1 int,c0 int)
prepare stmt1 from @string ;
execute stmt1 ;
select @string as "" ;
insert into t5 values(1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 )
prepare stmt1 from @string ;
execute stmt1 ;
prepare stmt1 from ' select * from t5 ' ;
execute stmt1 ;
drop table t5 ;
test_sequence
------ grant/revoke/drop affects a parallel session test ------
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
grant usage on test.* to second_user@localhost
identified by 'looser' ;
grant select on test.t9 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
select current_user();
current_user()
second_user@localhost
show grants for current_user();
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
prepare s_t9 from 'select c1 as my_col
from t9 where c1= 1' ;
execute s_t9 ;
my_col
1
select a as my_col from t1;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
grant select on test.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
drop table t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
1
2
3
4
execute s_t9 ;
ERROR 42S02: Table 'test.t9' doesn't exist
revoke all privileges on test.t1 from second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
execute s_t1 ;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
drop user second_user@localhost ;
commit ;
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
drop table t1 ;
use test;
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -24,8 +24,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -34,7 +34,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -43,8 +43,47 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
test_sequence
------ simple select tests ------
prepare stmt1 from ' select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
def test t9 t9 c15 c15 7 19 19 N 1249 0 63
def test t9 t9 c16 c16 11 8 8 Y 128 0 63
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 252 255 8 Y 144 0 63
def test t9 t9 c24 c24 252 255 8 Y 16 0 8
def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
......@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
set @arg00=null ;
select @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select @arg00 + 1 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? + 1 as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select 1 + @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select 1 + ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
......@@ -168,12 +229,12 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
drop table if exists new_tab ;
create table new_tab (id1 int(11) not null default '0',
drop table if exists t5 ;
create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
......@@ -181,11 +242,11 @@ id1 value1
1 hh
2 hh
1 ii
drop table new_tab ;
drop table if exists new_tab ;
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
drop table t5 ;
drop table if exists t5 ;
create table t5(session_id char(9) not null) ;
insert into t5 values ('abc') ;
prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
......@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
drop table new_tab ;
drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=1 ;
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 '@arg00 t1 where a=1' at line 1
......@@ -255,6 +316,14 @@ execute stmt1 using @arg00, @arg01;
a
2
3
set @arg00= 'one' ;
set @arg01= 'two' ;
set @arg02= 'five' ;
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ;
execute stmt1 using @arg00, @arg01, @arg02 ;
b
one
two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
......@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
set @arg00=null ;
insert into t9 set c1= 0, c5 = NULL ;
select c5 from t9 where c5 > NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 < NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 = NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 <=> NULL ;
c5
NULL
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
execute stmt1 using @arg00 ;
c5
NULL
delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 1 ;
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 '@arg00 1' at line 1
......@@ -421,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
drop table if exists t2 ;
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
the join statement is:
SELECT * FROM t2 right join t1 using(a)
prepare stmt1 from @query9 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural right join t1
prepare stmt1 from @query8 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 right join t1 on(t1.a=t2.a)
prepare stmt1 from @query7 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 using(a)
prepare stmt1 from @query6 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural left join t1
prepare stmt1 from @query5 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 on(t1.a=t2.a)
prepare stmt1 from @query4 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 join t1 using(a)
prepare stmt1 from @query3 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural join t1
prepare stmt1 from @query2 ;
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
the join statement is:
SELECT * FROM t2 join t1 on (t1.a=t2.a)
prepare stmt1 from @query1 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
......@@ -481,6 +776,24 @@ a b
2 two
3 three
4 four
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
......@@ -540,16 +853,58 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
create table t2 as select * from t_many_col_types;
create table t2 as select * from t1;
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
execute stmt1 ;
a in (select a from t2)
1
1
1
1
drop table if exists t5, t6, t7 ;
create table t5 (a int , b int) ;
create table t6 like t5 ;
create table t7 like t5 ;
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
(2, -1), (3, 10) ;
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
insert into t7 values (3, 3), (2, 2), (1, 1) ;
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1) from t7 ' ;
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
drop table t5, t6, t7 ;
drop table if exists t2 ;
create table t2 as select * from t9;
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
where (t9.c2 - 0e-3) = t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
......@@ -575,7 +930,7 @@ execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -584,7 +939,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -593,7 +948,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -601,13 +956,13 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
where t2.c3*?=t9.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
......@@ -646,7 +1001,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -655,7 +1010,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -665,7 +1020,7 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -673,6 +1028,14 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row
prepare stmt1 from ' select 1 < (select a from t1) ' ;
execute stmt1 ;
ERROR 21000: Subquery returns more than 1 row
select 1 as my_col ;
my_col
1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
......@@ -691,6 +1054,14 @@ execute stmt1 ;
a
1
1
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
......@@ -855,44 +1226,38 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
prepare stmt1 from ' select * from t_many_col_types ' ;
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
drop table if exists t2 ;
create table t2 (s varchar(25), fulltext(s))
ENGINE = 'MYISAM' ;
insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
commit ;
prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
set @arg00='Dogs' ;
execute stmt1 using @arg00 ;
s
Hollow Dogs
prepare stmt1 from ' SELECT s FROM t2
where match (s) against (concat(?,''digger'')) ';
set @arg00='Grave' ;
execute stmt1 using @arg00 ;
s
Gravedigger
drop table t2 ;
test_sequence
------ delete tests ------
delete from t1 ;
......@@ -901,8 +1266,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -911,7 +1276,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -920,6 +1285,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -946,8 +1312,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -956,7 +1322,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -965,6 +1331,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -1041,6 +1408,8 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
......@@ -1048,7 +1417,37 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
3 three
4 four
drop table t2 ;
create table t2
(
a int, b varchar(30),
primary key(a)
) engine = 'MYISAM' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
......@@ -1075,8 +1474,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1085,7 +1484,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1094,6 +1493,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
......@@ -1120,6 +1520,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
set @NULL= null ;
set @arg00= 'abc' ;
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg00 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg00 ;
select * from t1 where a > 10000 order by a ;
a b
10001 abc
10002 abc
delete from t1 where a > 10000 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @NULL ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @NULL ;
select * from t1 where a > 10000 order by a ;
a b
10001 NULL
10002 NULL
delete from t1 where a > 10000 ;
set @arg01= 10000 + 10 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 9 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 8 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 7 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 6 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 5 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 4 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 3 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg01 ;
select * from t1 where a > 10000 order by a ;
a b
10001 10001
10002 10002
10003 10003
10004 10004
10005 10005
10006 10006
10007 10007
10008 10008
10009 10009
10010 10010
delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
......@@ -1159,6 +1620,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'MYISAM' ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
1
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
2
drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
......@@ -1192,6 +1666,75 @@ a b
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
test_sequence
------ multi table tests ------
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
2 two
3 three
execute stmt_select2 ;
c1 c21
2 two
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
3 three
execute stmt_select2 ;
c1 c21
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
execute stmt_select2 ;
c1 c21
set @arg00= @arg00 + 1 ;
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
......@@ -1241,17 +1784,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
......@@ -1265,17 +1803,1406 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
drop table t2;
drop table t1, t_many_col_types;
drop table if exists t5 ;
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
set @arg04= 'abc' ;
set @arg05= CAST('abc' as binary) ;
set @arg06= '1991-08-05' ;
set @arg07= CAST('1991-08-05' as date);
set @arg08= '1991-08-05 01:01:01' ;
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
set @arg10= unix_timestamp('1991-01-01 01:01:01');
set @arg11= YEAR('1991-01-01 01:01:01');
set @arg12= 8 ;
set @arg12= NULL ;
set @arg13= 8.0 ;
set @arg13= NULL ;
set @arg14= 'abc';
set @arg14= NULL ;
set @arg15= CAST('abc' as binary) ;
set @arg15= NULL ;
create table t5 as select
8 as const01, @arg01 as param01,
8.0 as const02, @arg02 as param02,
80.00000000000e-1 as const03, @arg03 as param03,
'abc' as const04, @arg04 as param04,
CAST('abc' as binary) as const05, @arg05 as param05,
'1991-08-05' as const06, @arg06 as param06,
CAST('1991-08-05' as date) as const07, @arg07 as param07,
'1991-08-05 01:01:01' as const08, @arg08 as param08,
CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
NULL as const12, @arg12 as param12,
@arg13 as param13,
@arg14 as param14,
@arg15 as param15;
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` double(3,1) NOT NULL default '0.0',
`param02` double default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
`const04` char(3) NOT NULL default '',
`param04` longtext,
`const05` binary(3) NOT NULL default '',
`param05` longblob,
`const06` varchar(10) NOT NULL default '',
`param06` longtext,
`const07` date default NULL,
`param07` longblob,
`const08` varchar(19) NOT NULL default '',
`param08` longtext,
`const09` datetime default NULL,
`param09` longblob,
`const10` int(10) NOT NULL default '0',
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
`param14` longblob,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 5 3 3 N 32769 1 63
def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
def test t5 t5 const03 const03 5 23 1 N 32769 31 63
def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
def test t5 t5 const04 const04 254 3 3 N 1 0 8
def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
def test t5 t5 const05 const05 254 3 3 N 129 0 63
def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 1 0 8
def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
const02 8.0
param02 8
const03 8
param03 8
const04 abc
param04 abc
const05 abc
param05 abc
const06 1991-08-05
param06 1991-08-05
const07 1991-08-05
param07 1991-08-05
const08 1991-08-05 01:01:01
param08 1991-08-05 01:01:01
const09 1991-08-05 01:01:01
param09 1991-08-05 01:01:01
const10 662680861
param10 662680861
const11 1991
param11 1991
const12 NULL
param12 NULL
param13 NULL
param14 NULL
param15 NULL
drop table t5 ;
test_sequence
------ data type conversion tests ------
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
select * from t9 order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
test_sequence
------ select @parameter:= column ------
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
@arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12,
@arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20,
@arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28,
@arg29, @arg30, @arg31, @arg32" ;
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 1 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 0 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
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 ':= c1 from t9 where c1= 1' at line 1
test_sequence
------ select column, .. into @parm,.. ------
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 1 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 0 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
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 '? from t9 where c1= 1' at line 1
test_sequence
-- insert into numeric columns --
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
set @arg00= 21 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
execute stmt1 ;
set @arg00= 23;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0 ) ;
set @arg00= 31.0 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
32.0, 32.0, 32.0 )" ;
execute stmt1 ;
set @arg00= 33.0;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '40', '40', '40', '40', '40', '40', '40', '40',
'40', '40', '40' ) ;
set @arg00= '41' ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '42', '42', '42', '42', '42', '42', '42', '42',
'42', '42', '42' )" ;
execute stmt1 ;
set @arg00= '43';
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
set @arg00= CAST('51' as binary) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('53' as binary) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL ) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c1 >= 20
order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
20 20 20 20 20 20 20 20 20 20 20.0000
21 21 21 21 21 21 21 21 21 21 21.0000
22 22 22 22 22 22 22 22 22 22 22.0000
23 23 23 23 23 23 23 23 23 23 23.0000
30 30 30 30 30 30 30 30 30 30 30.0000
31 31 31 31 31 31 31 31 31 31 31.0000
32 32 32 32 32 32 32 32 32 32 32.0000
33 33 33 33 33 33 33 33 33 33 33.0000
40 40 40 40 40 40 40 40 40 40 40.0000
41 41 41 41 41 41 41 41 41 41 41.0000
42 42 42 42 42 42 42 42 42 42 42.0000
43 43 43 43 43 43 43 43 43 43 43.0000
50 50 50 50 50 50 50 50 50 50 50.0000
51 51 51 51 51 51 51 51 51 51 51.0000
52 52 52 52 52 52 52 52 52 52 52.0000
53 53 53 53 53 53 53 53 53 53 53.0000
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where numeric column = .. --
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
execute stmt1 ;
found
true
set @arg00= '20';
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary);
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary) ";
execute stmt1 ;
found
true
set @arg00= CAST('20' as binary) ;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- some numeric overflow experiments --
prepare my_insert from "insert into t9
( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 1
c2 1
c3 1
c4 1
c5 1
c6 1
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -1
c2 -1
c3 -1
c4 -1
c5 -1
c6 -1
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
from t9 where c1 >= 20
order by c1 ;
c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
20 2 20 20 20 20 20 20 20 20 20 20
21 2 21 21 21 21 21 21 21 21 21 21
22 2 22 22 22 22 22 22 22 22 22 22
23 2 23 23 23 23 23 23 23 23 23 23
30 3 30 30 30 30 30 30 30 30 30 30
31 3 31 31 31 31 31 31 31 31 31 31
32 3 32 32 32 32 32 32 32 32 32 32
33 3 33 33 33 33 33 33 33 33 33 33
40 4 40 40 40 40 40 40 40 40 40 40
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
51 5 51 51 51 51 51 51 51 51 51 51
52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
55 5 55 55 55 55 55 55 55 55 55 55
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where string column = .. --
set @arg00= '20';
select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('20' as binary);
select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary) ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
c29= ? and c30= ?";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
63 NULL NULL 1991-01-01 01:01:01 NULL NULL
71 NULL NULL 1991-01-01 01:01:01 NULL NULL
73 NULL NULL 1991-01-01 01:01:01 NULL NULL
81 NULL NULL 1991-01-01 01:01:01 NULL NULL
83 NULL NULL 1991-01-01 01:01:01 NULL NULL
test_sequence
-- select .. where date/time column = .. --
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= 1991 ;
found
true
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1991" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
true
set @arg00= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ;
found
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ;
execute stmt1 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
drop table t1, t9;
use test;
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'InnoDB' ;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -24,8 +24,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -34,7 +34,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -43,8 +43,47 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
test_sequence
------ simple select tests ------
prepare stmt1 from ' select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
def test t9 t9 c15 c15 7 19 19 N 1249 0 63
def test t9 t9 c16 c16 11 8 8 Y 128 0 63
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 252 255 8 Y 144 0 63
def test t9 t9 c24 c24 252 255 8 Y 16 0 8
def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
......@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
set @arg00=null ;
select @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select @arg00 + 1 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? + 1 as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select 1 + @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select 1 + ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
......@@ -168,12 +229,12 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
drop table if exists new_tab ;
create table new_tab (id1 int(11) not null default '0',
drop table if exists t5 ;
create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
......@@ -181,11 +242,11 @@ id1 value1
1 hh
2 hh
1 ii
drop table new_tab ;
drop table if exists new_tab ;
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
drop table t5 ;
drop table if exists t5 ;
create table t5(session_id char(9) not null) ;
insert into t5 values ('abc') ;
prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
......@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
drop table new_tab ;
drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=1 ;
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 '@arg00 t1 where a=1' at line 1
......@@ -255,6 +316,14 @@ execute stmt1 using @arg00, @arg01;
a
2
3
set @arg00= 'one' ;
set @arg01= 'two' ;
set @arg02= 'five' ;
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ;
execute stmt1 using @arg00, @arg01, @arg02 ;
b
one
two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
......@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
set @arg00=null ;
insert into t9 set c1= 0, c5 = NULL ;
select c5 from t9 where c5 > NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 < NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 = NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 <=> NULL ;
c5
NULL
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
execute stmt1 using @arg00 ;
c5
NULL
delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 1 ;
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 '@arg00 1' at line 1
......@@ -421,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
drop table if exists t2 ;
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
the join statement is:
SELECT * FROM t2 right join t1 using(a)
prepare stmt1 from @query9 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural right join t1
prepare stmt1 from @query8 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 right join t1 on(t1.a=t2.a)
prepare stmt1 from @query7 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 using(a)
prepare stmt1 from @query6 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural left join t1
prepare stmt1 from @query5 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 on(t1.a=t2.a)
prepare stmt1 from @query4 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 join t1 using(a)
prepare stmt1 from @query3 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural join t1
prepare stmt1 from @query2 ;
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
the join statement is:
SELECT * FROM t2 join t1 on (t1.a=t2.a)
prepare stmt1 from @query1 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
......@@ -481,6 +776,24 @@ a b
2 two
3 three
4 four
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
......@@ -540,16 +853,58 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
create table t2 as select * from t_many_col_types;
create table t2 as select * from t1;
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
execute stmt1 ;
a in (select a from t2)
1
1
1
1
drop table if exists t5, t6, t7 ;
create table t5 (a int , b int) ;
create table t6 like t5 ;
create table t7 like t5 ;
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
(2, -1), (3, 10) ;
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
insert into t7 values (3, 3), (2, 2), (1, 1) ;
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1) from t7 ' ;
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
drop table t5, t6, t7 ;
drop table if exists t2 ;
create table t2 as select * from t9;
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
where (t9.c2 - 0e-3) = t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
......@@ -575,7 +930,7 @@ execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -584,7 +939,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -593,7 +948,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -601,13 +956,13 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
where t2.c3*?=t9.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
......@@ -646,7 +1001,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -655,7 +1010,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -665,7 +1020,7 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -673,6 +1028,14 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row
prepare stmt1 from ' select 1 < (select a from t1) ' ;
execute stmt1 ;
ERROR 21000: Subquery returns more than 1 row
select 1 as my_col ;
my_col
1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
......@@ -691,6 +1054,14 @@ execute stmt1 ;
a
1
1
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
......@@ -855,44 +1226,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
prepare stmt1 from ' select * from t_many_col_types ' ;
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
......@@ -901,8 +1249,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -911,7 +1259,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -920,6 +1268,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -946,8 +1295,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -956,7 +1305,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -965,6 +1314,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -1041,6 +1391,8 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
......@@ -1048,7 +1400,37 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
3 three
4 four
drop table t2 ;
create table t2
(
a int, b varchar(30),
primary key(a)
) engine = 'InnoDB' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
......@@ -1075,8 +1457,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1085,7 +1467,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1094,6 +1476,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
......@@ -1120,6 +1503,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
set @NULL= null ;
set @arg00= 'abc' ;
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg00 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg00 ;
select * from t1 where a > 10000 order by a ;
a b
10001 abc
10002 abc
delete from t1 where a > 10000 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @NULL ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @NULL ;
select * from t1 where a > 10000 order by a ;
a b
10001 NULL
10002 NULL
delete from t1 where a > 10000 ;
set @arg01= 10000 + 10 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 9 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 8 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 7 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 6 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 5 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 4 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 3 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg01 ;
select * from t1 where a > 10000 order by a ;
a b
10001 10001
10002 10002
10003 10003
10004 10004
10005 10005
10006 10006
10007 10007
10008 10008
10009 10009
10010 10010
delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
......@@ -1159,6 +1603,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'InnoDB' ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
1
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
2
drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
......@@ -1192,6 +1649,75 @@ a b
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
test_sequence
------ multi table tests ------
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
2 two
3 three
execute stmt_select2 ;
c1 c21
2 two
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
3 three
execute stmt_select2 ;
c1 c21
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
execute stmt_select2 ;
c1 c21
set @arg00= @arg00 + 1 ;
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
......@@ -1241,17 +1767,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
......@@ -1265,17 +1786,1406 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
drop table t2;
drop table t1, t_many_col_types;
drop table if exists t5 ;
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
set @arg04= 'abc' ;
set @arg05= CAST('abc' as binary) ;
set @arg06= '1991-08-05' ;
set @arg07= CAST('1991-08-05' as date);
set @arg08= '1991-08-05 01:01:01' ;
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
set @arg10= unix_timestamp('1991-01-01 01:01:01');
set @arg11= YEAR('1991-01-01 01:01:01');
set @arg12= 8 ;
set @arg12= NULL ;
set @arg13= 8.0 ;
set @arg13= NULL ;
set @arg14= 'abc';
set @arg14= NULL ;
set @arg15= CAST('abc' as binary) ;
set @arg15= NULL ;
create table t5 as select
8 as const01, @arg01 as param01,
8.0 as const02, @arg02 as param02,
80.00000000000e-1 as const03, @arg03 as param03,
'abc' as const04, @arg04 as param04,
CAST('abc' as binary) as const05, @arg05 as param05,
'1991-08-05' as const06, @arg06 as param06,
CAST('1991-08-05' as date) as const07, @arg07 as param07,
'1991-08-05 01:01:01' as const08, @arg08 as param08,
CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
NULL as const12, @arg12 as param12,
@arg13 as param13,
@arg14 as param14,
@arg15 as param15;
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` double(3,1) NOT NULL default '0.0',
`param02` double default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
`const04` char(3) NOT NULL default '',
`param04` longtext,
`const05` binary(3) NOT NULL default '',
`param05` longblob,
`const06` varchar(10) NOT NULL default '',
`param06` longtext,
`const07` date default NULL,
`param07` longblob,
`const08` varchar(19) NOT NULL default '',
`param08` longtext,
`const09` datetime default NULL,
`param09` longblob,
`const10` int(10) NOT NULL default '0',
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
`param14` longblob,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 5 3 3 N 32769 1 63
def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
def test t5 t5 const03 const03 5 23 1 N 32769 31 63
def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
def test t5 t5 const04 const04 254 3 3 N 1 0 8
def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
def test t5 t5 const05 const05 254 3 3 N 129 0 63
def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 1 0 8
def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
const02 8.0
param02 8
const03 8
param03 8
const04 abc
param04 abc
const05 abc
param05 abc
const06 1991-08-05
param06 1991-08-05
const07 1991-08-05
param07 1991-08-05
const08 1991-08-05 01:01:01
param08 1991-08-05 01:01:01
const09 1991-08-05 01:01:01
param09 1991-08-05 01:01:01
const10 662680861
param10 662680861
const11 1991
param11 1991
const12 NULL
param12 NULL
param13 NULL
param14 NULL
param15 NULL
drop table t5 ;
test_sequence
------ data type conversion tests ------
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
select * from t9 order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
test_sequence
------ select @parameter:= column ------
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
@arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12,
@arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20,
@arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28,
@arg29, @arg30, @arg31, @arg32" ;
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 1 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 0 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
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 ':= c1 from t9 where c1= 1' at line 1
test_sequence
------ select column, .. into @parm,.. ------
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 1 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 0 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
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 '? from t9 where c1= 1' at line 1
test_sequence
-- insert into numeric columns --
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
set @arg00= 21 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
execute stmt1 ;
set @arg00= 23;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0 ) ;
set @arg00= 31.0 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
32.0, 32.0, 32.0 )" ;
execute stmt1 ;
set @arg00= 33.0;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '40', '40', '40', '40', '40', '40', '40', '40',
'40', '40', '40' ) ;
set @arg00= '41' ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '42', '42', '42', '42', '42', '42', '42', '42',
'42', '42', '42' )" ;
execute stmt1 ;
set @arg00= '43';
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
set @arg00= CAST('51' as binary) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('53' as binary) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL ) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c1 >= 20
order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
20 20 20 20 20 20 20 20 20 20 20.0000
21 21 21 21 21 21 21 21 21 21 21.0000
22 22 22 22 22 22 22 22 22 22 22.0000
23 23 23 23 23 23 23 23 23 23 23.0000
30 30 30 30 30 30 30 30 30 30 30.0000
31 31 31 31 31 31 31 31 31 31 31.0000
32 32 32 32 32 32 32 32 32 32 32.0000
33 33 33 33 33 33 33 33 33 33 33.0000
40 40 40 40 40 40 40 40 40 40 40.0000
41 41 41 41 41 41 41 41 41 41 41.0000
42 42 42 42 42 42 42 42 42 42 42.0000
43 43 43 43 43 43 43 43 43 43 43.0000
50 50 50 50 50 50 50 50 50 50 50.0000
51 51 51 51 51 51 51 51 51 51 51.0000
52 52 52 52 52 52 52 52 52 52 52.0000
53 53 53 53 53 53 53 53 53 53 53.0000
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where numeric column = .. --
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
execute stmt1 ;
found
true
set @arg00= '20';
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary);
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary) ";
execute stmt1 ;
found
true
set @arg00= CAST('20' as binary) ;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- some numeric overflow experiments --
prepare my_insert from "insert into t9
( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 1
c2 1
c3 1
c4 1
c5 1
c6 1
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -1
c2 -1
c3 -1
c4 -1
c5 -1
c6 -1
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
from t9 where c1 >= 20
order by c1 ;
c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
20 2 20 20 20 20 20 20 20 20 20 20
21 2 21 21 21 21 21 21 21 21 21 21
22 2 22 22 22 22 22 22 22 22 22 22
23 2 23 23 23 23 23 23 23 23 23 23
30 3 30 30 30 30 30 30 30 30 30 30
31 3 31 31 31 31 31 31 31 31 31 31
32 3 32 32 32 32 32 32 32 32 32 32
33 3 33 33 33 33 33 33 33 33 33 33
40 4 40 40 40 40 40 40 40 40 40 40
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
51 5 51 51 51 51 51 51 51 51 51 51
52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
55 5 55 55 55 55 55 55 55 55 55 55
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where string column = .. --
set @arg00= '20';
select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('20' as binary);
select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary) ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
c29= ? and c30= ?";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
63 NULL NULL 1991-01-01 01:01:01 NULL NULL
71 NULL NULL 1991-01-01 01:01:01 NULL NULL
73 NULL NULL 1991-01-01 01:01:01 NULL NULL
81 NULL NULL 1991-01-01 01:01:01 NULL NULL
83 NULL NULL 1991-01-01 01:01:01 NULL NULL
test_sequence
-- select .. where date/time column = .. --
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= 1991 ;
found
true
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1991" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
true
set @arg00= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ;
found
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ;
execute stmt1 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
drop table t1, t9;
use test;
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'HEAP' ;
drop table if exists t_many_col_types;
create table t_many_col_types
drop table if exists t9;
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -25,8 +25,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -35,7 +35,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -44,8 +44,47 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
test_sequence
------ simple select tests ------
prepare stmt1 from ' select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
def test t9 t9 c15 c15 7 19 19 N 1249 0 63
def test t9 t9 c16 c16 11 8 8 Y 128 0 63
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 253 100 8 Y 0 0 8
def test t9 t9 c24 c24 253 100 8 Y 0 0 8
def test t9 t9 c25 c25 253 100 4 Y 0 0 8
def test t9 t9 c26 c26 253 100 4 Y 0 0 8
def test t9 t9 c27 c27 253 100 10 Y 0 0 8
def test t9 t9 c28 c28 253 100 10 Y 0 0 8
def test t9 t9 c29 c29 253 100 8 Y 0 0 8
def test t9 t9 c30 c30 253 100 8 Y 0 0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
......@@ -81,6 +120,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
set @arg00=null ;
select @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select @arg00 + 1 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? + 1 as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select 1 + @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select 1 + ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
......@@ -169,12 +230,12 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
drop table if exists new_tab ;
create table new_tab (id1 int(11) not null default '0',
drop table if exists t5 ;
create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
......@@ -182,11 +243,11 @@ id1 value1
1 hh
2 hh
1 ii
drop table new_tab ;
drop table if exists new_tab ;
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
drop table t5 ;
drop table if exists t5 ;
create table t5(session_id char(9) not null) ;
insert into t5 values ('abc') ;
prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
......@@ -198,7 +259,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
drop table new_tab ;
drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=1 ;
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 '@arg00 t1 where a=1' at line 1
......@@ -256,6 +317,14 @@ execute stmt1 using @arg00, @arg01;
a
2
3
set @arg00= 'one' ;
set @arg01= 'two' ;
set @arg02= 'five' ;
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ;
execute stmt1 using @arg00, @arg01, @arg02 ;
b
one
two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
......@@ -269,6 +338,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
set @arg00=null ;
insert into t9 set c1= 0, c5 = NULL ;
select c5 from t9 where c5 > NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 < NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 = NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 <=> NULL ;
c5
NULL
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
execute stmt1 using @arg00 ;
c5
NULL
delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 1 ;
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 '@arg00 1' at line 1
......@@ -422,6 +516,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
drop table if exists t2 ;
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
the join statement is:
SELECT * FROM t2 right join t1 using(a)
prepare stmt1 from @query9 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural right join t1
prepare stmt1 from @query8 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 right join t1 on(t1.a=t2.a)
prepare stmt1 from @query7 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 using(a)
prepare stmt1 from @query6 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural left join t1
prepare stmt1 from @query5 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 on(t1.a=t2.a)
prepare stmt1 from @query4 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 join t1 using(a)
prepare stmt1 from @query3 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural join t1
prepare stmt1 from @query2 ;
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
the join statement is:
SELECT * FROM t2 join t1 on (t1.a=t2.a)
prepare stmt1 from @query1 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
......@@ -482,6 +777,24 @@ a b
2 two
3 three
4 four
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
......@@ -541,16 +854,58 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
create table t2 as select * from t_many_col_types;
create table t2 as select * from t1;
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
execute stmt1 ;
a in (select a from t2)
1
1
1
1
drop table if exists t5, t6, t7 ;
create table t5 (a int , b int) ;
create table t6 like t5 ;
create table t7 like t5 ;
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
(2, -1), (3, 10) ;
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
insert into t7 values (3, 3), (2, 2), (1, 1) ;
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1) from t7 ' ;
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
drop table t5, t6, t7 ;
drop table if exists t2 ;
create table t2 as select * from t9;
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
where (t9.c2 - 0e-3) = t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
......@@ -576,7 +931,7 @@ execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -585,7 +940,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -594,7 +949,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -602,13 +957,13 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
where t2.c3*?=t9.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
......@@ -647,7 +1002,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -656,7 +1011,7 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -666,7 +1021,7 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -674,6 +1029,14 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row
prepare stmt1 from ' select 1 < (select a from t1) ' ;
execute stmt1 ;
ERROR 21000: Subquery returns more than 1 row
select 1 as my_col ;
my_col
1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
......@@ -692,6 +1055,14 @@ execute stmt1 ;
a
1
1
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
......@@ -856,44 +1227,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
prepare stmt1 from ' select * from t_many_col_types ' ;
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
def test t_many_col_types t_many_col_types c23 c23 253 100 8 Y 0 0 8
def test t_many_col_types t_many_col_types c24 c24 253 100 8 Y 0 0 8
def test t_many_col_types t_many_col_types c25 c25 253 100 4 Y 0 0 8
def test t_many_col_types t_many_col_types c26 c26 253 100 4 Y 0 0 8
def test t_many_col_types t_many_col_types c27 c27 253 100 10 Y 0 0 8
def test t_many_col_types t_many_col_types c28 c28 253 100 10 Y 0 0 8
def test t_many_col_types t_many_col_types c29 c29 253 100 8 Y 0 0 8
def test t_many_col_types t_many_col_types c30 c30 253 100 8 Y 0 0 8
def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
test_sequence
------ delete tests ------
delete from t1 ;
......@@ -902,8 +1250,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -912,7 +1260,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -921,6 +1269,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -947,8 +1296,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -957,7 +1306,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -966,6 +1315,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -1042,6 +1392,8 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
......@@ -1049,7 +1401,37 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
3 three
4 four
drop table t2 ;
create table t2
(
a int, b varchar(30),
primary key(a)
) engine = 'HEAP' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
......@@ -1076,8 +1458,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1086,7 +1468,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1095,6 +1477,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
......@@ -1121,6 +1504,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
set @NULL= null ;
set @arg00= 'abc' ;
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg00 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg00 ;
select * from t1 where a > 10000 order by a ;
a b
10001 abc
10002 abc
delete from t1 where a > 10000 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @NULL ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @NULL ;
select * from t1 where a > 10000 order by a ;
a b
10001 NULL
10002 NULL
delete from t1 where a > 10000 ;
set @arg01= 10000 + 10 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 9 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 8 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 7 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 6 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 5 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 4 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 3 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg01 ;
select * from t1 where a > 10000 order by a ;
a b
10001 10001
10002 10002
10003 10003
10004 10004
10005 10005
10006 10006
10007 10007
10008 10008
10009 10009
10010 10010
delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
......@@ -1160,6 +1604,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'HEAP' ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
1
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
2
drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
......@@ -1193,6 +1650,75 @@ a b
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
test_sequence
------ multi table tests ------
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
2 two
3 three
execute stmt_select2 ;
c1 c21
2 two
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
3 three
execute stmt_select2 ;
c1 c21
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
execute stmt_select2 ;
c1 c21
set @arg00= @arg00 + 1 ;
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
......@@ -1242,17 +1768,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
......@@ -1266,17 +1787,1406 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
drop table t2;
drop table t1, t_many_col_types;
drop table if exists t5 ;
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
set @arg04= 'abc' ;
set @arg05= CAST('abc' as binary) ;
set @arg06= '1991-08-05' ;
set @arg07= CAST('1991-08-05' as date);
set @arg08= '1991-08-05 01:01:01' ;
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
set @arg10= unix_timestamp('1991-01-01 01:01:01');
set @arg11= YEAR('1991-01-01 01:01:01');
set @arg12= 8 ;
set @arg12= NULL ;
set @arg13= 8.0 ;
set @arg13= NULL ;
set @arg14= 'abc';
set @arg14= NULL ;
set @arg15= CAST('abc' as binary) ;
set @arg15= NULL ;
create table t5 as select
8 as const01, @arg01 as param01,
8.0 as const02, @arg02 as param02,
80.00000000000e-1 as const03, @arg03 as param03,
'abc' as const04, @arg04 as param04,
CAST('abc' as binary) as const05, @arg05 as param05,
'1991-08-05' as const06, @arg06 as param06,
CAST('1991-08-05' as date) as const07, @arg07 as param07,
'1991-08-05 01:01:01' as const08, @arg08 as param08,
CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
NULL as const12, @arg12 as param12,
@arg13 as param13,
@arg14 as param14,
@arg15 as param15;
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` double(3,1) NOT NULL default '0.0',
`param02` double default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
`const04` char(3) NOT NULL default '',
`param04` longtext,
`const05` binary(3) NOT NULL default '',
`param05` longblob,
`const06` varchar(10) NOT NULL default '',
`param06` longtext,
`const07` date default NULL,
`param07` longblob,
`const08` varchar(19) NOT NULL default '',
`param08` longtext,
`const09` datetime default NULL,
`param09` longblob,
`const10` int(10) NOT NULL default '0',
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
`param14` longblob,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 5 3 3 N 32769 1 63
def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
def test t5 t5 const03 const03 5 23 1 N 32769 31 63
def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
def test t5 t5 const04 const04 254 3 3 N 1 0 8
def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
def test t5 t5 const05 const05 254 3 3 N 129 0 63
def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 1 0 8
def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
const02 8.0
param02 8
const03 8
param03 8
const04 abc
param04 abc
const05 abc
param05 abc
const06 1991-08-05
param06 1991-08-05
const07 1991-08-05
param07 1991-08-05
const08 1991-08-05 01:01:01
param08 1991-08-05 01:01:01
const09 1991-08-05 01:01:01
param09 1991-08-05 01:01:01
const10 662680861
param10 662680861
const11 1991
param11 1991
const12 NULL
param12 NULL
param13 NULL
param14 NULL
param15 NULL
drop table t5 ;
test_sequence
------ data type conversion tests ------
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
select * from t9 order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
test_sequence
------ select @parameter:= column ------
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
@arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12,
@arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20,
@arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28,
@arg29, @arg30, @arg31, @arg32" ;
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 1 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 0 31 8
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 0 31 8
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 0 31 8
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 0 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 0 31 8
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 0 31 8
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 0 31 8
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
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 ':= c1 from t9 where c1= 1' at line 1
test_sequence
------ select column, .. into @parm,.. ------
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 1 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 0 31 8
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 0 31 8
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 0 31 8
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 0 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 0 31 8
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 0 31 8
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 0 31 8
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
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 '? from t9 where c1= 1' at line 1
test_sequence
-- insert into numeric columns --
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
set @arg00= 21 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
execute stmt1 ;
set @arg00= 23;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0 ) ;
set @arg00= 31.0 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
32.0, 32.0, 32.0 )" ;
execute stmt1 ;
set @arg00= 33.0;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '40', '40', '40', '40', '40', '40', '40', '40',
'40', '40', '40' ) ;
set @arg00= '41' ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '42', '42', '42', '42', '42', '42', '42', '42',
'42', '42', '42' )" ;
execute stmt1 ;
set @arg00= '43';
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
set @arg00= CAST('51' as binary) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('53' as binary) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL ) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c1 >= 20
order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
20 20 20 20 20 20 20 20 20 20 20.0000
21 21 21 21 21 21 21 21 21 21 21.0000
22 22 22 22 22 22 22 22 22 22 22.0000
23 23 23 23 23 23 23 23 23 23 23.0000
30 30 30 30 30 30 30 30 30 30 30.0000
31 31 31 31 31 31 31 31 31 31 31.0000
32 32 32 32 32 32 32 32 32 32 32.0000
33 33 33 33 33 33 33 33 33 33 33.0000
40 40 40 40 40 40 40 40 40 40 40.0000
41 41 41 41 41 41 41 41 41 41 41.0000
42 42 42 42 42 42 42 42 42 42 42.0000
43 43 43 43 43 43 43 43 43 43 43.0000
50 50 50 50 50 50 50 50 50 50 50.0000
51 51 51 51 51 51 51 51 51 51 51.0000
52 52 52 52 52 52 52 52 52 52 52.0000
53 53 53 53 53 53 53 53 53 53 53.0000
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where numeric column = .. --
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
execute stmt1 ;
found
true
set @arg00= '20';
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary);
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary) ";
execute stmt1 ;
found
true
set @arg00= CAST('20' as binary) ;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- some numeric overflow experiments --
prepare my_insert from "insert into t9
( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 1
c2 1
c3 1
c4 1
c5 1
c6 1
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -1
c2 -1
c3 -1
c4 -1
c5 -1
c6 -1
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
from t9 where c1 >= 20
order by c1 ;
c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
20 2 20 20 20 20 20 20 20 20 20 20
21 2 21 21 21 21 21 21 21 21 21 21
22 2 22 22 22 22 22 22 22 22 22 22
23 2 23 23 23 23 23 23 23 23 23 23
30 3 30 30 30 30 30 30 30 30 30 30
31 3 31 31 31 31 31 31 31 31 31 31
32 3 32 32 32 32 32 32 32 32 32 32
33 3 33 33 33 33 33 33 33 33 33 33
40 4 40 40 40 40 40 40 40 40 40 40
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
50 5 50 50 50 50 50 50 50 50 50 50
51 5 51 51 51 51 51 51 51 51 51 51
52 5 52 52 52 52 52 52 52 52 52 52
53 5 53 53 53 53 53 53 53 53 53 53
54 5 54 54 54 54 54 54 54 54 54 54
55 5 55 55 55 55 55 55 55 55 55 55
56 6 56 56 56 56 56 56 56 56 56 56
57 6 57 57 57 57 57 57 57 57 57 57
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where string column = .. --
set @arg00= '20';
select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('20' as binary);
select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary) ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
c29= ? and c30= ?";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
63 NULL NULL 1991-01-01 01:01:01 NULL NULL
71 NULL NULL 1991-01-01 01:01:01 NULL NULL
73 NULL NULL 1991-01-01 01:01:01 NULL NULL
81 NULL NULL 1991-01-01 01:01:01 NULL NULL
83 NULL NULL 1991-01-01 01:01:01 NULL NULL
test_sequence
-- select .. where date/time column = .. --
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= 1991 ;
found
true
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1991" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
true
set @arg00= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ;
found
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ;
execute stmt1 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
drop table t1, t9;
This source diff could not be displayed because it is too large. You can view the blob instead.
use test;
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) engine = 'BDB' ;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -24,8 +24,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -34,7 +34,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -43,8 +43,47 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
test_sequence
------ simple select tests ------
prepare stmt1 from ' select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t9 t9 c1 c1 1 4 1 N 49155 0 63
def test t9 t9 c2 c2 2 6 1 Y 32768 0 63
def test t9 t9 c3 c3 9 9 1 Y 32768 0 63
def test t9 t9 c4 c4 3 11 1 Y 32768 0 63
def test t9 t9 c5 c5 3 11 1 Y 32768 0 63
def test t9 t9 c6 c6 8 20 1 Y 32768 0 63
def test t9 t9 c7 c7 4 12 1 Y 32768 31 63
def test t9 t9 c8 c8 5 22 1 Y 32768 31 63
def test t9 t9 c9 c9 5 22 1 Y 32768 31 63
def test t9 t9 c10 c10 5 22 1 Y 32768 31 63
def test t9 t9 c11 c11 0 9 6 Y 32768 4 63
def test t9 t9 c12 c12 0 10 6 Y 32768 4 63
def test t9 t9 c13 c13 10 10 10 Y 128 0 63
def test t9 t9 c14 c14 12 19 19 Y 128 0 63
def test t9 t9 c15 c15 7 19 19 N 1249 0 63
def test t9 t9 c16 c16 11 8 8 Y 128 0 63
def test t9 t9 c17 c17 13 4 4 Y 32864 0 63
def test t9 t9 c18 c18 1 1 1 Y 32768 0 63
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 252 255 8 Y 144 0 63
def test t9 t9 c24 c24 252 255 8 Y 16 0 8
def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ;
prepare stmt1 from ' ? a from t1 where a=1 ';
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 '? a from t1 where a=1' at line 1
......@@ -80,6 +119,28 @@ prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;
execute stmt1 using @arg00 ;
b a - ?
one 0
set @arg00=null ;
select @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select @arg00 + 1 as my_col ;
my_col
NULL
prepare stmt1 from ' select ? + 1 as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
select 1 + @arg00 as my_col ;
my_col
NULL
prepare stmt1 from ' select 1 + ? as my_col';
execute stmt1 using @arg00 ;
my_col
NULL
set @arg00='MySQL' ;
select substr(@arg00,1,2) from t1 where a=1 ;
substr(@arg00,1,2)
......@@ -168,12 +229,12 @@ first NULL
execute stmt1 using @arg02, @arg02 ;
? ?
NULL NULL
drop table if exists new_tab ;
create table new_tab (id1 int(11) not null default '0',
drop table if exists t5 ;
create table t5 (id1 int(11) not null default '0',
value2 varchar(100), value1 varchar(100)) ;
insert into new_tab values (1,'hh','hh'),(2,'hh','hh'),
insert into t5 values (1,'hh','hh'),(2,'hh','hh'),
(1,'ii','ii'),(2,'ii','ii') ;
prepare stmt1 from ' select id1,value1 from new_tab where id1=? or value1=? ' ;
prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? ' ;
set @arg00=1 ;
set @arg01='hh' ;
execute stmt1 using @arg00, @arg01 ;
......@@ -181,11 +242,11 @@ id1 value1
1 hh
2 hh
1 ii
drop table new_tab ;
drop table if exists new_tab ;
create table new_tab(session_id char(9) not null) ;
insert into new_tab values ('abc') ;
prepare stmt1 from ' select * from new_tab
drop table t5 ;
drop table if exists t5 ;
create table t5(session_id char(9) not null) ;
insert into t5 values ('abc') ;
prepare stmt1 from ' select * from t5
where ?=''1111'' and session_id = ''abc'' ' ;
set @arg00='abc' ;
execute stmt1 using @arg00 ;
......@@ -197,7 +258,7 @@ abc
set @arg00='abc' ;
execute stmt1 using @arg00 ;
session_id
drop table new_tab ;
drop table t5 ;
set @arg00='FROM' ;
select a @arg00 t1 where a=1 ;
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 '@arg00 t1 where a=1' at line 1
......@@ -255,6 +316,14 @@ execute stmt1 using @arg00, @arg01;
a
2
3
set @arg00= 'one' ;
set @arg01= 'two' ;
set @arg02= 'five' ;
prepare stmt1 from ' select b FROM t1 where b in (?,?,?) ' ;
execute stmt1 using @arg00, @arg01, @arg02 ;
b
one
two
prepare stmt1 from ' select b FROM t1 where b like ? ';
set @arg00='two' ;
execute stmt1 using @arg00 ;
......@@ -268,6 +337,31 @@ set @arg00='%wo' ;
execute stmt1 using @arg00 ;
b
two
set @arg00=null ;
insert into t9 set c1= 0, c5 = NULL ;
select c5 from t9 where c5 > NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 > ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 < NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 < ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 = NULL ;
c5
prepare stmt1 from ' select c5 from t9 where c5 = ? ';
execute stmt1 using @arg00 ;
c5
select c5 from t9 where c5 <=> NULL ;
c5
NULL
prepare stmt1 from ' select c5 from t9 where c5 <=> ? ';
execute stmt1 using @arg00 ;
c5
NULL
delete from t9 where c1= 0 ;
set @arg00='>' ;
select a FROM t1 where a @arg00 1 ;
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 '@arg00 1' at line 1
......@@ -421,6 +515,207 @@ a ? a
3 ABC 3
2 ABC 4
4 ABC 4
drop table if exists t2 ;
create table t2 as select * from t1 ;
set @query1= 'SELECT * FROM t2 join t1 on (t1.a=t2.a) ' ;
set @query2= 'SELECT * FROM t2 natural join t1 ' ;
set @query3= 'SELECT * FROM t2 join t1 using(a) ' ;
set @query4= 'SELECT * FROM t2 left join t1 on(t1.a=t2.a) ' ;
set @query5= 'SELECT * FROM t2 natural left join t1 ' ;
set @query6= 'SELECT * FROM t2 left join t1 using(a) ' ;
set @query7= 'SELECT * FROM t2 right join t1 on(t1.a=t2.a) ' ;
set @query8= 'SELECT * FROM t2 natural right join t1 ' ;
set @query9= 'SELECT * FROM t2 right join t1 using(a) ' ;
the join statement is:
SELECT * FROM t2 right join t1 using(a)
prepare stmt1 from @query9 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural right join t1
prepare stmt1 from @query8 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 right join t1 on(t1.a=t2.a)
prepare stmt1 from @query7 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 using(a)
prepare stmt1 from @query6 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural left join t1
prepare stmt1 from @query5 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 left join t1 on(t1.a=t2.a)
prepare stmt1 from @query4 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 join t1 using(a)
prepare stmt1 from @query3 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
the join statement is:
SELECT * FROM t2 natural join t1
prepare stmt1 from @query2 ;
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
execute stmt1 ;
a b
1 one
2 two
3 three
4 four
the join statement is:
SELECT * FROM t2 join t1 on (t1.a=t2.a)
prepare stmt1 from @query1 ;
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
execute stmt1 ;
a b a b
1 one 1 one
2 two 2 two
3 three 3 three
4 four 4 four
drop table t2 ;
test_sequence
------ subquery tests ------
prepare stmt1 from ' select a, b FROM t1 outer_table where
......@@ -481,6 +776,24 @@ a b
2 two
3 three
4 four
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
set @arg00='two' ;
select a, b FROM t1 outer_table where
a = (select a from t1 where b = outer_table.b ) and b=@arg00 ;
......@@ -540,16 +853,58 @@ execute stmt1 using @arg00, @arg00, @arg00, @arg01 ;
a ?
0 1
drop table if exists t2 ;
create table t2 as select * from t_many_col_types;
create table t2 as select * from t1;
prepare stmt1 from ' select a in (select a from t2) from t1 ' ;
execute stmt1 ;
a in (select a from t2)
1
1
1
1
drop table if exists t5, t6, t7 ;
create table t5 (a int , b int) ;
create table t6 like t5 ;
create table t7 like t5 ;
insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
(2, -1), (3, 10) ;
insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1) ;
insert into t7 values (3, 3), (2, 2), (1, 1) ;
prepare stmt1 from ' select a, (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1) from t7 ' ;
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
execute stmt1 ;
a (select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= t7.b
group by t5.a order by sum limit 1)
3 1
2 2
1 2
drop table t5, t6, t7 ;
drop table if exists t2 ;
create table t2 as select * from t9;
set @stmt= ' SELECT
(SELECT SUM(c1 + c12 + 0.0) FROM t2
where (t_many_col_types.c2 - 0e-3) = t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
where (t9.c2 - 0e-3) = t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select 1.0e+0 from t2
where t2.c3 * 9.0000000000 = t_many_col_types.c4) as exists_s,
where t2.c3 * 9.0000000000 = t9.c4) as exists_s,
c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s,
(c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ;
execute stmt1 ;
......@@ -560,22 +915,22 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
18.0000 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -584,8 +939,8 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -593,21 +948,21 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t_many_col_types.c2-?)=t2.c2
GROUP BY t_many_col_types.c15 LIMIT 1) as scalar_s,
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s,
exists (select ? from t2
where t2.c3*?=t_many_col_types.c4) as exists_s,
where t2.c3*?=t9.c4) as exists_s,
c5*? in (select c6+? from t2) as in_s,
(c7-?, c8-?) in (select c9+?, c10+? from t2) as in_row_s
FROM t_many_col_types,
FROM t9,
(select c25 x, c32 y from t2) tt WHERE x =c25 ' ;
set @arg00= 0.0 ;
set @arg01= 0e-3 ;
......@@ -629,16 +984,16 @@ def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
18 1 0 1
set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
......@@ -646,7 +1001,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 16 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
......@@ -655,8 +1010,8 @@ def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
......@@ -665,14 +1020,22 @@ id select_type table type possible_keys key key_len ref rows Extra
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t_many_col_types ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ;
select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row
prepare stmt1 from ' select 1 < (select a from t1) ' ;
execute stmt1 ;
ERROR 21000: Subquery returns more than 1 row
select 1 as my_col ;
my_col
1
test_sequence
------ union tests ------
prepare stmt1 from ' select a FROM t1 where a=1
......@@ -691,6 +1054,14 @@ execute stmt1 ;
a
1
1
prepare stmt1 from ' SELECT 1, 2 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT 1, 2 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT * from t1 union SELECT 1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
prepare stmt1 from ' SELECT 1 union SELECT * from t1 ' ;
ERROR 21000: The used SELECT statements have a different number of columns
set @arg00=1 ;
select @arg00 FROM t1 where a=1
union distinct
......@@ -855,44 +1226,21 @@ the_sum the_town
204 Lisboa
test_sequence
------ explain select tests ------
prepare stmt1 from ' select * from t_many_col_types ' ;
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t_many_col_types t_many_col_types c1 c1 1 4 1 N 49155 0 63
def test t_many_col_types t_many_col_types c2 c2 2 6 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c3 c3 9 9 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c4 c4 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c5 c5 3 11 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c6 c6 8 20 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c7 c7 4 12 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c8 c8 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c9 c9 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c10 c10 5 22 1 Y 32768 31 63
def test t_many_col_types t_many_col_types c11 c11 0 9 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c12 c12 0 10 6 Y 32768 4 63
def test t_many_col_types t_many_col_types c13 c13 10 10 10 Y 128 0 63
def test t_many_col_types t_many_col_types c14 c14 12 19 19 Y 128 0 63
def test t_many_col_types t_many_col_types c15 c15 7 19 19 N 1249 0 63
def test t_many_col_types t_many_col_types c16 c16 11 8 8 Y 128 0 63
def test t_many_col_types t_many_col_types c17 c17 13 4 4 Y 32864 0 63
def test t_many_col_types t_many_col_types c18 c18 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c19 c19 1 1 1 Y 32768 0 63
def test t_many_col_types t_many_col_types c20 c20 254 1 1 Y 0 0 8
def test t_many_col_types t_many_col_types c21 c21 253 10 10 Y 0 0 8
def test t_many_col_types t_many_col_types c22 c22 253 30 30 Y 0 0 8
def test t_many_col_types t_many_col_types c23 c23 252 255 8 Y 144 0 63
def test t_many_col_types t_many_col_types c24 c24 252 255 8 Y 16 0 8
def test t_many_col_types t_many_col_types c25 c25 252 65535 4 Y 144 0 63
def test t_many_col_types t_many_col_types c26 c26 252 65535 4 Y 16 0 8
def test t_many_col_types t_many_col_types c27 c27 252 16777215 10 Y 144 0 63
def test t_many_col_types t_many_col_types c28 c28 252 16777215 10 Y 16 0 8
def test t_many_col_types t_many_col_types c29 c29 252 16777215 8 Y 144 0 63
def test t_many_col_types t_many_col_types c30 c30 252 16777215 8 Y 16 0 8
def test t_many_col_types t_many_col_types c31 c31 254 5 3 Y 256 0 8
def test t_many_col_types t_many_col_types c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
def id 8 3 1 N 32801 0 8
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 3
test_sequence
------ delete tests ------
delete from t1 ;
......@@ -901,8 +1249,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -911,7 +1259,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -920,6 +1268,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -946,8 +1295,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -956,7 +1305,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -965,6 +1314,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
......@@ -1041,6 +1391,8 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
......@@ -1048,7 +1400,37 @@ prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
select a,b from t1 order by a;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
3 three
4 four
drop table t2 ;
create table t2
(
a int, b varchar(30),
primary key(a)
) engine = 'BDB' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
2 two
......@@ -1075,8 +1457,8 @@ insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t_many_col_types ;
insert into t_many_col_types
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1085,7 +1467,7 @@ c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t_many_col_types
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
......@@ -1094,6 +1476,7 @@ c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
......@@ -1120,6 +1503,67 @@ execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
a b
8 eight
set @NULL= null ;
set @arg00= 'abc' ;
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @NULL ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
execute stmt1 using @NULL, @arg00 ;
ERROR 23000: Column 'a' cannot be null
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg00 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg00 ;
select * from t1 where a > 10000 order by a ;
a b
10001 abc
10002 abc
delete from t1 where a > 10000 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @NULL ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @NULL ;
select * from t1 where a > 10000 order by a ;
a b
10001 NULL
10002 NULL
delete from t1 where a > 10000 ;
set @arg01= 10000 + 10 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 9 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 8 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 7 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 6 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 5 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 4 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 3 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 2 ;
execute stmt1 using @arg01, @arg01 ;
set @arg01= 10000 + 1 ;
execute stmt1 using @arg01, @arg01 ;
select * from t1 where a > 10000 order by a ;
a b
10001 10001
10002 10002
10003 10003
10004 10004
10005 10005
10006 10006
10007 10007
10008 10008
10009 10009
10010 10010
delete from t1 where a > 10000 ;
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
......@@ -1159,6 +1603,19 @@ set @arg00=81 ;
set @arg01=1 ;
execute stmt1 using @arg00, @arg01;
ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'BDB' ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
1
insert into t2 values (NULL) ;
execute stmt1 ;
last_insert_id()
2
drop table t2 ;
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
......@@ -1192,6 +1649,75 @@ a b
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
test_sequence
------ multi table tests ------
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
2 two
3 three
execute stmt_select2 ;
c1 c21
2 two
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
3 three
execute stmt_select2 ;
c1 c21
3 three
set @arg00= @arg00 + 1 ;
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
a b
execute stmt_select2 ;
c1 c21
set @arg00= @arg00 + 1 ;
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t1 values(0,NULL) ;
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
......@@ -1241,17 +1767,12 @@ union
select b, a + @100 from t1
where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b
from t1);
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
......@@ -1265,17 +1786,1406 @@ select b, a + ? from t1
where (a,b) in ( select sqrt(a+?)+CAST(? AS signed),b
from t1 ) ' ;
execute stmt1 using @duplicate, @5, @five, @2, @100, @1, @float ;
affected rows: 8
info: Records: 8 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
7 duplicate
8 duplicate
9 duplicate
81 duplicate
82 duplicate
103 three
drop table t2;
drop table t1, t_many_col_types;
drop table if exists t5 ;
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
set @arg04= 'abc' ;
set @arg05= CAST('abc' as binary) ;
set @arg06= '1991-08-05' ;
set @arg07= CAST('1991-08-05' as date);
set @arg08= '1991-08-05 01:01:01' ;
set @arg09= CAST('1991-08-05 01:01:01' as datetime) ;
set @arg10= unix_timestamp('1991-01-01 01:01:01');
set @arg11= YEAR('1991-01-01 01:01:01');
set @arg12= 8 ;
set @arg12= NULL ;
set @arg13= 8.0 ;
set @arg13= NULL ;
set @arg14= 'abc';
set @arg14= NULL ;
set @arg15= CAST('abc' as binary) ;
set @arg15= NULL ;
create table t5 as select
8 as const01, @arg01 as param01,
8.0 as const02, @arg02 as param02,
80.00000000000e-1 as const03, @arg03 as param03,
'abc' as const04, @arg04 as param04,
CAST('abc' as binary) as const05, @arg05 as param05,
'1991-08-05' as const06, @arg06 as param06,
CAST('1991-08-05' as date) as const07, @arg07 as param07,
'1991-08-05 01:01:01' as const08, @arg08 as param08,
CAST('1991-08-05 01:01:01' as datetime) as const09, @arg09 as param09,
unix_timestamp('1991-01-01 01:01:01') as const10, @arg10 as param10,
YEAR('1991-01-01 01:01:01') as const11, @arg11 as param11,
NULL as const12, @arg12 as param12,
@arg13 as param13,
@arg14 as param14,
@arg15 as param15;
show create table t5 ;
Table Create Table
t5 CREATE TABLE `t5` (
`const01` bigint(1) NOT NULL default '0',
`param01` bigint(20) default NULL,
`const02` double(3,1) NOT NULL default '0.0',
`param02` double default NULL,
`const03` double NOT NULL default '0',
`param03` double default NULL,
`const04` char(3) NOT NULL default '',
`param04` longtext,
`const05` binary(3) NOT NULL default '',
`param05` longblob,
`const06` varchar(10) NOT NULL default '',
`param06` longtext,
`const07` date default NULL,
`param07` longblob,
`const08` varchar(19) NOT NULL default '',
`param08` longtext,
`const09` datetime default NULL,
`param09` longblob,
`const10` int(10) NOT NULL default '0',
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
`const12` char(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
`param14` longblob,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t5 t5 const01 const01 8 1 1 N 32769 0 63
def test t5 t5 param01 param01 8 20 1 Y 32768 0 63
def test t5 t5 const02 const02 5 3 3 N 32769 1 63
def test t5 t5 param02 param02 5 20 1 Y 32768 31 63
def test t5 t5 const03 const03 5 23 1 N 32769 31 63
def test t5 t5 param03 param03 5 20 1 Y 32768 31 63
def test t5 t5 const04 const04 254 3 3 N 1 0 8
def test t5 t5 param04 param04 252 16777215 3 Y 16 0 8
def test t5 t5 const05 const05 254 3 3 N 129 0 63
def test t5 t5 param05 param05 252 16777215 3 Y 144 0 63
def test t5 t5 const06 const06 253 10 10 N 1 0 8
def test t5 t5 param06 param06 252 16777215 10 Y 16 0 8
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
def test t5 t5 param07 param07 252 16777215 10 Y 144 0 63
def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 16777215 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 16777215 19 Y 144 0 63
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
def test t5 t5 const12 const12 254 0 0 Y 0 0 8
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
const02 8.0
param02 8
const03 8
param03 8
const04 abc
param04 abc
const05 abc
param05 abc
const06 1991-08-05
param06 1991-08-05
const07 1991-08-05
param07 1991-08-05
const08 1991-08-05 01:01:01
param08 1991-08-05 01:01:01
const09 1991-08-05 01:01:01
param09 1991-08-05 01:01:01
const10 662680861
param10 662680861
const11 1991
param11 1991
const12 NULL
param12 NULL
param13 NULL
param14 NULL
param15 NULL
drop table t5 ;
test_sequence
------ data type conversion tests ------
delete from t1 ;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
commit ;
delete from t9 ;
insert into t9
set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,
c10= 1, c11= 1, c12 = 1,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=true, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';
insert into t9
set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,
c10= 9, c11= 9, c12 = 9,
c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',
c16= '11:11:11', c17= '2004',
c18= 1, c19=false, c20= 'a', c21= '123456789a',
c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',
c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',
c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
insert into t9 set c1= 0, c15= '1991-01-01 01:01:01' ;
select * from t9 order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
test_sequence
------ select @parameter:= column ------
prepare full_info from "select @arg01, @arg02, @arg03, @arg04,
@arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12,
@arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20,
@arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28,
@arg29, @arg30, @arg31, @arg32" ;
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 1 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= 0 ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@arg05:= c5, @arg06:= c6, @arg07:= c7, @arg08:= c8,
@arg09:= c9, @arg10:= c10, @arg11:= c11, @arg12:= c12,
@arg13:= c13, @arg14:= c14, @arg15:= c15, @arg16:= c16,
@arg17:= c17, @arg18:= c18, @arg19:= c19, @arg20:= c20,
@arg21:= c21, @arg22:= c22, @arg23:= c23, @arg24:= c24,
@arg25:= c25, @arg26:= c26, @arg27:= c27, @arg28:= c28,
@arg29:= c29, @arg30:= c30, @arg31:= c31, @arg32:= c32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
@arg01:= c1 @arg02:= c2 @arg03:= c3 @arg04:= c4 @arg05:= c5 @arg06:= c6 @arg07:= c7 @arg08:= c8 @arg09:= c9 @arg10:= c10 @arg11:= c11 @arg12:= c12 @arg13:= c13 @arg14:= c14 @arg15:= c15 @arg16:= c16 @arg17:= c17 @arg18:= c18 @arg19:= c19 @arg20:= c20 @arg21:= c21 @arg22:= c22 @arg23:= c23 @arg24:= c24 @arg25:= c25 @arg26:= c26 @arg27:= c27 @arg28:= c28 @arg29:= c29 @arg30:= c30 @arg31:= c31 @arg32:= c32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
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 ':= c1 from t9 where c1= 1' at line 1
test_sequence
------ select column, .. into @parm,.. ------
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 1 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= 0 ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32
into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08,
@arg09, @arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16,
@arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24,
@arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32
from t9 where c1= ?" ;
set @my_key= 1 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 1 Y 128 31 63
def @arg03 254 20 1 Y 128 31 63
def @arg04 254 20 1 Y 128 31 63
def @arg05 254 20 1 Y 128 31 63
def @arg06 254 20 1 Y 128 31 63
def @arg07 254 20 1 Y 128 31 63
def @arg08 254 20 1 Y 128 31 63
def @arg09 254 20 1 Y 128 31 63
def @arg10 254 20 1 Y 128 31 63
def @arg11 254 20 1 Y 128 31 63
def @arg12 254 20 1 Y 128 31 63
def @arg13 254 8192 10 Y 128 31 63
def @arg14 254 8192 19 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 8 Y 128 31 63
def @arg17 254 20 4 Y 128 31 63
def @arg18 254 20 1 Y 128 31 63
def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
def @arg32 254 8192 6 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
execute stmt1 using @my_key ;
execute full_info ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def @arg01 254 20 1 Y 128 31 63
def @arg02 254 20 0 Y 128 31 63
def @arg03 254 20 0 Y 128 31 63
def @arg04 254 20 0 Y 128 31 63
def @arg05 254 20 0 Y 128 31 63
def @arg06 254 20 0 Y 128 31 63
def @arg07 254 20 0 Y 128 31 63
def @arg08 254 20 0 Y 128 31 63
def @arg09 254 20 0 Y 128 31 63
def @arg10 254 20 0 Y 128 31 63
def @arg11 254 20 0 Y 128 31 63
def @arg12 254 20 0 Y 128 31 63
def @arg13 254 8192 0 Y 128 31 63
def @arg14 254 8192 0 Y 128 31 63
def @arg15 254 8192 19 Y 128 31 63
def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
def @arg20 254 8192 0 Y 128 31 63
def @arg21 254 8192 0 Y 128 31 63
def @arg22 254 8192 0 Y 128 31 63
def @arg23 254 8192 0 Y 128 31 63
def @arg24 254 8192 0 Y 128 31 63
def @arg25 254 8192 0 Y 128 31 63
def @arg26 254 8192 0 Y 128 31 63
def @arg27 254 8192 0 Y 128 31 63
def @arg28 254 8192 0 Y 128 31 63
def @arg29 254 8192 0 Y 128 31 63
def @arg30 254 8192 0 Y 128 31 63
def @arg31 254 8192 0 Y 128 31 63
def @arg32 254 8192 0 Y 128 31 63
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
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 '? from t9 where c1= 1' at line 1
test_sequence
-- insert into numeric columns --
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 ) ;
set @arg00= 21 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 )" ;
execute stmt1 ;
set @arg00= 23;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0 ) ;
set @arg00= 31.0 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0, 32.0,
32.0, 32.0, 32.0 )" ;
execute stmt1 ;
set @arg00= 33.0;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '40', '40', '40', '40', '40', '40', '40', '40',
'40', '40', '40' ) ;
set @arg00= '41' ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( '42', '42', '42', '42', '42', '42', '42', '42',
'42', '42', '42' )" ;
execute stmt1 ;
set @arg00= '43';
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary),
CAST('50' as binary), CAST('50' as binary), CAST('50' as binary) ) ;
set @arg00= CAST('51' as binary) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary),
CAST('52' as binary), CAST('52' as binary), CAST('52' as binary) )" ;
execute stmt1 ;
set @arg00= CAST('53' as binary) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 2 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 60, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL ) ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 61, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt1 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 62, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL )" ;
execute stmt1 ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 63, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 8.0 ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 71, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 73, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
set @arg00= 'abc' ;
set @arg00= NULL ;
insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 81, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ) ;
prepare stmt2 from "insert into t9
( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 83, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
execute stmt2 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c1 >= 20
order by c1 ;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c12
20 20 20 20 20 20 20 20 20 20 20.0000
21 21 21 21 21 21 21 21 21 21 21.0000
22 22 22 22 22 22 22 22 22 22 22.0000
23 23 23 23 23 23 23 23 23 23 23.0000
30 30 30 30 30 30 30 30 30 30 30.0000
31 31 31 31 31 31 31 31 31 31 31.0000
32 32 32 32 32 32 32 32 32 32 32.0000
33 33 33 33 33 33 33 33 33 33 33.0000
40 40 40 40 40 40 40 40 40 40 40.0000
41 41 41 41 41 41 41 41 41 41 41.0000
42 42 42 42 42 42 42 42 42 42 42.0000
43 43 43 43 43 43 43 43 43 43 43.0000
50 50 50 50 50 50 50 50 50 50 50.0000
51 51 51 51 51 51 51 51 51 51 51.0000
52 52 52 52 52 52 52 52 52 52 52.0000
53 53 53 53 53 53 53 53 53 53 53.0000
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where numeric column = .. --
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c2= 20 and c3= 20 and c4= 20 and c5= 20 and c6= 20 and c7= 20
and c8= 20 and c9= 20 and c10= 20 and c12= 20 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0;
found
true
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20.0 and c2= 20.0 and c3= 20.0 and c4= 20.0 and c5= 20.0 and c6= 20.0
and c7= 20.0 and c8= 20.0 and c9= 20.0 and c10= 20.0 and c12= 20.0 ";
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20';
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= '20' and c2= '20' and c3= '20' and c4= '20' and c5= '20' and c6= '20'
and c7= '20' and c8= '20' and c9= '20' and c10= '20' and c12= '20' ";
execute stmt1 ;
found
true
set @arg00= '20';
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary);
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= CAST('20' as binary) and c2= CAST('20' as binary) and
c3= CAST('20' as binary) and c4= CAST('20' as binary) and
c5= CAST('20' as binary) and c6= CAST('20' as binary) and
c7= CAST('20' as binary) and c8= CAST('20' as binary) and
c9= CAST('20' as binary) and c10= CAST('20' as binary) and
c12= CAST('20' as binary) ";
execute stmt1 ;
found
true
set @arg00= CAST('20' as binary) ;
select 'true' as found from t9
where c1= @arg00 and c2= @arg00 and c3= @arg00 and c4= @arg00 and c5= @arg00
and c6= @arg00 and c7= @arg00 and c8= @arg00 and c9= @arg00 and c10= @arg00
and c12= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= ? and c2= ? and c3= ? and c4= ? and c5= ?
and c6= ? and c7= ? and c8= ? and c9= ? and c10= ?
and c12= ? ";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- some numeric overflow experiments --
prepare my_insert from "insert into t9
( c21, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12 )
values
( 'O', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
prepare my_select from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c12
from t9 where c21 = 'O' ";
prepare my_delete from "delete from t9 where c21 = 'O' ";
set @arg00= 9223372036854775807 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= '9223372036854775807' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 9.22337e+18
c8 9.22337203685478e+18
c9 9.22337203685478e+18
c10 9.22337203685478e+18
c12 99999.9999
execute my_delete ;
set @arg00= -9223372036854775808 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= '-9223372036854775808' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -9.22337e+18
c8 -9.22337203685478e+18
c9 -9.22337203685478e+18
c10 -9.22337203685478e+18
c12 -9999.9999
execute my_delete ;
set @arg00= 1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 127
c2 32767
c3 8388607
c4 2147483647
c5 2147483647
c6 9223372036854775807
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= '1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 1
c2 1
c3 1
c4 1
c5 1
c6 1
c7 3.40282e+38
c8 1.11111111111111e+50
c9 1.11111111111111e+50
c10 1.11111111111111e+50
c12 99999.9999
execute my_delete ;
set @arg00= -1.11111111111111111111e+50 ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1264 Data truncated; out of range for column 'c1' at row 1
Warning 1264 Data truncated; out of range for column 'c2' at row 1
Warning 1264 Data truncated; out of range for column 'c3' at row 1
Warning 1264 Data truncated; out of range for column 'c4' at row 1
Warning 1264 Data truncated; out of range for column 'c5' at row 1
Warning 1264 Data truncated; out of range for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -128
c2 -32768
c3 -8388608
c4 -2147483648
c5 -2147483648
c6 -9223372036854775808
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
set @arg00= '-1.11111111111111111111e+50' ;
execute my_insert using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
Warnings:
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c2' at row 1
Warning 1265 Data truncated for column 'c3' at row 1
Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Data truncated; out of range for column 'c7' at row 1
Warning 1264 Data truncated; out of range for column 'c12' at row 1
execute my_select ;
c1 -1
c2 -1
c3 -1
c4 -1
c5 -1
c6 -1
c7 -3.40282e+38
c8 -1.11111111111111e+50
c9 -1.11111111111111e+50
c10 -1.11111111111111e+50
c12 -9999.9999
execute my_delete ;
test_sequence
-- insert into string columns --
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
select c1, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30
from t9 where c1 >= 20
order by c1 ;
c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
20 2 20 20 20 20 20 20 20 20 20 20
21 2 21 21 21 21 21 21 21 21 21 21
22 2 22 22 22 22 22 22 22 22 22 22
23 2 23 23 23 23 23 23 23 23 23 23
30 3 30 30 30 30 30 30 30 30 30 30
31 3 31 31 31 31 31 31 31 31 31 31
32 3 32 32 32 32 32 32 32 32 32 32
33 3 33 33 33 33 33 33 33 33 33 33
40 4 40 40 40 40 40 40 40 40 40 40
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
51 5 51 51 51 51 51 51 51 51 51 51
52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
55 5 55 55 55 55 55 55 55 55 55 55
56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
63 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
71 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
73 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
81 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
83 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
test_sequence
-- select .. where string column = .. --
set @arg00= '20';
select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20' ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr('20',1+length(c20)))= '20' and c21= '20' and
c22= '20' and c23= '20' and c24= '20' and c25= '20' and c26= '20' and
c27= '20' and c28= '20' and c29= '20' and c30= '20'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('20' as binary);
select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary) ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20))) = @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and
c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(CAST('20' as binary),1+length(c20)))
= CAST('20' as binary) and c21= CAST('20' as binary)
and c22= CAST('20' as binary) and c23= CAST('20' as binary) and
c24= CAST('20' as binary) and c25= CAST('20' as binary) and
c26= CAST('20' as binary) and c27= CAST('20' as binary) and
c28= CAST('20' as binary) and c29= CAST('20' as binary) and
c30= CAST('20' as binary)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20))) = ? and c21= ? and
c22= ? and c23= ? and c25= ? and c26= ? and c27= ? and c28= ? and
c29= ? and c30= ?";
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20,1+length(c20)))= 20 and c21= 20 and
c22= 20 and c23= 20 and c24= 20 and c25= 20 and c26= 20 and
c27= 20 and c28= 20 and c29= 20 and c30= 20" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 20.0;
select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0 ;
found
true
select 'true' as found from t9
where c1= 20 and concat(c20,substr(@arg00,1+length(c20)))= @arg00 and
c21= @arg00 and c22= @arg00 and c23= @arg00 and c25= @arg00 and
c26= @arg00 and c27= @arg00 and c28= @arg00 and c29= @arg00 and c30= @arg00;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(20.0,1+length(c20)))= 20.0 and c21= 20.0 and
c22= 20.0 and c23= 20.0 and c24= 20.0 and c25= 20.0 and c26= 20.0 and
c27= 20.0 and c28= 20.0 and c29= 20.0 and c30= 20.0" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and concat(c20,substr(?,1+length(c20)))= ? and
c21= ? and c22= ? and c23= ? and c25= ? and
c26= ? and c27= ? and c28= ? and c29= ? and c30= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
@arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1264 Data truncated; out of range for column 'c13' at row 1
Warning 1265 Data truncated for column 'c14' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Data truncated; out of range for column 'c16' at row 1
Warning 1264 Data truncated; out of range for column 'c17' at row 1
select c1, c13, c14, c15, c16, c17 from t9 order by c1 ;
c1 c13 c14 c15 c16 c17
20 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
21 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
22 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
23 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
30 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
31 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
32 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
33 1991-01-01 1991-01-01 01:01:01 1991-01-01 01:01:01 01:01:01 1991
40 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
41 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
61 NULL NULL 1991-01-01 01:01:01 NULL NULL
62 NULL NULL 1991-01-01 01:01:01 NULL NULL
63 NULL NULL 1991-01-01 01:01:01 NULL NULL
71 NULL NULL 1991-01-01 01:01:01 NULL NULL
73 NULL NULL 1991-01-01 01:01:01 NULL NULL
81 NULL NULL 1991-01-01 01:01:01 NULL NULL
83 NULL NULL 1991-01-01 01:01:01 NULL NULL
test_sequence
-- select .. where date/time column = .. --
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
found
true
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c14= CAST('1991-01-01 01:01:01' as datetime) and
c15= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
found
true
set @arg00= 1991 ;
select 'true' as found from t9
where c1= 20 and c17= 1991 ;
found
true
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1991" ;
execute stmt1 ;
found
true
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
true
set @arg00= 1.991e+3 ;
select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ;
found
select 'true' as found from t9
where c1= 20 and c17= @arg00 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ;
execute stmt1 ;
found
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ;
execute stmt1 using @arg00 ;
found
drop table t1, t9;
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,13 +14,13 @@ select '------ basic tests ------' as test_sequence ;
--enable_query_log
let $type= 'MYISAM' ;
# create the tables (t1 and t_many_col_types) used in many tests
# create the tables (t1 and t9) used in many tests
--source include/ps_create.inc
# insert data into these tables
--source include/ps_renew.inc
##### The basic functions ####
################ The basic functions ################
# 1. PREPARE stmt_name FROM <preparable statement>;
# <preparable statement> ::=
......@@ -54,7 +54,7 @@ select * from t1 where a = @var ;
# The server will reply with "Query Ok" or an error message.
DEALLOCATE PREPARE stmt ;
## prepare
################ PREPARE ################
# prepare without parameter
prepare stmt1 from ' select 1 as my_col ' ;
# prepare with parameter
......@@ -91,9 +91,15 @@ set @arg00=NULL;
prepare stmt1 from @arg01;
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
# prepare must fail (column does not exist)
# prepare must fail (column x does not exist)
--error 1054
prepare stmt1 from ' select * from t1 where x <= 2 ' ;
# cases derived from client_test.c: test_null()
# prepare must fail (column x does not exist)
--error 1054
prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
--error 1054
prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
--disable_warnings
drop table if exists not_exist ;
--enable_warnings
......@@ -109,7 +115,7 @@ prepare stmt1 from ' insert into t1 values(? ' ;
prepare stmt1 from ' select a, b from t1
where a=? and where ' ;
## execute
################ EXECUTE ################
# execute must fail (statement never_prepared never prepared)
--error 1243
execute never_prepared ;
......@@ -122,89 +128,89 @@ prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
execute stmt1 ;
# drop the table between prepare and execute
create table to_be_dropped
create table t5
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 1, 'original table', 1);
prepare stmt2 from ' select * from to_be_dropped ' ;
insert into t5( a, b, c) values( 1, 'original table', 1);
prepare stmt2 from ' select * from t5 ' ;
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# execute must fail (table was dropped after prepare)
--error 1146
execute stmt2 ;
# cases derived from client_test.c: test_select_prepare()
# 1. drop + create table (same column names/types/order)
# between prepare and execute
create table to_be_dropped
create table t5
(
a int primary key,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# 2. drop + create table (same column names/types but different order)
# between prepare and execute
create table to_be_dropped
create table t5
(
a int primary key,
c int,
b char(30)
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# 3. drop + create table (same column names/types/order+extra column)
# between prepare and execute
create table to_be_dropped
create table t5
(
a int primary key,
b char(30),
c int,
d timestamp default current_timestamp
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# 4. drop + create table (same column names/types, different order +
# additional column) between prepare and execute
create table to_be_dropped
create table t5
(
a int primary key,
d timestamp default current_timestamp,
b char(30),
c int
);
insert into to_be_dropped( a, b, c) values( 9, 'recreated table', 9);
insert into t5( a, b, c) values( 9, 'recreated table', 9);
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# 5. drop + create table (same column names/order, different types)
# between prepare and execute
create table to_be_dropped
create table t5
(
a timestamp default '2004-02-29 18:01:59',
b char(30),
c int
);
insert into to_be_dropped( b, c) values( 'recreated table', 9);
insert into t5( b, c) values( 'recreated table', 9);
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# 6. drop + create table (same column types/order, different names)
# between prepare and execute
create table to_be_dropped
create table t5
(
f1 int primary key,
f2 char(30),
f3 int
);
insert into to_be_dropped( f1, f2, f3) values( 9, 'recreated table', 9);
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
--error 1054
execute stmt2 ;
drop table to_be_dropped ;
drop table t5 ;
# execute without parameter
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
......@@ -223,8 +229,8 @@ execute stmt1 using @arg00, @arg01;
# execute must fail (parameter is not set)
execute stmt1 using @not_set;
## deallocate
# deallocate must fail (never_prepared was never prepared)
################ DEALLOCATE ################
# deallocate must fail (the statement 'never_prepared' was never prepared)
--error 1243
deallocate prepare never_prepared ;
# deallocate must fail (prepare stmt1 just failed,
......@@ -234,13 +240,13 @@ prepare stmt1 from ' select * from t1 where a <= 2 ' ;
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
--error 1243
deallocate prepare stmt1;
create table to_be_dropped
create table t5
(
a int primary key,
b char(10)
);
prepare stmt2 from ' select a,b from to_be_dropped where a <= 2 ' ;
drop table to_be_dropped ;
prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
drop table t5 ;
# deallocate prepared statement where the table was dropped after prepare
deallocate prepare stmt2;
......@@ -271,7 +277,7 @@ create table t2
a int primary key, b char(10)
);
###### SHOW COMMANDS
################ SHOW COMMANDS ################
prepare stmt4 from ' show databases ';
execute stmt4;
prepare stmt4 from ' show tables from test like ''t2%'' ';
......@@ -287,7 +293,7 @@ prepare stmt4 from ' show table status from test like ''t2%'' ';
# Bug#4288 : prepared statement 'show table status ..', wrong output on execute
execute stmt4;
# try the same with the big table
prepare stmt4 from ' show table status from test like ''t_many_col_types%'' ';
prepare stmt4 from ' show table status from test like ''t9%'' ';
# egalize date and time values
--replace_column 12 # 13 # 14 #
# Bug#4288
......@@ -324,18 +330,75 @@ prepare stmt4 from ' show storage engines ';
--replace_column 2 YES/NO
execute stmt4;
###### MISC STUFF
################ MISC STUFF ################
## get a warning and an error
# cases derived from client_test.c: test_warnings(), test_errors()
--disable_warnings
drop table if exists tx;
drop table if exists t5;
--enable_warnings
prepare stmt1 from ' drop table if exists tx ' ;
prepare stmt1 from ' drop table if exists t5 ' ;
execute stmt1 ;
prepare stmt1 from ' drop table tx ' ;
prepare stmt1 from ' drop table t5 ' ;
--error 1051
execute stmt1 ;
## SELECT @@version
# cases derived from client_test.c: test_select_version()
#
# TODO: Metadata check is temporary disabled here, because metadata of
# this statement also depends on @@version contents and you can't apply
# replace_column and replace_result to it. It will be enabled again when
# support of replace_column and replace_result on metadata will be
# implemented.
#
#--enable_metadata
prepare stmt1 from ' SELECT @@version ' ;
# egalize the version
--replace_column 1 <version>
execute stmt1 ;
#--disable_metadata
## do @var:= and set @var=
# cases derived from client_test.c: test_do_set()
prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
let $1= 3 ;
while ($1)
{
execute stmt_do ;
--disable_query_log
select @var as 'content of @var is:' ;
--enable_query_log
execute stmt_set ;
--disable_query_log
select @var as 'content of @var is:' ;
--enable_query_log
dec $1 ;
}
# the same test with a table containing one column and 'select *'
--disable_warnings
drop table if exists t5 ;
--enable_warnings
create table t5 (a int) ;
prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
let $1= 3 ;
while ($1)
{
execute stmt_do ;
--disable_query_log
select @var as 'content of @var is:' ;
--enable_query_log
execute stmt_set ;
--disable_query_log
select @var as 'content of @var is:' ;
--enable_query_log
dec $1 ;
}
drop table t5 ;
deallocate prepare stmt_do ;
deallocate prepare stmt_set ;
## nonsense like prepare of prepare,execute or deallocate
--error 1064
prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
......@@ -447,6 +510,34 @@ prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
execute stmt1 using @arg00;
--disable_metadata
## parameters with probably problematic characters (quote, double quote)
# cases derived from client_test.c: test_logs()
# try if
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2 (id smallint, name varchar(20)) ;
prepare stmt1 from ' insert into t2 values(?, ?) ' ;
set @id= 9876 ;
set @arg00= 'MySQL - Open Source Database' ;
set @arg01= "'" ;
set @arg02= '"' ;
set @arg03= "my'sql'" ;
set @arg04= 'my"sql"' ;
insert into t2 values ( @id , @arg00 );
insert into t2 values ( @id , @arg01 );
insert into t2 values ( @id , @arg02 );
insert into t2 values ( @id , @arg03 );
insert into t2 values ( @id , @arg04 );
prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
execute stmt1 using @id, @arg00 ;
execute stmt1 using @id, @arg01 ;
execute stmt1 using @id, @arg02 ;
execute stmt1 using @id, @arg03 ;
execute stmt1 using @id, @arg04 ;
drop table t2;
################ CREATE/DROP/ALTER/RENAME TESTS ################
--disable_query_log
select '------ create/drop/alter/rename tests ------' as test_sequence ;
--enable_query_log
......@@ -455,11 +546,13 @@ select '------ create/drop/alter/rename tests ------' as test_sequence ;
drop table if exists t2, t3;
--enable_warnings
## DROP TABLE
prepare stmt_drop from ' drop table if exists t2 ' ;
--disable_warnings
execute stmt_drop;
--enable_warnings
## CREATE TABLE
prepare stmt_create from ' create table t2 (
a int primary key, b char(10)) ';
execute stmt_create;
......@@ -467,6 +560,7 @@ prepare stmt3 from ' create table t3 like t2 ';
execute stmt3;
drop table t3;
## CREATE TABLE .. SELECT
set @arg00=1;
prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
# Bug#4280 server hangs, prepared "create table .. as select ? .."
......@@ -480,6 +574,8 @@ prepare stmt3 from ' create index t2_idx on t2(b) ';
prepare stmt3 from ' drop index t2_idx on t2 ' ;
--error 1295
prepare stmt3 from ' alter table t2 drop primary key ';
## RENAME TABLE
--disable_warnings
drop table if exists new_t2;
--enable_warnings
......@@ -489,15 +585,41 @@ execute stmt3;
execute stmt3;
rename table new_t2 to t2;
drop table t2;
## RENAME more than on TABLE within one statement
# cases derived from client_test.c: test_rename()
--disable_warnings
drop table if exists t5, t6, t7, t8 ;
--enable_warnings
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
# rename must fail, tc does not exist
--error 1017
execute stmt1 ;
create table t7 (a int) ;
# rename, t5 -> t6 and t7 -> t8
execute stmt1 ;
# rename must fail, t5 and t7 does not exist t6 and t8 already exist
--error 1050
execute stmt1 ;
rename table t6 to t5, t8 to t7 ;
# rename, t5 -> t6 and t7 -> t8
execute stmt1 ;
drop table t6, t8 ;
################ BIG STATEMENT TESTS ################
--disable_query_log
select '------ big statement tests ------' as test_sequence ;
--enable_query_log
# The following tests use huge numbers of lines, characters or parameters
# per prepared statement.
# I assume the server and also the client (mysqltest) are stressed.
#
# Attention: The limits used are NOT derived from the manual
# or other sources.
## many lines ( 50 )
select 'ABC' as my_const_col from t1 where
let $my_stmt= select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 AND
......@@ -547,62 +669,14 @@ select 'ABC' as my_const_col from t1 where
1 = 1 AND
1 = 1 AND
1 = 1 ;
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 AND
1 = 1 ' ;
eval ($my_stmt) ;
eval prepare stmt1 from "$my_stmt" ;
execute stmt1 ;
execute stmt1 ;
## many characters ( about 1400 )
select 'ABC' as my_const_col FROM t1 WHERE
let $my_stmt= select 'ABC' as my_const_col FROM t1 WHERE
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
......@@ -621,30 +695,14 @@ select 'ABC' as my_const_col FROM t1 WHERE
= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
'1234567890123456789012345678901234567890123456789012345678901234567890'
= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' AND
''1234567890123456789012345678901234567890123456789012345678901234567890''
= ''1234567890123456789012345678901234567890123456789012345678901234567890'' ';
eval ($my_stmt) ;
eval prepare stmt1 from "$my_stmt" ;
execute stmt1 ;
execute stmt1 ;
## many parameters ( 50 )
--disable_query_log
set @arg00= 1;
set @arg01= 1;
set @arg02= 1;
......@@ -695,6 +753,7 @@ set @arg56= 1;
set @arg57= 1;
set @arg60= 1;
set @arg61= 1;
--enable_query_log
select 'ABC' as my_const_col FROM t1 WHERE
@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
......@@ -729,8 +788,156 @@ execute stmt1 using
@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
@arg60, @arg61 ;
# cases derived from client_test.c: test_mem_overun()
--disable_warnings
drop table if exists t5 ;
--enable_warnings
set @col_num= 1000 ;
--disable_query_log
set @string= 'create table t5( ' ;
let $1=`select @col_num - 1` ;
while ($1)
{
eval set @string= concat(@string, 'c$1 int,') ;
dec $1 ;
}
set @string= concat(@string, 'c0 int)' );
--enable_query_log
select @string as "" ;
prepare stmt1 from @string ;
execute stmt1 ;
--disable_query_log
set @string= 'insert into t5 values(' ;
let $1=`select @col_num - 1` ;
while ($1)
{
eval set @string= concat(@string, '1 ,') ;
dec $1 ;
}
eval set @string= concat(@string, '1 )') ;
--enable_query_log
select @string as "" ;
prepare stmt1 from @string ;
execute stmt1 ;
prepare stmt1 from ' select * from t5 ' ;
--enable_metadata
# prevent too long lines
--vertical_results
--disable_result_log
execute stmt1 ;
--enable_result_log
--disable_metadata
--horizontal_results
drop table t5 ;
################ GRANT/REVOKE/DROP affecting a parallel session ################
--disable_query_log
select '------ grant/revoke/drop affects a parallel session test ------'
as test_sequence ;
--enable_query_log
#---------------------------------------------------------------------#
# Here we test that:
# 1. A new GRANT will be visible within another sessions. #
# #
# Let's assume there is a parallel session with an already prepared #
# statement for a table. #
# A DROP TABLE will affect the EXECUTE properties. #
# A REVOKE will affect the EXECUTE properties. #
#---------------------------------------------------------------------#
# Who am I ?
# this is different across different systems:
# select current_user(), user() ;
#### create a new user account ####
## There should be no grants for that non existing user
--error 1141
show grants for second_user@localhost ;
## create a new user account by using GRANT statements on t9
grant usage on test.* to second_user@localhost
identified by 'looser' ;
grant select on test.t9 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
#### establish a second session to the new user account
connect (con3,localhost,second_user,looser,test);
## switch to the second session
connection con3;
# Who am I ?
select current_user();
## check the access rights
show grants for current_user();
prepare s_t9 from 'select c1 as my_col
from t9 where c1= 1' ;
execute s_t9 ;
# check that we cannot do a SELECT on the table t1;
--error 1142
select a as my_col from t1;
#### give access rights to t1 and drop table t9
## switch back to the first session
connection default;
grant select on test.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
drop table t9 ;
show grants for second_user@localhost ;
#### check the access as new user
## switch to the second session
connection con3;
######## Question 1: The table t1 should be now accessible. ########
show grants for second_user@localhost ;
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
######## Question 2: The table t9 does not exist. ########
--error 1146
execute s_t9 ;
#### revoke the access rights to t1
## switch back to the first session
connection default;
revoke all privileges on test.t1 from second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
#### check the access as new user
## switch to the second session
connection con3;
show grants for second_user@localhost ;
######## Question 2: The table t1 should be now not accessible. ########
--error 1142
execute s_t1 ;
## cleanup
## switch back to the first session
connection default;
## disconnect the second session
disconnect con3 ;
## remove all rights of second_user@localhost
revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ;
drop user second_user@localhost ;
commit ;
--error 1141
show grants for second_user@localhost ;
drop table t1 ;
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
#
# 0. You don't have the time to
......@@ -749,7 +956,7 @@ drop table t1 ;
# NO --> alter t/ps_1general.test (Example: Command with syntax error)
# If you need a table, please try to use
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# t9 - table with nearly all available column types
# whenever possible.
#
# The structure and the content of these tables can be found in
......@@ -804,11 +1011,11 @@ drop table t1 ;
# include/ps_query.inc test cases with SELECT/...
# These test cases should not modify the content or
# the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
# include/ps_modify.inc test cases with INSERT/UPDATE/...
# These test cases should not modify the structure
# (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# 't1' and 't9'.
# These two test sequences will be applied to all table types .
#
# include/ps_modify1.inc test cases with INSERT/UPDATE/...
......@@ -816,7 +1023,7 @@ drop table t1 ;
# except MERGE tables.
#
# include/ps_create.inc DROP and CREATE of the tables
# 't1' and 't_many_col_types' .
# 't1' and 't9' .
# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
# recreate the original content of these tables.
# Please do not alter the commands concerning these two tables.
......
......@@ -15,7 +15,28 @@ let $type= 'MYISAM' ;
-- source include/ps_renew.inc
-- source include/ps_query.inc
# parameter in SELECT ... MATCH/AGAINST
# case derived from client_test.c: test_bug1500()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
eval create table t2 (s varchar(25), fulltext(s))
ENGINE = $type ;
insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
commit ;
prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
set @arg00='Dogs' ;
execute stmt1 using @arg00 ;
prepare stmt1 from ' SELECT s FROM t2
where match (s) against (concat(?,''digger'')) ';
set @arg00='Grave' ;
execute stmt1 using @arg00 ;
drop table t2 ;
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -19,5 +19,6 @@ let $type= 'InnoDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -12,7 +12,7 @@ use test;
let $type= 'HEAP' ;
--disable_warnings
drop table if exists t1, t_many_col_types ;
drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
(
......@@ -21,12 +21,12 @@ eval create table t1
) engine = $type ;
--disable_warnings
drop table if exists t_many_col_types;
drop table if exists t9;
--enable_warnings
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
eval create table t_many_col_types
eval create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -44,5 +44,6 @@ eval create table t_many_col_types
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
......@@ -12,13 +12,13 @@ use test;
--disable_warnings
drop table if exists t1, t1_1, t1_2,
t_many_col_types, t_many_col_types_1, t_many_col_types_2;
t9, t9_1, t9_2;
--enable_warnings
let $type= 'MYISAM' ;
-- source include/ps_create.inc
rename table t1 to t1_1, t_many_col_types to t_many_col_types_1 ;
rename table t1 to t1_1, t9 to t9_1 ;
-- source include/ps_create.inc
rename table t1 to t1_2, t_many_col_types to t_many_col_types_2 ;
rename table t1 to t1_2, t9 to t9_2 ;
create table t1
(
......@@ -26,7 +26,7 @@ create table t1
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=FIRST;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -38,7 +38,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=FIRST;
-- source include/ps_renew.inc
......@@ -47,16 +47,17 @@ INSERT_METHOD=FIRST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
-- source include/ps_conv.inc
# Lets's try the same tests with INSERT_METHOD=LAST
drop table t1, t_many_col_types ;
drop table t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
) ENGINE = MERGE UNION=(t1_1,t1_2)
INSERT_METHOD=LAST;
create table t_many_col_types
create table t9
(
c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
......@@ -68,7 +69,7 @@ create table t_many_col_types
c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) ENGINE = MERGE UNION=(t_many_col_types_1,t_many_col_types_2)
) ENGINE = MERGE UNION=(t9_1,t9_2)
INSERT_METHOD=LAST;
-- source include/ps_renew.inc
......@@ -77,6 +78,7 @@ INSERT_METHOD=LAST;
# no test of ps_modify1, because insert .. select
# is not allowed on MERGE tables
# -- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t1_1, t1_2,
t_many_col_types_1, t_many_col_types_2, t_many_col_types;
t9_1, t9_2, t9;
......@@ -18,5 +18,6 @@ let $type= 'BDB' ;
-- source include/ps_query.inc
-- source include/ps_modify.inc
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t_many_col_types;
drop table t1, t9;
###############################################
# #
# Prepared Statements test on NDB tables #
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
-- source include/have_ndb.inc
let $type= 'NDB' ;
--disable_warnings
drop table if exists t1, t9 ;
--enable_warnings
eval create table t1
(
a int not null, b varchar(30),
primary key(a)
) engine = $type ;
--disable_warnings
drop table if exists t9;
--enable_warnings
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
eval create table t9
(
c1 tinyint not null, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
c25 char(100), c26 char(100), c27 char(100), c28 char(100),
c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = $type ;
-- source include/ps_renew.inc
-- source include/ps_query.inc
# The following line is deactivated, because the ndb storage engine is not able
# to do primary key column updates .
#-- source include/ps_modify.inc
# let's include all statements which will work
--disable_query_log
select '------ delete tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## delete without parameter
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
# delete with row not found
execute stmt1;
## delete with one parameter in the where clause
insert into t1 values(0,NULL);
set @arg00=NULL;
prepare stmt1 from 'delete from t1 where b=?' ;
execute stmt1 using @arg00;
select a,b from t1 where b is NULL ;
set @arg00='one';
execute stmt1 using @arg00;
select a,b from t1 where b=@arg00;
## truncate a table
--error 1295
prepare stmt1 from 'truncate table t1' ;
--disable_query_log
select '------ update tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## update without parameter
prepare stmt1 from 'update t1 set b=''a=two'' where a=2' ;
execute stmt1;
select a,b from t1 where a=2;
# dummy update
execute stmt1;
select a,b from t1 where a=2;
## update with one parameter in the set clause
set @arg00=NULL;
prepare stmt1 from 'update t1 set b=? where a=2' ;
execute stmt1 using @arg00;
select a,b from t1 where a=2;
set @arg00='two';
execute stmt1 using @arg00;
select a,b from t1 where a=2;
## update with one parameter in the where cause
set @arg00=2;
prepare stmt1 from 'update t1 set b=NULL where a=?' ;
execute stmt1 using @arg00;
select a,b from t1 where a=@arg00;
update t1 set b='two' where a=@arg00;
# row not found in update
set @arg00=2000;
execute stmt1 using @arg00;
select a,b from t1 where a=@arg00;
## update on primary key column (two parameters)
set @arg00=2;
set @arg01=22;
prepare stmt1 from 'update t1 set a=? where a=?' ;
# dummy update
execute stmt1 using @arg00, @arg00;
select a,b from t1 where a=@arg00;
# deactivated primary key column update
# execute stmt1 using @arg01, @arg00;
select a,b from t1 where a=@arg01;
execute stmt1 using @arg00, @arg01;
select a,b from t1 where a=@arg00;
set @arg00=NULL;
set @arg01=2;
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01;
select a,b from t1 order by a;
set @arg00=0;
execute stmt1 using @arg01, @arg00;
select a,b from t1 order by a;
## update with subquery and several parameters
set @arg00=23;
set @arg01='two';
set @arg02=2;
set @arg03='two';
set @arg04=2;
--disable_warnings
drop table if exists t2;
--enable_warnings
# t2 will be of table type 'MYISAM'
create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
--disable_info
select a,b from t1 order by a;
drop table t2 ;
# t2 is now of table type '$type'
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval create table t2
(
a int not null, b varchar(30),
primary key(a)
) engine = $type ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
--enable_info
# deactivated primary key column update
# execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
--disable_info
select a,b from t1 where a = @arg00 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
--enable_info
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
--disable_info
select a,b from t1 order by a;
drop table t2 ;
## update with parameters in limit
set @arg00=1;
prepare stmt1 from 'update t1 set b=''bla''
where a=2
limit 1';
execute stmt1 ;
select a,b from t1 where b = 'bla' ;
# currently (May 2004, Version 4.1) it is impossible
-- error 1064
prepare stmt1 from 'update t1 set b=''bla''
where a=2
limit ?';
--disable_query_log
select '------ insert tests ------' as test_sequence ;
--enable_query_log
--source include/ps_renew.inc
## insert without parameter
prepare stmt1 from 'insert into t1 values(5, ''five'' )';
execute stmt1;
select a,b from t1 where a = 5;
## insert with one parameter in values part
set @arg00='six' ;
prepare stmt1 from 'insert into t1 values(6, ? )';
execute stmt1 using @arg00;
select a,b from t1 where b = @arg00;
# the second insert fails, because the first column is primary key
--error 1062
execute stmt1 using @arg00;
set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )';
execute stmt1 using @arg00;
select a,b from t1 where b is NULL;
## insert with two parameter in values part
set @arg00=8 ;
set @arg01='eight' ;
prepare stmt1 from 'insert into t1 values(?, ? )';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where b = @arg01;
# cases derived from client_test.c: test_null()
set @NULL= null ;
set @arg00= 'abc' ;
# execute must fail, because first column is primary key (-> not null)
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @NULL ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
--error 1048
execute stmt1 using @NULL, @arg00 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg00 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 2;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @NULL ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
let $1 = 10;
while ($1)
{
eval set @arg01= 10000 + $1 ;
execute stmt1 using @arg01, @arg01 ;
dec $1;
}
select * from t1 where a > 10000 order by a ;
delete from t1 where a > 10000 ;
## insert with two rows in values part
set @arg00=81 ;
set @arg01='8-1' ;
set @arg02=82 ;
set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
select a,b from t1 where a in (@arg00,@arg02) ;
## insert with two parameter in the set part
set @arg00=9 ;
set @arg01='nine' ;
prepare stmt1 from 'insert into t1 set a=?, b=? ';
execute stmt1 using @arg00, @arg01 ;
select a,b from t1 where a = @arg00 ;
## insert with parameters in the ON DUPLICATE KEY part
set @arg00=6 ;
set @arg01=1 ;
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
# There is no primary key collision, so there will be no key column update
# If a key column update would be necessary occurs BUG#4312
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @arg00, @arg01;
select * from t1 order by a;
set @arg00=81 ;
set @arg01=1 ;
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @arg00, @arg01;
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '
# cases derived from client_test.c: test_bug3117()
--disable_warnings
drop table if exists t2 ;
--enable_warnings
# The test battery for table type 'MERGE' gets here only a 'MYISAM' table
eval create table t2 (id int auto_increment primary key)
ENGINE= $type ;
prepare stmt1 from ' select last_insert_id() ' ;
insert into t2 values (NULL) ;
execute stmt1 ;
insert into t2 values (NULL) ;
execute stmt1 ;
drop table t2 ;
## many parameters
set @1000=1000 ;
set @x1000_2="x1000_2" ;
set @x1000_3="x1000_3" ;
set @x1000="x1000" ;
set @1100=1100 ;
set @x1100="x1100" ;
set @100=100 ;
set @updated="updated" ;
insert into t1 values(1000,'x1000_1') ;
# deactivated, activate when BUG#4312: is solved
# insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
# on duplicate key update a = a + @100, b = concat(b,@updated) ;
select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
on duplicate key update a = a + ?, b = concat(b,?) ';
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
# deactivated, activate when BUG#4312: is solved
# execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
delete from t1 where a >= 1000 ;
## replace
--error 1295
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
## multi table statements
--disable_query_log
select '------ multi table tests ------' as test_sequence ;
--enable_query_log
# cases derived from client_test.c: test_multi
delete from t1 ;
delete from t9 ;
insert into t1(a,b) values (1, 'one'), (2, 'two'), (3, 'three') ;
insert into t9 (c1,c21)
values (1, 'one'), (2, 'two'), (3, 'three') ;
prepare stmt_delete from " delete t1, t9
from t1, t9 where t1.a=t9.c1 and t1.b='updated' ";
prepare stmt_update from " update t1, t9
set t1.b='updated', t9.c21='updated'
where t1.a=t9.c1 and t1.a=? ";
prepare stmt_select1 from " select a, b from t1 order by a" ;
prepare stmt_select2 from " select c1, c21 from t9 order by c1" ;
set @arg00= 1 ;
let $1= 3 ;
while ($1)
{
execute stmt_update using @arg00 ;
execute stmt_delete ;
execute stmt_select1 ;
execute stmt_select2 ;
set @arg00= @arg00 + 1 ;
dec $1 ;
}
-- source include/ps_modify1.inc
-- source include/ps_conv.inc
drop table t1, t9;
......@@ -330,7 +330,6 @@ err:
*/
int ha_archive::write_row(byte * buf)
{
char *pos;
z_off_t written;
DBUG_ENTER("ha_archive::write_row");
......@@ -415,6 +414,7 @@ int ha_archive::get_row(byte *buf)
int read; // Bytes read, gzread() returns int
char *last;
size_t total_blob_length= 0;
Field_blob **field;
DBUG_ENTER("ha_archive::get_row");
read= gzread(archive, buf, table->reclength);
......@@ -428,7 +428,7 @@ int ha_archive::get_row(byte *buf)
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
/* Calculate blob length, we use this for our buffer */
for (Field_blob **field=table->blob_field; *field ; field++)
for (field=table->blob_field; *field ; field++)
total_blob_length += (*field)->get_length();
/* Adjust our row buffer if we need be */
......@@ -436,7 +436,7 @@ int ha_archive::get_row(byte *buf)
last= (char *)buffer.ptr();
/* Loop through our blobs and read them */
for (Field_blob **field=table->blob_field; *field ; field++)
for (field=table->blob_field; *field ; field++)
{
size_t size= (*field)->get_length();
read= gzread(archive, last, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment