diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
commit | d4632dff5aea3eacfe3c6a126c6b8ca9c839b5ec (patch) | |
tree | 5a3482665c78a3698f529755e2407524f79327d9 /mysql-test/r/ps.result | |
parent | 2b91a639cc767928ca063a466b4058e22f8fb7ff (diff) | |
download | mariadb-git-d4632dff5aea3eacfe3c6a126c6b8ca9c839b5ec.tar.gz |
Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1,
2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29,
2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and
some other minor revisions.
This patch implements:
WL#4264 "Backup: Stabilize Service Interface" -- all the
server prerequisites except si_objects.{h,cc} themselves (they can
be just copied over, when needed).
WL#4435: Support OUT-parameters in prepared statements.
(and all issues in the initial patches for these two
tasks, that were discovered in pushbuild and during testing).
Bug#39519: mysql_stmt_close() should flush all data
associated with the statement.
After execution of a prepared statement, send OUT parameters of the invoked
stored procedure, if any, to the client.
When using the binary protocol, send the parameters in an additional result
set over the wire. When using the text protocol, assign out parameters to
the user variables from the CALL(@var1, @var2, ...) specification.
The following refactoring has been made:
- Protocol::send_fields() was renamed to Protocol::send_result_set_metadata();
- A new Protocol::send_result_set_row() was introduced to incapsulate
common functionality for sending row data.
- Signature of Protocol::prepare_for_send() was changed: this operation
does not need a list of items, the number of items is fully sufficient.
The following backward incompatible changes have been made:
- CLIENT_MULTI_RESULTS is now enabled by default in the client;
- CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client.
Diffstat (limited to 'mysql-test/r/ps.result')
-rw-r--r-- | mysql-test/r/ps.result | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 0e28d34441d..6c7e83134d7 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -2926,4 +2926,165 @@ execute stmt; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation drop table t1; deallocate prepare stmt; + End of 5.1 tests. + +# +# WL#4435: Support OUT-parameters in prepared statements. +# + +DROP PROCEDURE IF EXISTS p_string; +DROP PROCEDURE IF EXISTS p_double; +DROP PROCEDURE IF EXISTS p_int; +DROP PROCEDURE IF EXISTS p_decimal; + +CREATE PROCEDURE p_string( +IN v0 INT, +OUT v1 CHAR(32), +IN v2 CHAR(32), +INOUT v3 CHAR(32)) +BEGIN +SET v0 = -1; +SET v1 = 'test_v1'; +SET v2 = 'n/a'; +SET v3 = 'test_v3'; +END| + +CREATE PROCEDURE p_double( +IN v0 INT, +OUT v1 DOUBLE(4, 2), +IN v2 DOUBLE(4, 2), +INOUT v3 DOUBLE(4, 2)) +BEGIN +SET v0 = -1; +SET v1 = 12.34; +SET v2 = 98.67; +SET v3 = 56.78; +END| + +CREATE PROCEDURE p_int( +IN v0 CHAR(10), +OUT v1 INT, +IN v2 INT, +INOUT v3 INT) +BEGIN +SET v0 = 'n/a'; +SET v1 = 1234; +SET v2 = 9876; +SET v3 = 5678; +END| + +CREATE PROCEDURE p_decimal( +IN v0 INT, +OUT v1 DECIMAL(4, 2), +IN v2 DECIMAL(4, 2), +INOUT v3 DECIMAL(4, 2)) +BEGIN +SET v0 = -1; +SET v1 = 12.34; +SET v2 = 98.67; +SET v3 = 56.78; +END| + +PREPARE stmt_str FROM 'CALL p_string(?, ?, ?, ?)'; +PREPARE stmt_dbl FROM 'CALL p_double(?, ?, ?, ?)'; +PREPARE stmt_int FROM 'CALL p_int(?, ?, ?, ?)'; +PREPARE stmt_dec FROM 'CALL p_decimal(?, ?, ?, ?)'; + +SET @x_str_1 = NULL; +SET @x_str_2 = NULL; +SET @x_str_3 = NULL; +SET @x_dbl_1 = NULL; +SET @x_dbl_2 = NULL; +SET @x_dbl_3 = NULL; +SET @x_int_1 = NULL; +SET @x_int_2 = NULL; +SET @x_int_3 = NULL; +SET @x_dec_1 = NULL; +SET @x_dec_2 = NULL; +SET @x_dec_3 = NULL; + +-- Testing strings... + +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; +@x_int_1 @x_str_1 @x_str_2 @x_str_3 +NULL test_v1 NULL test_v3 + +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; +@x_int_1 @x_str_1 @x_str_2 @x_str_3 +NULL test_v1 NULL test_v3 + +-- Testing doubles... + +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +@x_int_1 @x_dbl_1 @x_dbl_2 @x_dbl_3 +NULL 12.34 NULL 56.78 + +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +@x_int_1 @x_dbl_1 @x_dbl_2 @x_dbl_3 +NULL 12.34 NULL 56.78 + +-- Testing ints... + +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; +@x_str_1 @x_int_1 @x_int_2 @x_int_3 +test_v1 1234 NULL 5678 + +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; +@x_str_1 @x_int_1 @x_int_2 @x_int_3 +test_v1 1234 NULL 5678 + +-- Testing decs... + +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +@x_int_1 @x_dec_1 @x_dec_2 @x_dec_3 +1234 12.34 NULL 56.78 + +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +@x_int_1 @x_dec_1 @x_dec_2 @x_dec_3 +1234 12.34 NULL 56.78 + +DEALLOCATE PREPARE stmt_str; +DEALLOCATE PREPARE stmt_dbl; +DEALLOCATE PREPARE stmt_int; +DEALLOCATE PREPARE stmt_dec; + +DROP PROCEDURE p_string; +DROP PROCEDURE p_double; +DROP PROCEDURE p_int; +DROP PROCEDURE p_decimal; + +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; + +CREATE PROCEDURE p1(OUT v1 CHAR(10)) +SET v1 = 'test1'; + +CREATE PROCEDURE p2(OUT v2 CHAR(10)) +BEGIN +SET @query = 'CALL p1(?)'; +PREPARE stmt1 FROM @query; +EXECUTE stmt1 USING @u1; +DEALLOCATE PREPARE stmt1; +SET v2 = @u1; +END| + +CALL p2(@a); +SELECT @a; +@a +test1 + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +# End of WL#4435. + +End of 6.0 tests. |