diff options
author | unknown <sergefp@mysql.com> | 2004-12-14 10:57:30 +0300 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-12-14 10:57:30 +0300 |
commit | 379fe351ee5583b88d7682e97f1aa60a6bbb7642 (patch) | |
tree | 5817e448f4797ebb38076a00e55d92abec193e4e /tests | |
parent | e19a3042efa64cc0ca5142ceeacd40729740eb39 (diff) | |
download | mariadb-git-379fe351ee5583b88d7682e97f1aa60a6bbb7642.tar.gz |
Test for BUG#7242: Testing prepare + several times execute
(here in client_test.c because we need to check if several PS execution works and the bug shows up with binary protocol only )
tests/client_test.c:
Test for BUG#7242: Testing prepare + several times execute
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 75ce242900a..b0bf40799da 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -1026,6 +1026,56 @@ static void test_tran_innodb() } +/* Test for BUG#7242 */ + +static void test_prepare_insert_update() +{ + MYSQL_STMT *stmt; + int rc; + int i; + const char *testcase[]= { + "CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B))", + "INSERT t1 VALUES (1,2,10), (3,4,20)", + "INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100", + "SELECT * FROM t1", + "INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0", + "SELECT * FROM t1", + "INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a)", + NULL}; + const char **cur_query; + + myheader("test_prepare_insert_update"); + + for (cur_query= testcase; *cur_query; cur_query++) + { + printf("\nRunning query: %s", *cur_query); + strmov(query, *cur_query); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + verify_param_count(stmt, 0); + rc= mysql_stmt_execute(stmt); + + check_execute(stmt, rc); + /* try the last query several times */ + if (!cur_query[1]) + { + for (i=0; i < 3;i++) + { + printf("\nExecuting last statement again"); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + } + } + mysql_stmt_close(stmt); + } + + rc= mysql_commit(mysql); + myquery(rc); +} + /* Test simple prepares of all DML statements */ static void test_prepare_simple() @@ -11513,6 +11563,7 @@ and you are welcome to modify and redistribute it under the GPL license\n"); static struct my_tests_st my_tests[]= { { "client_query", client_query }, + { "test_prepare_insert_update", test_prepare_insert_update}, #if NOT_YET_WORKING { "test_drop_temp", test_drop_temp }, #endif |