mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
tests/mysql_client_test.c
Add a test case for Bug#11656 "Server crash with mysql_stmt_fetch (cursors)", the bug itself is no longer present. tests/mysql_client_test.c: Add a test case for Bug#11656 "Server crash with mysql_stmt_fetch (cursors)", the bug itself is no longer present.
This commit is contained in:
@ -13545,6 +13545,61 @@ static void test_bug11172()
|
||||
myquery(rc);
|
||||
}
|
||||
|
||||
|
||||
/* Bug#11656: cursors, crash on a fetch from a query with distinct. */
|
||||
|
||||
static void test_bug11656()
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND bind[2];
|
||||
int rc;
|
||||
const char *stmt_text;
|
||||
char buf[2][20];
|
||||
int i= 0;
|
||||
ulong type;
|
||||
|
||||
myheader("test_bug11656");
|
||||
|
||||
mysql_query(mysql, "drop table if exists t1");
|
||||
|
||||
rc= mysql_query(mysql, "create table t1 ("
|
||||
"server varchar(40) not null, "
|
||||
"test_kind varchar(1) not null, "
|
||||
"test_id varchar(30) not null , "
|
||||
"primary key (server,test_kind,test_id))");
|
||||
myquery(rc);
|
||||
|
||||
stmt_text= "select distinct test_kind, test_id from t1 "
|
||||
"where server in (?, ?)";
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
|
||||
check_execute(stmt, rc);
|
||||
type= (ulong) CURSOR_TYPE_READ_ONLY;
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
|
||||
|
||||
bzero(bind, sizeof(bind));
|
||||
strcpy(buf[0], "pcint502_MY2");
|
||||
strcpy(buf[1], "*");
|
||||
for (i=0; i < 2; i++)
|
||||
{
|
||||
bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[i].buffer= (gptr *)&buf[i];
|
||||
bind[i].buffer_length= strlen(buf[i]);
|
||||
}
|
||||
mysql_stmt_bind_param(stmt, bind);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_execute(stmt, rc);
|
||||
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
DIE_UNLESS(rc == MYSQL_NO_DATA);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
rc= mysql_query(mysql, "drop table t1");
|
||||
myquery(rc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read and parse arguments and MySQL options from my.cnf
|
||||
*/
|
||||
@ -13783,6 +13838,7 @@ static struct my_tests_st my_tests[]= {
|
||||
{ "test_bug10736", test_bug10736 },
|
||||
{ "test_bug10794", test_bug10794 },
|
||||
{ "test_bug11172", test_bug11172 },
|
||||
{ "test_bug11656", test_bug11656 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user