diff options
author | unknown <davi@mysql.com/endora.local> | 2008-03-14 17:40:12 -0300 |
---|---|---|
committer | unknown <davi@mysql.com/endora.local> | 2008-03-14 17:40:12 -0300 |
commit | 063b50477296f20b22e5cc5c1f50b8302ef55c19 (patch) | |
tree | 5b4b1c1d904c1fa627910fa50ffd694754908060 /tests | |
parent | 326c4e90589dd87792eacfa6e8746bc486a10ba0 (diff) | |
download | mariadb-git-063b50477296f20b22e5cc5c1f50b8302ef55c19.tar.gz |
Bug#35103 mysql_client_test::test_bug29948 causes sporadic failures
The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
packet if the prepared statement wasn't found in the server (due to
reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
should not send any packets, even error packets should not be sent since
they are not expected by the client API.
The solution is to clear generated during the execution of the aforementioned
commands and to skip resend of prepared statement commands. Another fix is
that if the connection breaks during the send of prepared statement command,
the command is not sent again since the prepared statement is no longer in the
server.
libmysql/libmysql.c:
The mysql handle might be reset after a reconnection.
Pass the now used stmt argument to cli_advanced_command.
sql-common/client.c:
Don't resend command if the connection broke and it's a prepared
statement command. If the session is broken, prepared statements
on the server are gone, set the error accordanly.
sql/sql_prepare.cc:
Clear any error set during the execution of the request
command.
tests/mysql_client_test.c:
Fix memory leak by freeing result associated with statement.
Remove test case for Bug 29948 because it's not reliable in
5.0 (fixed in 5.1) due to KILL queries sending two packets for
a thread that kills itself.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 0deb37d25c3..142fd741443 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11746,6 +11746,7 @@ static void test_bug5194() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); + mysql_stmt_reset(stmt); } mysql_stmt_close(stmt); @@ -15942,83 +15943,6 @@ static void test_bug27592() DBUG_VOID_RETURN; } -#if 0 - -static void test_bug29948() -{ - MYSQL *dbc=NULL; - MYSQL_STMT *stmt=NULL; - MYSQL_BIND bind; - - int res=0; - my_bool auto_reconnect=1, error=0, is_null=0; - char kill_buf[20]; - const char *query; - int buf; - unsigned long length, cursor_type; - - dbc = mysql_init(NULL); - DIE_UNLESS(dbc); - - mysql_options(dbc, MYSQL_OPT_RECONNECT, (char*)&auto_reconnect); - if (!mysql_real_connect(dbc, opt_host, opt_user, - opt_password, current_db, opt_port, - opt_unix_socket, - (CLIENT_FOUND_ROWS | CLIENT_MULTI_STATEMENTS | - CLIENT_MULTI_RESULTS))) - { - printf("connection failed: %s (%d)", mysql_error(dbc), - mysql_errno(dbc)); - exit(1); - } - - bzero(&bind, sizeof(bind)); - bind.buffer_type= MYSQL_TYPE_LONG; - bind.buffer= (char *)&buf; - bind.is_null= &is_null; - bind.error= &error; - bind.length= &length; - - res= mysql_query(dbc, "DROP TABLE IF EXISTS t1"); - myquery(res); - res= mysql_query(dbc, "CREATE TABLE t1 (a INT)"); - myquery(res); - res= mysql_query(dbc, "INSERT INTO t1 VALUES(1)"); - myquery(res); - - stmt= mysql_stmt_init(dbc); - check_stmt(stmt); - - cursor_type= CURSOR_TYPE_READ_ONLY; - res= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&cursor_type); - myquery(res); - - query= "SELECT * from t1 where a=?"; - res= mysql_stmt_prepare(stmt, query, strlen(query)); - myquery(res); - - res= mysql_stmt_bind_param(stmt, &bind); - myquery(res); - - res= mysql_stmt_execute(stmt); - check_execute(stmt, res); - - res= mysql_stmt_bind_result(stmt,&bind); - check_execute(stmt, res); - - sprintf(kill_buf, "kill %ld", dbc->thread_id); - mysql_query(dbc, kill_buf); - - res= mysql_stmt_store_result(stmt); - DIE_UNLESS(res); - - mysql_stmt_free_result(stmt); - mysql_stmt_close(stmt); - mysql_query(dbc, "DROP TABLE t1"); - mysql_close(dbc); -} - -#endif /** Bug#29306 Truncated data in MS Access with decimal (3,1) columns in a VIEW @@ -16546,7 +16470,6 @@ static struct my_tests_st my_tests[]= { { "test_bug28505", test_bug28505 }, { "test_bug28934", test_bug28934 }, { "test_bug27592", test_bug27592 }, - /* { "test_bug29948", test_bug29948 }, Bug#35103 */ { "test_bug29306", test_bug29306 }, { "test_bug31669", test_bug31669 }, { "test_bug32265", test_bug32265 }, |