diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_fw.c | 3 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 113 | ||||
-rw-r--r-- | tests/thread_test.c | 4 |
3 files changed, 100 insertions, 20 deletions
diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c index b7211989f1f..71fb3894b3c 100644 --- a/tests/mysql_client_fw.c +++ b/tests/mysql_client_fw.c @@ -1409,8 +1409,7 @@ int main(int argc, char **argv) for (i= 0; i < argc; i++) original_argv[i]= strdup(argv[i]); - if (load_defaults("my", client_test_load_default_groups, &argc, &argv)) - exit(1); + load_defaults_or_exit("my", client_test_load_default_groups, &argc, &argv); get_options(&argc, &argv); /* Set main opt_count. */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 4c8ee07cdd0..63d40c5db64 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -422,6 +422,55 @@ static void test_prepare_simple() mysql_stmt_close(stmt); + /* show create */ + strmov(query, "SHOW CREATE TABLE test_prepare_simple"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); + mysql_stmt_close(stmt); + + /* show create database */ + strmov(query, "SHOW CREATE DATABASE test"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); + mysql_stmt_close(stmt); + + /* show grants */ + strmov(query, "SHOW GRANTS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 1); + mysql_stmt_close(stmt); + + /* show slave status */ + strmov(query, "SHOW SLAVE STATUS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 47); + mysql_stmt_close(stmt); + + /* show master status */ + strmov(query, "SHOW MASTER STATUS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 4); + mysql_stmt_close(stmt); + + /* show create procedure */ + strmov(query, "SHOW CREATE PROCEDURE e1;"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 6); + mysql_stmt_close(stmt); + + /* show create function */ + strmov(query, "SHOW CREATE FUNCTION e1;"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 6); + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); @@ -2094,7 +2143,7 @@ static void test_ps_conj_select() "(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')"); myquery(rc); - strmov(query, "select id1, value1 from t1 where id1= ? or " + strmov(query, "SELECT id1, value1 from t1 where id1= ? or " "CONVERT(value1 USING utf8)= ?"); stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); @@ -2278,6 +2327,11 @@ static void test_ps_query_cache() "(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')"); myquery(rc); + rc= mysql_query(lmysql, "set global query_cache_type=ON"); + myquery(rc); + rc= mysql_query(lmysql, "set local query_cache_type=ON"); + myquery(rc); + for (iteration= TEST_QCACHE_ON; iteration <= TEST_QCACHE_ON_OFF; iteration++) { @@ -2307,6 +2361,8 @@ static void test_ps_query_cache() mysql_close(lmysql); DIE_UNLESS(0); } + rc= mysql_query(lmysql, "SET SQL_MODE=''"); + myquery(rc); rc= mysql_set_character_set(lmysql, "utf8"); myquery(rc); @@ -2427,7 +2483,9 @@ static void test_ps_query_cache() if (lmysql != mysql) mysql_close(lmysql); - rc= mysql_query(mysql, "set global query_cache_size=0"); + rc= mysql_query(mysql, "set global query_cache_size=default"); + myquery(rc); + rc= mysql_query(mysql, "set global query_cache_type=default"); myquery(rc); } @@ -7037,11 +7095,7 @@ static void test_embedded_start_stop() MY_INIT(argv[0]); /* Load the client defaults from the .cnf file[s]. */ - if (load_defaults("my", client_test_load_default_groups, &argc, &argv)) - { - myerror("load_defaults failed"); - exit(1); - } + load_defaults_or_exit("my", client_test_load_default_groups, &argc, &argv); /* Parse the options (including the ones given from defaults files). */ get_options(&argc, &argv); @@ -7089,12 +7143,7 @@ static void test_embedded_start_stop() MY_INIT(argv[0]); - if (load_defaults("my", client_test_load_default_groups, &argc, &argv)) - { - myerror("load_defaults failed \n "); - exit(1); - } - + load_defaults_or_exit("my", client_test_load_default_groups, &argc, &argv); get_options(&argc, &argv); /* Must start the main embedded server again after the test. */ @@ -13168,6 +13217,10 @@ static void test_open_cursor_prepared_statement_query_cache() return; } + rc= mysql_query(mysql, "set global query_cache_type=ON"); + myquery(rc); + rc= mysql_query(mysql, "set local query_cache_type=ON"); + myquery(rc); rc= mysql_query(mysql, "set global query_cache_size=1000000"); myquery(rc); @@ -13190,7 +13243,9 @@ static void test_open_cursor_prepared_statement_query_cache() check_execute(stmt, rc); mysql_stmt_close(stmt); - rc= mysql_query(mysql, "set global query_cache_size=1000000"); + rc= mysql_query(mysql, "set global query_cache_type=default"); + myquery(rc); + rc= mysql_query(mysql, "set global query_cache_size=default"); myquery(rc); } @@ -15312,6 +15367,9 @@ static void test_bug14169() rc= mysql_query(mysql, "drop table t1"); myquery(rc); + + rc= mysql_query(mysql, "set session group_concat_max_len=@@global.group_concat_max_len"); + myquery(rc); } /* @@ -17163,7 +17221,7 @@ static void test_bug28386() if (! opt_silent) printf("Skipping the test since logging to tables is not enabled\n"); /* Log output is not to tables */ - return; + DBUG_VOID_RETURN; } mysql_free_result(result); @@ -17960,6 +18018,8 @@ static void test_bug36326() myquery(rc); rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1"); myquery(rc); + rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1"); + myquery(rc); rc= mysql_query(mysql, "SET GLOBAL query_cache_size = 1048576"); myquery(rc); DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_IN_TRANS)); @@ -17983,7 +18043,8 @@ static void test_bug36326() DIE_UNLESS(rc == 1); rc= mysql_query(mysql, "DROP TABLE t1"); myquery(rc); - rc= mysql_query(mysql, "SET GLOBAL query_cache_size = 0"); + rc= mysql_query(mysql, "SET GLOBAL query_cache_size = default"); + rc= mysql_query(mysql, "SET GLOBAL query_cache_type = default"); myquery(rc); DBUG_VOID_RETURN; @@ -19418,6 +19479,25 @@ static void test_big_packet() } +/* Test simple prepares of all DML statements */ + +static void test_prepare_analyze() +{ + MYSQL_STMT *stmt; + int rc; + myheader("test_prepare_analyze"); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + rc= mysql_stmt_prepare(stmt, STRING_WITH_LEN("ANALYZE SELECT 1")); + check_execute(stmt, rc); + verify_param_count(stmt, 0); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + mysql_stmt_close(stmt); +} + static struct my_tests_st my_tests[]= { { "disable_query_logs", disable_query_logs }, { "test_view_sp_list_fields", test_view_sp_list_fields }, @@ -19694,6 +19774,7 @@ static struct my_tests_st my_tests[]= { #endif { "test_compressed_protocol", test_compressed_protocol }, { "test_big_packet", test_big_packet }, + { "test_prepare_analyze", test_prepare_analyze }, { 0, 0 } }; diff --git a/tests/thread_test.c b/tests/thread_test.c index bf0fb8ea2c0..38e453e9cb8 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -168,8 +168,8 @@ static void get_options(int argc, char **argv) { int ho_error; - if ((ho_error= load_defaults("my",load_default_groups,&argc,&argv)) || - (ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) + load_defaults_or_exit("my", load_default_groups, &argc, &argv); + if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option))) exit(ho_error); free_defaults(argv); |