mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Fix for Bug#56934 (mysql_stmt_fetch() incorrectly fills MYSQL_TIME
structure buffer). This is a follow-up for WL#4435. The bug actually existed not only MYSQL_TYPE_DATETIME type. The problem was that Item_param::set_value() was written in an assumption that it's working with expressions, i.e. with basic data types. There are two different quick fixes here: a) Change Item_param::make_field() -- remove setting of Send_field::length, Send_field::charsetnr, Send_field::flags and Send_field::type. That would lead to marshalling all data using basic types to the client (MYSQL_TYPE_LONGLONG, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_STRING and MYSQL_TYPE_NEWDECIMAL). In particular, that means, DATETIME would be sent as MYSQL_TYPE_STRING, TINYINT -- as MYSQL_TYPE_LONGLONG, etc. That could be Ok for the client, because the client library does reverse conversion automatically (the client program would see DATETIME as MYSQL_TIME object). However, there is a problem with metadata -- the metadata would be wrong (misleading): it would say that DATETIME is marshaled as MYSQL_TYPE_DATETIME, not as MYSQL_TYPE_STRING. b) Set Item_param::param_type properly to actual underlying field type. That would lead to double conversion inside the server: for example, MYSQL_TIME-object would be converted into STRING-object (in Item_param::set_value()), and then converted back to MYSQL_TIME-object (in Item_param::send()). The data however would be marshalled more properly, and also metadata would be correct. This patch implements b). There is also a possibility to avoid double conversion either by clonning the data field, or by storing a reference to it and using it on Item::send() time. That requires more work and might be done later.
This commit is contained in:
parent
6c6ad182a6
commit
5af51e4a3c
7 changed files with 1352 additions and 8 deletions
|
@ -3202,6 +3202,510 @@ test1
|
|||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
TINYINT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYINT)
|
||||
SET v = 127;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 127;
|
||||
@a @a = 127
|
||||
127 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
SMALLINT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v SMALLINT)
|
||||
SET v = 32767;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 32767;
|
||||
@a @a = 32767
|
||||
32767 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
MEDIUMINT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMINT)
|
||||
SET v = 8388607;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 8388607;
|
||||
@a @a = 8388607
|
||||
8388607 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
INT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v INT)
|
||||
SET v = 2147483647;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 2147483647;
|
||||
@a @a = 2147483647
|
||||
2147483647 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
BIGINT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BIGINT)
|
||||
SET v = 9223372036854775807;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 9223372036854775807;
|
||||
@a @a = 9223372036854775807
|
||||
9223372036854775807 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
BIT(11)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BIT(11))
|
||||
SET v = b'10100100101';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = b'10100100101';
|
||||
@a @a = b'10100100101'
|
||||
1317 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
TIMESTAMP
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TIMESTAMP)
|
||||
SET v = '2007-11-18 15:01:02';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = '2007-11-18 15:01:02';
|
||||
@a @a = '2007-11-18 15:01:02'
|
||||
2007-11-18 15:01:02 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
DATETIME
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DATETIME)
|
||||
SET v = '1234-11-12 12:34:59';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = '1234-11-12 12:34:59';
|
||||
@a @a = '1234-11-12 12:34:59'
|
||||
1234-11-12 12:34:59 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
TIME
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TIME)
|
||||
SET v = '123:45:01';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = '123:45:01';
|
||||
@a @a = '123:45:01'
|
||||
123:45:01 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
DATE
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DATE)
|
||||
SET v = '1234-11-12';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = '1234-11-12';
|
||||
@a @a = '1234-11-12'
|
||||
1234-11-12 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
YEAR
|
||||
|
||||
CREATE PROCEDURE p1(OUT v YEAR)
|
||||
SET v = 2010;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 2010;
|
||||
@a @a = 2010
|
||||
2010 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
FLOAT(7, 4)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
|
||||
SET v = 123.4567;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` double DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a - 123.4567 < 0.00001;
|
||||
@a @a - 123.4567 < 0.00001
|
||||
123.45670318603516 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
DOUBLE(8, 5)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
|
||||
SET v = 123.45678;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` double DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a - 123.45678 < 0.000001;
|
||||
@a @a - 123.45678 < 0.000001
|
||||
123.45678 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
DECIMAL(9, 6)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
|
||||
SET v = 123.456789;
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` decimal(65,30) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 123.456789;
|
||||
@a @a = 123.456789
|
||||
123.456789 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
CHAR(32)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v CHAR(32))
|
||||
SET v = REPEAT('a', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('a', 16);
|
||||
@a @a = REPEAT('a', 16)
|
||||
aaaaaaaaaaaaaaaa 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
VARCHAR(32)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v VARCHAR(32))
|
||||
SET v = REPEAT('b', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('b', 16);
|
||||
@a @a = REPEAT('b', 16)
|
||||
bbbbbbbbbbbbbbbb 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
TINYTEXT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYTEXT)
|
||||
SET v = REPEAT('c', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('c', 16);
|
||||
@a @a = REPEAT('c', 16)
|
||||
cccccccccccccccc 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
TEXT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TEXT)
|
||||
SET v = REPEAT('d', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('d', 16);
|
||||
@a @a = REPEAT('d', 16)
|
||||
dddddddddddddddd 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
MEDIUMTEXT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
|
||||
SET v = REPEAT('e', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('e', 16);
|
||||
@a @a = REPEAT('e', 16)
|
||||
eeeeeeeeeeeeeeee 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
LONGTEXT
|
||||
|
||||
CREATE PROCEDURE p1(OUT v LONGTEXT)
|
||||
SET v = REPEAT('f', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('f', 16);
|
||||
@a @a = REPEAT('f', 16)
|
||||
ffffffffffffffff 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
BINARY(32)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BINARY(32))
|
||||
SET v = REPEAT('g', 32);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('g', 32);
|
||||
@a @a = REPEAT('g', 32)
|
||||
gggggggggggggggggggggggggggggggg 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
VARBINARY(32)
|
||||
|
||||
CREATE PROCEDURE p1(OUT v VARBINARY(32))
|
||||
SET v = REPEAT('h', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('h', 16);
|
||||
@a @a = REPEAT('h', 16)
|
||||
hhhhhhhhhhhhhhhh 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
TINYBLOB
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYBLOB)
|
||||
SET v = REPEAT('i', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('i', 16);
|
||||
@a @a = REPEAT('i', 16)
|
||||
iiiiiiiiiiiiiiii 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
BLOB
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BLOB)
|
||||
SET v = REPEAT('j', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('j', 16);
|
||||
@a @a = REPEAT('j', 16)
|
||||
jjjjjjjjjjjjjjjj 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
MEDIUMBLOB
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
|
||||
SET v = REPEAT('k', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('k', 16);
|
||||
@a @a = REPEAT('k', 16)
|
||||
kkkkkkkkkkkkkkkk 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
LONGBLOB
|
||||
|
||||
CREATE PROCEDURE p1(OUT v LONGBLOB)
|
||||
SET v = REPEAT('l', 16);
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = REPEAT('l', 16);
|
||||
@a @a = REPEAT('l', 16)
|
||||
llllllllllllllll 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
SET('aaa', 'bbb')
|
||||
|
||||
CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
|
||||
SET v = 'aaa';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 'aaa';
|
||||
@a @a = 'aaa'
|
||||
aaa 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
ENUM('aaa', 'bbb')
|
||||
|
||||
CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
|
||||
SET v = 'aaa';
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
SHOW CREATE TABLE tmp1;
|
||||
Table Create Table
|
||||
tmp1 CREATE TEMPORARY TABLE `tmp1` (
|
||||
`c1` longblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT @a, @a = 'aaa';
|
||||
@a @a = 'aaa'
|
||||
aaa 1
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
# End of WL#4435.
|
||||
#
|
||||
# WL#4284: Transactional DDL locking
|
||||
|
|
|
@ -3296,6 +3296,12 @@ SELECT @a;
|
|||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--source t/wl4435_generated.inc
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # End of WL#4435.
|
||||
|
||||
|
|
588
mysql-test/t/wl4435_generated.inc
Normal file
588
mysql-test/t/wl4435_generated.inc
Normal file
|
@ -0,0 +1,588 @@
|
|||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TINYINT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYINT)
|
||||
SET v = 127;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 127;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo SMALLINT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v SMALLINT)
|
||||
SET v = 32767;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 32767;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo MEDIUMINT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMINT)
|
||||
SET v = 8388607;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 8388607;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo INT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v INT)
|
||||
SET v = 2147483647;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 2147483647;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo BIGINT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BIGINT)
|
||||
SET v = 9223372036854775807;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 9223372036854775807;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo BIT(11)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BIT(11))
|
||||
SET v = b'10100100101';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = b'10100100101';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TIMESTAMP
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TIMESTAMP)
|
||||
SET v = '2007-11-18 15:01:02';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = '2007-11-18 15:01:02';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo DATETIME
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DATETIME)
|
||||
SET v = '1234-11-12 12:34:59';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = '1234-11-12 12:34:59';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TIME
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TIME)
|
||||
SET v = '123:45:01';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = '123:45:01';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo DATE
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DATE)
|
||||
SET v = '1234-11-12';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = '1234-11-12';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo YEAR
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v YEAR)
|
||||
SET v = 2010;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 2010;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo FLOAT(7, 4)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
|
||||
SET v = 123.4567;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a - 123.4567 < 0.00001;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo DOUBLE(8, 5)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
|
||||
SET v = 123.45678;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a - 123.45678 < 0.000001;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo DECIMAL(9, 6)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
|
||||
SET v = 123.456789;
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 123.456789;
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo CHAR(32)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v CHAR(32))
|
||||
SET v = REPEAT('a', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('a', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo VARCHAR(32)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v VARCHAR(32))
|
||||
SET v = REPEAT('b', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('b', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TINYTEXT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYTEXT)
|
||||
SET v = REPEAT('c', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('c', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TEXT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TEXT)
|
||||
SET v = REPEAT('d', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('d', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo MEDIUMTEXT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
|
||||
SET v = REPEAT('e', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('e', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo LONGTEXT
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v LONGTEXT)
|
||||
SET v = REPEAT('f', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('f', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo BINARY(32)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BINARY(32))
|
||||
SET v = REPEAT('g', 32);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('g', 32);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo VARBINARY(32)
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v VARBINARY(32))
|
||||
SET v = REPEAT('h', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('h', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo TINYBLOB
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v TINYBLOB)
|
||||
SET v = REPEAT('i', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('i', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo BLOB
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v BLOB)
|
||||
SET v = REPEAT('j', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('j', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo MEDIUMBLOB
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
|
||||
SET v = REPEAT('k', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('k', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo LONGBLOB
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v LONGBLOB)
|
||||
SET v = REPEAT('l', 16);
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = REPEAT('l', 16);
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo SET('aaa', 'bbb')
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
|
||||
SET v = 'aaa';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 'aaa';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo ENUM('aaa', 'bbb')
|
||||
--echo
|
||||
|
||||
CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
|
||||
SET v = 'aaa';
|
||||
|
||||
PREPARE stmt1 FROM 'CALL p1(?)';
|
||||
EXECUTE stmt1 USING @a;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
|
||||
|
||||
SHOW CREATE TABLE tmp1;
|
||||
|
||||
SELECT @a, @a = 'aaa';
|
||||
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
DROP PROCEDURE p1;
|
|
@ -226,8 +226,6 @@ bool Item::val_bool()
|
|||
*/
|
||||
String *Item::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
||||
if (!(collation.collation->state & MY_CS_NONASCII))
|
||||
return val_str(str);
|
||||
|
||||
|
@ -3459,19 +3457,16 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
|
|||
str_value.charset());
|
||||
collation.set(str_value.charset(), DERIVATION_COERCIBLE);
|
||||
decimals= 0;
|
||||
param_type= MYSQL_TYPE_STRING;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case REAL_RESULT:
|
||||
set_double(arg->val_real());
|
||||
param_type= MYSQL_TYPE_DOUBLE;
|
||||
break;
|
||||
|
||||
case INT_RESULT:
|
||||
set_int(arg->val_int(), arg->max_length);
|
||||
param_type= MYSQL_TYPE_LONG;
|
||||
break;
|
||||
|
||||
case DECIMAL_RESULT:
|
||||
|
@ -3483,8 +3478,6 @@ Item_param::set_value(THD *thd, sp_rcontext *ctx, Item **it)
|
|||
return TRUE;
|
||||
|
||||
set_decimal(dv);
|
||||
param_type= MYSQL_TYPE_NEWDECIMAL;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3516,6 +3509,7 @@ void
|
|||
Item_param::set_out_param_info(Send_field *info)
|
||||
{
|
||||
m_out_param_info= info;
|
||||
param_type= m_out_param_info->type;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3561,6 +3555,7 @@ void Item_param::make_field(Send_field *field)
|
|||
field->org_table_name= m_out_param_info->org_table_name;
|
||||
field->col_name= m_out_param_info->col_name;
|
||||
field->org_col_name= m_out_param_info->org_col_name;
|
||||
|
||||
field->length= m_out_param_info->length;
|
||||
field->charsetnr= m_out_param_info->charsetnr;
|
||||
field->flags= m_out_param_info->flags;
|
||||
|
|
|
@ -220,6 +220,7 @@ private:
|
|||
during execution.
|
||||
*/
|
||||
bool m_return_value_set;
|
||||
|
||||
/**
|
||||
TRUE if the context is created for a sub-statement.
|
||||
*/
|
||||
|
|
|
@ -1185,7 +1185,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
|
|||
uint32 length= 0;
|
||||
THD *thd= stmt->thd;
|
||||
|
||||
DBUG_ENTER("insert_params_from_vars");
|
||||
DBUG_ENTER("insert_params_from_vars_with_log");
|
||||
|
||||
if (query->copy(stmt->query(), stmt->query_length(), default_charset_info))
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -2103,6 +2103,255 @@ static void test_wl4435_2()
|
|||
}
|
||||
|
||||
|
||||
#define WL4435_TEST(sql_type, sql_value, \
|
||||
c_api_in_type, c_api_out_type, \
|
||||
c_type, c_type_ext, \
|
||||
printf_args, assert_condition) \
|
||||
\
|
||||
do { \
|
||||
int rc; \
|
||||
MYSQL_STMT *ps; \
|
||||
MYSQL_BIND psp; \
|
||||
MYSQL_RES *rs_metadata; \
|
||||
MYSQL_FIELD *fields; \
|
||||
c_type pspv c_type_ext; \
|
||||
my_bool psp_null; \
|
||||
\
|
||||
bzero(&pspv, sizeof (pspv)); \
|
||||
\
|
||||
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1"); \
|
||||
myquery(rc); \
|
||||
\
|
||||
rc= mysql_query(mysql, \
|
||||
"CREATE PROCEDURE p1(OUT v " sql_type ") SET v = " sql_value ";"); \
|
||||
myquery(rc); \
|
||||
\
|
||||
ps = mysql_simple_prepare(mysql, "CALL p1(?)"); \
|
||||
check_stmt(ps); \
|
||||
\
|
||||
bzero(&psp, sizeof (psp)); \
|
||||
psp.buffer_type= c_api_in_type; \
|
||||
psp.is_null= &psp_null; \
|
||||
psp.buffer= (char *) &pspv; \
|
||||
psp.buffer_length= sizeof (psp); \
|
||||
\
|
||||
rc= mysql_stmt_bind_param(ps, &psp); \
|
||||
check_execute(ps, rc); \
|
||||
\
|
||||
rc= mysql_stmt_execute(ps); \
|
||||
check_execute(ps, rc); \
|
||||
\
|
||||
DIE_UNLESS(mysql->server_status & SERVER_PS_OUT_PARAMS); \
|
||||
DIE_UNLESS(mysql_stmt_field_count(ps) == 1); \
|
||||
\
|
||||
rs_metadata= mysql_stmt_result_metadata(ps); \
|
||||
fields= mysql_fetch_fields(rs_metadata); \
|
||||
\
|
||||
rc= mysql_stmt_bind_result(ps, &psp); \
|
||||
check_execute(ps, rc); \
|
||||
\
|
||||
rc= mysql_stmt_fetch(ps); \
|
||||
DIE_UNLESS(rc == 0); \
|
||||
\
|
||||
DIE_UNLESS(fields[0].type == c_api_out_type); \
|
||||
printf printf_args; \
|
||||
printf("; in type: %d; out type: %d\n", \
|
||||
(int) c_api_in_type, (int) c_api_out_type); \
|
||||
\
|
||||
rc= mysql_stmt_fetch(ps); \
|
||||
DIE_UNLESS(rc == MYSQL_NO_DATA); \
|
||||
\
|
||||
rc= mysql_stmt_next_result(ps); \
|
||||
DIE_UNLESS(rc == 0); \
|
||||
\
|
||||
mysql_stmt_free_result(ps); \
|
||||
mysql_stmt_close(ps); \
|
||||
\
|
||||
DIE_UNLESS(assert_condition); \
|
||||
\
|
||||
} while (0)
|
||||
|
||||
static void test_wl4435_3()
|
||||
{
|
||||
char tmp[255];
|
||||
|
||||
puts("");
|
||||
|
||||
// The following types are not supported:
|
||||
// - ENUM
|
||||
// - SET
|
||||
//
|
||||
// The following types are supported but can not be used for
|
||||
// OUT-parameters:
|
||||
// - MEDIUMINT;
|
||||
// - BIT(..);
|
||||
//
|
||||
// The problem is that those types are not supported for IN-parameters,
|
||||
// and OUT-parameters should be bound as IN-parameters before execution.
|
||||
//
|
||||
// The following types should not be used:
|
||||
// - MYSQL_TYPE_YEAR (use MYSQL_TYPE_SHORT instead);
|
||||
// - MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB
|
||||
// (use MYSQL_TYPE_BLOB instead);
|
||||
|
||||
WL4435_TEST("TINYINT", "127",
|
||||
MYSQL_TYPE_TINY, MYSQL_TYPE_TINY,
|
||||
char, ,
|
||||
(" - TINYINT / char / MYSQL_TYPE_TINY:\t\t\t %d", (int) pspv),
|
||||
pspv == 127);
|
||||
|
||||
WL4435_TEST("SMALLINT", "32767",
|
||||
MYSQL_TYPE_SHORT, MYSQL_TYPE_SHORT,
|
||||
short, ,
|
||||
(" - SMALLINT / short / MYSQL_TYPE_SHORT:\t\t %d", (int) pspv),
|
||||
pspv == 32767);
|
||||
|
||||
WL4435_TEST("INT", "2147483647",
|
||||
MYSQL_TYPE_LONG, MYSQL_TYPE_LONG,
|
||||
int, ,
|
||||
(" - INT / int / MYSQL_TYPE_LONG:\t\t\t %d", pspv),
|
||||
pspv == 2147483647l);
|
||||
|
||||
WL4435_TEST("BIGINT", "9223372036854775807",
|
||||
MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG,
|
||||
long long, ,
|
||||
(" - BIGINT / long long / MYSQL_TYPE_LONGLONG:\t\t %lld", pspv),
|
||||
pspv == 9223372036854775807ll);
|
||||
|
||||
WL4435_TEST("TIMESTAMP", "'2007-11-18 15:01:02'",
|
||||
MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_TIMESTAMP,
|
||||
MYSQL_TIME, ,
|
||||
(" - TIMESTAMP / MYSQL_TIME / MYSQL_TYPE_TIMESTAMP:\t "
|
||||
"%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
|
||||
(int) pspv.year, (int) pspv.month, (int) pspv.day,
|
||||
(int) pspv.hour, (int) pspv.minute, (int) pspv.second),
|
||||
pspv.year == 2007 && pspv.month == 11 && pspv.day == 18 &&
|
||||
pspv.hour == 15 && pspv.minute == 1 && pspv.second == 2);
|
||||
|
||||
WL4435_TEST("DATETIME", "'1234-11-12 12:34:59'",
|
||||
MYSQL_TYPE_DATETIME, MYSQL_TYPE_DATETIME,
|
||||
MYSQL_TIME, ,
|
||||
(" - DATETIME / MYSQL_TIME / MYSQL_TYPE_DATETIME:\t "
|
||||
"%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
|
||||
(int) pspv.year, (int) pspv.month, (int) pspv.day,
|
||||
(int) pspv.hour, (int) pspv.minute, (int) pspv.second),
|
||||
pspv.year == 1234 && pspv.month == 11 && pspv.day == 12 &&
|
||||
pspv.hour == 12 && pspv.minute == 34 && pspv.second == 59);
|
||||
|
||||
WL4435_TEST("TIME", "'123:45:01'",
|
||||
MYSQL_TYPE_TIME, MYSQL_TYPE_TIME,
|
||||
MYSQL_TIME, ,
|
||||
(" - TIME / MYSQL_TIME / MYSQL_TYPE_TIME:\t\t "
|
||||
"%.3d:%.2d:%.2d",
|
||||
(int) pspv.hour, (int) pspv.minute, (int) pspv.second),
|
||||
pspv.hour == 123 && pspv.minute == 45 && pspv.second == 1);
|
||||
|
||||
WL4435_TEST("DATE", "'1234-11-12'",
|
||||
MYSQL_TYPE_DATE, MYSQL_TYPE_DATE,
|
||||
MYSQL_TIME, ,
|
||||
(" - DATE / MYSQL_TIME / MYSQL_TYPE_DATE:\t\t "
|
||||
"%.4d-%.2d-%.2d",
|
||||
(int) pspv.year, (int) pspv.month, (int) pspv.day),
|
||||
pspv.year == 1234 && pspv.month == 11 && pspv.day == 12);
|
||||
|
||||
WL4435_TEST("YEAR", "'2010'",
|
||||
MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR,
|
||||
short, ,
|
||||
(" - YEAR / short / MYSQL_TYPE_SHORT:\t\t\t %.4d", (int) pspv),
|
||||
pspv == 2010);
|
||||
|
||||
WL4435_TEST("FLOAT(7, 4)", "123.4567",
|
||||
MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT,
|
||||
float, ,
|
||||
(" - FLOAT / float / MYSQL_TYPE_FLOAT:\t\t\t %g", (double) pspv),
|
||||
pspv - 123.4567 < 0.0001);
|
||||
|
||||
WL4435_TEST("DOUBLE(8, 5)", "123.45678",
|
||||
MYSQL_TYPE_DOUBLE, MYSQL_TYPE_DOUBLE,
|
||||
double, ,
|
||||
(" - DOUBLE / double / MYSQL_TYPE_DOUBLE:\t\t %g", (double) pspv),
|
||||
pspv - 123.45678 < 0.00001);
|
||||
|
||||
WL4435_TEST("DECIMAL(9, 6)", "123.456789",
|
||||
MYSQL_TYPE_NEWDECIMAL, MYSQL_TYPE_NEWDECIMAL,
|
||||
char, [255],
|
||||
(" - DECIMAL / char[] / MYSQL_TYPE_NEWDECIMAL:\t\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "123.456789"));
|
||||
|
||||
WL4435_TEST("CHAR(32)", "REPEAT('C', 16)",
|
||||
MYSQL_TYPE_STRING, MYSQL_TYPE_STRING,
|
||||
char, [255],
|
||||
(" - CHAR(32) / char[] / MYSQL_TYPE_STRING:\t\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "CCCCCCCCCCCCCCCC"));
|
||||
|
||||
WL4435_TEST("VARCHAR(32)", "REPEAT('V', 16)",
|
||||
MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VAR_STRING,
|
||||
char, [255],
|
||||
(" - VARCHAR(32) / char[] / MYSQL_TYPE_VAR_STRING:\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "VVVVVVVVVVVVVVVV"));
|
||||
|
||||
WL4435_TEST("TINYTEXT", "REPEAT('t', 16)",
|
||||
MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - TINYTEXT / char[] / MYSQL_TYPE_TINY_BLOB:\t\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "tttttttttttttttt"));
|
||||
|
||||
WL4435_TEST("TEXT", "REPEAT('t', 16)",
|
||||
MYSQL_TYPE_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - TEXT / char[] / MYSQL_TYPE_BLOB:\t\t\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "tttttttttttttttt"));
|
||||
|
||||
WL4435_TEST("MEDIUMTEXT", "REPEAT('t', 16)",
|
||||
MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - MEDIUMTEXT / char[] / MYSQL_TYPE_MEDIUM_BLOB:\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "tttttttttttttttt"));
|
||||
|
||||
WL4435_TEST("LONGTEXT", "REPEAT('t', 16)",
|
||||
MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - LONGTEXT / char[] / MYSQL_TYPE_LONG_BLOB:\t\t '%s'", (char *) pspv),
|
||||
!strcmp(pspv, "tttttttttttttttt"));
|
||||
|
||||
WL4435_TEST("BINARY(32)", "REPEAT('\1', 16)",
|
||||
MYSQL_TYPE_STRING, MYSQL_TYPE_STRING,
|
||||
char, [255],
|
||||
(" - BINARY(32) / char[] / MYSQL_TYPE_STRING:\t\t '%s'", (char *) pspv),
|
||||
memset(tmp, 1, 16) && !memcmp(tmp, pspv, 16));
|
||||
|
||||
WL4435_TEST("VARBINARY(32)", "REPEAT('\1', 16)",
|
||||
MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_VAR_STRING,
|
||||
char, [255],
|
||||
(" - VARBINARY(32) / char[] / MYSQL_TYPE_VAR_STRING:\t '%s'", (char *) pspv),
|
||||
memset(tmp, 1, 16) && !memcmp(tmp, pspv, 16));
|
||||
|
||||
WL4435_TEST("TINYBLOB", "REPEAT('\2', 16)",
|
||||
MYSQL_TYPE_TINY_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - TINYBLOB / char[] / MYSQL_TYPE_TINY_BLOB:\t\t '%s'", (char *) pspv),
|
||||
memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
|
||||
|
||||
WL4435_TEST("BLOB", "REPEAT('\2', 16)",
|
||||
MYSQL_TYPE_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - BLOB / char[] / MYSQL_TYPE_BLOB:\t\t\t '%s'", (char *) pspv),
|
||||
memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
|
||||
|
||||
WL4435_TEST("MEDIUMBLOB", "REPEAT('\2', 16)",
|
||||
MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - MEDIUMBLOB / char[] / MYSQL_TYPE_MEDIUM_BLOB:\t '%s'", (char *) pspv),
|
||||
memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
|
||||
|
||||
WL4435_TEST("LONGBLOB", "REPEAT('\2', 16)",
|
||||
MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB,
|
||||
char, [255],
|
||||
(" - LONGBLOB / char[] / MYSQL_TYPE_LONG_BLOB:\t\t '%s'", (char *) pspv),
|
||||
memset(tmp, 2, 16) && !memcmp(tmp, pspv, 16));
|
||||
}
|
||||
|
||||
|
||||
/* Test simple prepare field results */
|
||||
|
||||
static void test_prepare_field_result()
|
||||
|
@ -19468,6 +19717,7 @@ static struct my_tests_st my_tests[]= {
|
|||
{ "test_wl4284_1", test_wl4284_1 },
|
||||
{ "test_wl4435", test_wl4435 },
|
||||
{ "test_wl4435_2", test_wl4435_2 },
|
||||
{ "test_wl4435_3", test_wl4435_3 },
|
||||
{ "test_bug38486", test_bug38486 },
|
||||
{ "test_bug33831", test_bug33831 },
|
||||
{ "test_bug40365", test_bug40365 },
|
||||
|
|
Loading…
Reference in a new issue