Commit ea040540 authored by unknown's avatar unknown

Fixed bug #29985.

Multiple-result processing is required during the execution
of CALL statements for stored procedures, however the mysqlslap
client lacked that processing.



client/mysqlslap.c:
  Fixed bug #29985.
  1. Connection flags have been changed: the CLIENT_MULTI_STATEMENTS
  flag has been added.
  2. The run_task function has been modified to process multiple
  result sets.
mysql-test/t/mysqlslap.test:
  Added test case for bug #29985.
mysql-test/r/mysqlslap.result:
  Added test case for bug #29985.
parent 9a20ca13
...@@ -140,7 +140,8 @@ static my_bool opt_compress= FALSE, tty_password= FALSE, ...@@ -140,7 +140,8 @@ static my_bool opt_compress= FALSE, tty_password= FALSE,
auto_generate_sql= FALSE; auto_generate_sql= FALSE;
const char *auto_generate_sql_type= "mixed"; const char *auto_generate_sql_type= "mixed";
static unsigned long connect_flags= CLIENT_MULTI_RESULTS; static unsigned long connect_flags= CLIENT_MULTI_RESULTS |
CLIENT_MULTI_STATEMENTS;
static int verbose, delimiter_length; static int verbose, delimiter_length;
static uint commit_rate; static uint commit_rate;
...@@ -1877,13 +1878,16 @@ limit_not_met: ...@@ -1877,13 +1878,16 @@ limit_not_met:
} }
} }
if (mysql_field_count(mysql)) do
{ {
result= mysql_store_result(mysql); if (mysql_field_count(mysql))
while ((row = mysql_fetch_row(result))) {
counter++; result= mysql_store_result(mysql);
mysql_free_result(result); while ((row = mysql_fetch_row(result)))
} counter++;
mysql_free_result(result);
}
} while(mysql_next_result(mysql) == 0);
queries++; queries++;
if (commit_rate && commit_rate <= trans_counter) if (commit_rate && commit_rate <= trans_counter)
......
...@@ -211,3 +211,8 @@ COMMIT; ...@@ -211,3 +211,8 @@ COMMIT;
COMMIT; COMMIT;
SHOW TABLES; SHOW TABLES;
DROP SCHEMA IF EXISTS `mysqlslap`; DROP SCHEMA IF EXISTS `mysqlslap`;
#
# Bug #29985: mysqlslap -- improper handling of resultsets in SPROCs
#
DROP PROCEDURE IF EXISTS p1;
CREATE PROCEDURE p1() SELECT 1;
...@@ -40,3 +40,14 @@ ...@@ -40,3 +40,14 @@
--exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1; --exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1;
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2 --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2
--echo #
--echo # Bug #29985: mysqlslap -- improper handling of resultsets in SPROCs
--echo #
--disable_warnings
DROP PROCEDURE IF EXISTS p1;
--enable_warnings
CREATE PROCEDURE p1() SELECT 1;
--exec $MYSQL_SLAP --create-schema=test --delimiter=";" --query="CALL p1; SELECT 1;" --silent 2>&1
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