diff options
author | unknown <msvensson@neptunus.(none)> | 2006-01-30 11:02:09 +0100 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-01-30 11:02:09 +0100 |
commit | d1ed8e22d102bde82bbbbd9adf1d9da4e68b5025 (patch) | |
tree | 6ea584c2184d43f05b39072f87810df22db93587 /tests | |
parent | 462fcf405e4898cbfec4b2237654583798705df6 (diff) | |
parent | f220f892124878c8ef202b847f292f7f05d83d2e (diff) | |
download | mariadb-git-d1ed8e22d102bde82bbbbd9adf1d9da4e68b5025.tar.gz |
Merge neptunus.(none):/home/msvensson/mysql/bug15719/my50-bug15719
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
sql-common/client.c:
Auto merged
tests/mysql_client_test.c:
Merge
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 79 |
1 files changed, 77 insertions, 2 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index eb0a7ade390..e68e9c61000 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14598,7 +14598,6 @@ static void test_bug14845() static void test_bug15510() { MYSQL_STMT *stmt; - MYSQL_RES *res; int rc; const char *query= "select 1 from dual where 1/0"; @@ -14624,6 +14623,80 @@ static void test_bug15510() myquery(rc); } + +/* Test MYSQL_OPT_RECONNECT, Bug#15719 */ + +static void test_opt_reconnect() +{ + MYSQL *lmysql; + my_bool my_true= TRUE; + + myheader("test_opt_reconnect"); + + if (!(lmysql= mysql_init(NULL))) + { + myerror("mysql_init() failed"); + exit(1); + } + + if (!opt_silent) + fprintf(stdout, "reconnect before mysql_options: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); + + if (mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true)) + { + myerror("mysql_options failed: unknown option MYSQL_OPT_RECONNECT\n"); + exit(1); + } + + /* reconnect should be 1 */ + if (!opt_silent) + fprintf(stdout, "reconnect after mysql_options: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 1); + + if (!(mysql_real_connect(lmysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + exit(1); + } + + /* reconnect should still be 1 */ + if (!opt_silent) + fprintf(stdout, "reconnect after mysql_real_connect: %d\n", + lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 1); + + mysql_close(lmysql); + + if (!(lmysql= mysql_init(NULL))) + { + myerror("mysql_init() failed"); + exit(1); + } + + if (!opt_silent) + fprintf(stdout, "reconnect before mysql_real_connect: %d\n", lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); + + if (!(mysql_real_connect(lmysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + exit(1); + } + + /* reconnect should still be 0 */ + if (!opt_silent) + fprintf(stdout, "reconnect after mysql_real_connect: %d\n", + lmysql->reconnect); + DIE_UNLESS(lmysql->reconnect == 0); + + mysql_close(lmysql); +} + /* Bug #16144: mysql_stmt_attr_get type error */ static void test_bug16144() @@ -14964,7 +15037,9 @@ static struct my_tests_st my_tests[]= { { "test_bug13488", test_bug13488 }, { "test_bug13524", test_bug13524 }, { "test_bug14845", test_bug14845 }, - { "test_bug15510", test_bug15510}, + { "test_bug15510", test_bug15510 }, + { "test_opt_reconnect", test_opt_reconnect }, + { "test_bug16144", test_bug16144 }, { "test_bug15613", test_bug15613 }, { 0, 0 } |