diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 9394b0df40b..4ee73a2d888 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18026,6 +18026,49 @@ static void test_bug44495() DBUG_VOID_RETURN; } + +/** + Bug# 33831 mysql_real_connect() should fail if + given an already connected MYSQL handle. +*/ + +static void test_bug33831(void) +{ + MYSQL *l_mysql; + my_bool error; + + DBUG_ENTER("test_bug33831"); + + error= 0; + + if (!(l_mysql= mysql_init(NULL))) + { + myerror("mysql_init() failed"); + DIE_UNLESS(0); + } + if (!(mysql_real_connect(l_mysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + DIE_UNLESS(0); + } + + if (mysql_real_connect(l_mysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0)) + { + myerror("connection should have failed"); + DIE_UNLESS(0); + } + + + mysql_close(l_mysql); + + DBUG_VOID_RETURN; +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -18336,6 +18379,7 @@ static struct my_tests_st my_tests[]= { { "test_wl4166_1", test_wl4166_1 }, { "test_wl4166_2", test_wl4166_2 }, { "test_bug38486", test_bug38486 }, + { "test_bug33831", test_bug33831 }, { "test_bug40365", test_bug40365 }, { "test_bug43560", test_bug43560 }, #ifdef HAVE_QUERY_CACHE |