summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-07-01 17:11:39 +0400
committerunknown <konstantin@mysql.com>2005-07-01 17:11:39 +0400
commiteb4cb6eba3147b271d893354465e9b2b44addd20 (patch)
tree0407a461774515140be4e593358851bff988e92c /tests
parent6c8d397588722dece2803370409d4776d5ffb461 (diff)
downloadmariadb-git-eb4cb6eba3147b271d893354465e9b2b44addd20.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index e57d00e5a91..a80d5e1d1be 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -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 }
};