1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

A fix and a test case for Bug#12243 "MySQL Server crashes with 2

cursors (+ commit)" and Bug#11832 "Server crash with InnoDB + Cursors"
See comments to the changed files.
This commit is contained in:
konstantin@mysql.com
2005-08-10 18:36:13 +04:00
parent cacc1a9f0a
commit 8392a814af
5 changed files with 82 additions and 12 deletions

View File

@ -14179,6 +14179,66 @@ static void test_bug11901()
myquery(rc);
}
/* Bug#12243: multiple cursors, crash in a fetch after commit. */
static void test_bug12243()
{
MYSQL_STMT *stmt1, *stmt2;
int rc;
const char *stmt_text;
ulong type;
myheader("test_bug12243");
if (! have_innodb)
{
if (!opt_silent)
printf("This test requires InnoDB.\n");
return;
}
/* create tables */
mysql_query(mysql, "drop table if exists t1");
mysql_query(mysql, "create table t1 (a int) engine=InnoDB");
rc= mysql_query(mysql, "insert into t1 (a) values (1), (2)");
myquery(rc);
mysql_autocommit(mysql, FALSE);
/* create statement */
stmt1= mysql_stmt_init(mysql);
stmt2= mysql_stmt_init(mysql);
type= (ulong) CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt1, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
mysql_stmt_attr_set(stmt2, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
stmt_text= "select a from t1";
rc= mysql_stmt_prepare(stmt1, stmt_text, strlen(stmt_text));
check_execute(stmt1, rc);
rc= mysql_stmt_execute(stmt1);
check_execute(stmt1, rc);
rc= mysql_stmt_fetch(stmt1);
check_execute(stmt1, rc);
rc= mysql_stmt_prepare(stmt2, stmt_text, strlen(stmt_text));
check_execute(stmt2, rc);
rc= mysql_stmt_execute(stmt2);
check_execute(stmt2, rc);
rc= mysql_stmt_fetch(stmt2);
check_execute(stmt2, rc);
rc= mysql_stmt_close(stmt1);
check_execute(stmt1, rc);
rc= mysql_commit(mysql);
myquery(rc);
rc= mysql_stmt_fetch(stmt2);
check_execute(stmt2, rc);
mysql_stmt_close(stmt2);
rc= mysql_query(mysql, "drop table t1");
myquery(rc);
mysql_autocommit(mysql, TRUE); /* restore default */
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -14427,6 +14487,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug12001", test_bug12001 },
{ "test_bug11909", test_bug11909 },
{ "test_bug11901", test_bug11901 },
{ "test_bug12243", test_bug12243 },
{ 0, 0 }
};