diff options
author | Alexander Nozdrin <alik@ibmvm> | 2010-08-04 12:18:32 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@ibmvm> | 2010-08-04 12:18:32 +0400 |
commit | aeeafbb39656fc4678c72b00f958215754b32dc7 (patch) | |
tree | 512613b578f3b028a4c6b6272b2dc4820676ad8b /tests | |
parent | efc8a279356bd2afd8d6af341f7cf80860475efd (diff) | |
parent | 81906cdf3805fe5fcea47fef11945f9adbcef4d8 (diff) | |
download | mariadb-git-aeeafbb39656fc4678c72b00f958215754b32dc7.tar.gz |
Auto-merge from mysql-5.5.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 209 | ||||
-rw-r--r-- | tests/thread_test.c | 28 |
2 files changed, 14 insertions, 223 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index f9adeb873bb..ef8ae8dd29a 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -5775,215 +5775,6 @@ static void test_set_variable() mysql_stmt_close(stmt1); } -#if NOT_USED - -/* Insert meta info .. */ - -static void test_insert_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_insert_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_insert"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_insert(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "INSERT INTO test_prep_insert VALUES(10, 'venu1', 'test')"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - mysql_stmt_close(stmt); - - strmov(query, "INSERT INTO test_prep_insert VALUES(?, 'venu', ?)"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1"); - DIE_UNLESS(strcmp(field->name, "col1") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3"); - DIE_UNLESS(strcmp(field->name, "col3") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} - - -/* Update meta info .. */ - -static void test_update_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_update_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_update"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_update(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - mysql_stmt_close(stmt); - - strmov(query, "UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - } - DIE_UNLESS(strcmp(field->name, "col1") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - } - DIE_UNLESS(strcmp(field->name, "col3") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_update") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} - - -/* Select meta info .. */ - -static void test_select_meta() -{ - MYSQL_STMT *stmt; - int rc; - MYSQL_RES *result; - MYSQL_FIELD *field; - - myheader("test_select_meta"); - - rc= mysql_autocommit(mysql, TRUE); - myquery(rc); - - rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_select"); - myquery(rc); - - rc= mysql_query(mysql, "CREATE TABLE test_prep_select(col1 tinyint, \ - col2 varchar(50), col3 varchar(30))"); - myquery(rc); - - strmov(query, "SELECT * FROM test_prep_select WHERE col1=10"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 0); - - result= mysql_param_result(stmt); - mytest_r(result); - - strmov(query, "SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); - stmt= mysql_simple_prepare(mysql, query); - check_stmt(stmt); - - verify_param_count(stmt, 2); - - result= mysql_param_result(stmt); - mytest(result); - - my_print_result_metadata(result); - - mysql_field_seek(result, 0); - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - } - DIE_UNLESS(strcmp(field->name, "col1") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0); - - field= mysql_fetch_field(result); - mytest(field); - if (!opt_silent) - { - fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2"); - fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - } - DIE_UNLESS(strcmp(field->name, "col2") == 0); - DIE_UNLESS(strcmp(field->table, "test_prep_select") == 0); - - field= mysql_fetch_field(result); - mytest_r(field); - - mysql_free_result(result); - mysql_stmt_close(stmt); -} -#endif - - /* Test FUNCTION field info / DATE_FORMAT() table_name . */ static void test_func_fields() diff --git a/tests/thread_test.c b/tests/thread_test.c index 1a3dd60c1fd..c243a3a7321 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -88,36 +88,36 @@ static struct my_option my_long_options[] = { {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"database", 'D', "Database to use", (uchar**) &database, (uchar**) &database, + {"database", 'D', "Database to use", &database, &database, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"host", 'h', "Connect to host", (uchar**) &host, (uchar**) &host, 0, GET_STR, + {"host", 'h', "Connect to host", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server. If password is not given it's asked from the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"user", 'u', "User for login if not current user", (uchar**) &user, - (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"user", 'u', "User for login if not current user", &user, + &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Write some progress indicators", (uchar**) &verbose, - (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"query", 'Q', "Query to execute in each threads", (uchar**) &query, - (uchar**) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Write some progress indicators", &verbose, + &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"query", 'Q', "Query to execute in each threads", &query, + &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 "/etc/services, " #endif "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", - (uchar**) &tcp_port, - (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"socket", 'S', "Socket file to use for connection", (uchar**) &unix_socket, - (uchar**) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + &tcp_port, + &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, + {"socket", 'S', "Socket file to use for connection", &unix_socket, + &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"test-count", 'c', "Run test count times (default %d)", - (uchar**) &number_of_tests, (uchar**) &number_of_tests, 0, GET_UINT, + &number_of_tests, &number_of_tests, 0, GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0}, {"thread-count", 't', "Number of threads to start", - (uchar**) &number_of_threads, (uchar**) &number_of_threads, 0, GET_UINT, + &number_of_threads, &number_of_threads, 0, GET_UINT, REQUIRED_ARG, 2, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; |