=== modified file 'tests/mysql_client_test.c' --- tests/mysql_client_test.c 2013-01-09 22:51:51 +0000 +++ tests/mysql_client_test.c 2013-03-28 11:52:28 +0000 @@ -17540,8 +17540,79 @@ static void test_bug13001491() myquery(rc); } +static void test_mdev4326() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind; + char query[]= "SELECT * FROM mysql.user LIMIT ?"; + unsigned long length= 0; + int int_data= 1; + int rc; + my_bool is_null= 0; + my_bool error= 0; + myheader("test_mdev4326"); + + rc= mysql_change_user(mysql, opt_user, opt_password, "mysql"); + myquery(rc); + + rc= mysql_query(mysql, "SET GLOBAL general_log = 1"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + check_stmt(stmt); + verify_param_count(stmt, 1); + + memset((char *)&bind, 0, sizeof(bind)); + bind.buffer_type= MYSQL_TYPE_LONG; + bind.buffer= (char *)&int_data; + bind.is_null= &is_null; + bind.length= &length; + bind.error= &error; + + rc= mysql_stmt_bind_param(stmt, &bind); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + while (!(rc= mysql_stmt_fetch(stmt))) + ; + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + while (!(rc= mysql_stmt_fetch(stmt))) + ; + rc= mysql_stmt_close(stmt); + check_execute(stmt, rc); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + check_stmt(stmt); + verify_param_count(stmt, 1); + + rc= mysql_stmt_bind_param(stmt, &bind); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + while (!(rc= mysql_stmt_fetch(stmt))) + ; + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + while (!(rc= mysql_stmt_fetch(stmt))) + ; + rc= mysql_stmt_close(stmt); + check_execute(stmt, rc); + + rc= mysql_change_user(mysql, opt_user, opt_password, current_db); + myquery(rc); + +} static struct my_tests_st my_tests[]= { + { "test_mdev4326", test_mdev4326}, + { 0, 0 }, { "disable_query_logs", disable_query_logs }, { "test_view_sp_list_fields", test_view_sp_list_fields }, { "client_query", client_query }, @@ -17789,6 +17860,7 @@ static struct my_tests_st my_tests[]= { { "test_bug58036", test_bug58036 }, { "test_bug56976", test_bug56976 }, { "test_bug13001491", test_bug13001491 }, + { "test_mdev4326", test_mdev4326}, { 0, 0 } };