diff options
author | unknown <konstantin@mysql.com> | 2005-02-10 16:58:02 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-02-10 16:58:02 +0300 |
commit | ee9644aa262abdffb89990e7fe422913d4bb85c7 (patch) | |
tree | e4cdc7197bc74eca4ad26370116105b9d7baa1f3 /tests | |
parent | 397f09b4682ec0da319c47db2a8888a7ab1da64e (diff) | |
parent | a3fcd3a075d525024cafa9d35edc56dea7d94d1a (diff) | |
download | mariadb-git-ee9644aa262abdffb89990e7fe422913d4bb85c7.tar.gz |
manual merge
libmysql/libmysql.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 36cff4d23aa..018bc554093 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -30,6 +30,7 @@ #include <my_global.h> #include <my_sys.h> #include <mysql.h> +#include <errmsg.h> #include <my_getopt.h> #include <m_string.h> @@ -12512,6 +12513,57 @@ static void test_bug6761(void) } +/* Bug#8330 - Bug #8330 mysql_stmt_execute crashes (libmysql) */ + +static void test_bug8330() +{ + const char *stmt_text; + MYSQL_STMT *stmt[2]; + int i, rc; + char *query= "select a,b from t1 where a=?"; + MYSQL_BIND bind[2]; + long lval[2]; + + myheader("test_bug8330"); + + stmt_text= "drop table if exists t1"; + /* in case some previos test failed */ + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + stmt_text= "create table t1 (a int, b int)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + bzero(bind, sizeof(bind)); + for (i=0; i < 2; i++) + { + stmt[i]= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt[i], query, strlen(query)); + check_execute(stmt[i], rc); + + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void*) &lval[i]; + bind[i].is_null= 0; + mysql_stmt_bind_param(stmt[i], &bind[i]); + } + + rc= mysql_stmt_execute(stmt[0]); + check_execute(stmt[0], rc); + + rc= mysql_stmt_execute(stmt[1]); + DIE_UNLESS(rc && mysql_stmt_errno(stmt[1]) == CR_COMMANDS_OUT_OF_SYNC); + rc= mysql_stmt_execute(stmt[0]); + check_execute(stmt[0], rc); + + mysql_stmt_close(stmt[0]); + mysql_stmt_close(stmt[1]); + + stmt_text= "drop table t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -12730,6 +12782,7 @@ static struct my_tests_st my_tests[]= { { "test_cursors_with_union", test_cursors_with_union }, { "test_truncation", test_truncation }, { "test_truncation_option", test_truncation_option }, + { "test_bug8330", test_bug8330 }, { 0, 0 } }; |