diff options
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r-- | tests/mysql_client_test.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 8bfe315fb59..9284b2182b1 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -129,7 +129,7 @@ static void die(const char *file, int line, const char *expr) fflush(stdout); fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr); fflush(stderr); - abort(); + exit(1); } @@ -5914,6 +5914,20 @@ DROP TABLE IF EXISTS test_multi_tab"; (void) my_process_result_set(result); mysql_free_result(result); + /* + Check if errors in one of the queries handled properly. + */ + rc= mysql_query(mysql_local, "select 1; select * from not_existing_table"); + myquery(rc); + result= mysql_store_result(mysql_local); + mysql_free_result(result); + + rc= mysql_next_result(mysql_local); + DIE_UNLESS(rc > 0); + + rc= mysql_next_result(mysql_local); + DIE_UNLESS(rc < 0); + mysql_close(mysql_local); } @@ -9552,7 +9566,7 @@ static void test_subqueries_ref() { MYSQL_STMT *stmt; int rc, i; - const char *query= "SELECT a as ccc from t1 where a+1=(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1)"; + const char *query= "SELECT a as ccc from t1 outr where a+1=(SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1)"; myheader("test_subqueries_ref"); @@ -11930,7 +11944,7 @@ static void test_bug5194() MAX_PARAM_COUNT * CHARS_PER_PARAM + 1); param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM); - if (bind == 0 || query == 0 || param_str == 0) + if (my_bind == 0 || query == 0 || param_str == 0) { fprintf(stderr, "Can't allocate enough memory for query structs\n"); if (my_bind) @@ -15869,6 +15883,8 @@ static void test_status() Test that client gets updated value of insert_id on UPDATE that uses LAST_INSERT_ID(expr). + select_query added to test for bug + #26921 Problem in mysql_insert_id() Embedded C API function */ static void test_bug21726() { @@ -15881,6 +15897,8 @@ static void test_bug21726() const char *update_query= "UPDATE t1 SET i= LAST_INSERT_ID(i + 1)"; int rc; my_ulonglong insert_id; + const char *select_query= "SELECT * FROM t1"; + MYSQL_RES *result; DBUG_ENTER("test_bug21726"); myheader("test_bug21726"); @@ -15897,6 +15915,13 @@ static void test_bug21726() insert_id= mysql_insert_id(mysql); DIE_UNLESS(insert_id == 3); + rc= mysql_query(mysql, select_query); + myquery(rc); + insert_id= mysql_insert_id(mysql); + DIE_UNLESS(insert_id == 3); + result= mysql_store_result(mysql); + mysql_free_result(result); + DBUG_VOID_RETURN; } @@ -16878,7 +16903,9 @@ static void test_bug20023() int sql_big_selects_4; int sql_big_selects_5; +#if NOT_USED char query_buffer[MAX_TEST_QUERY_LENGTH]; +#endif /* Create a new connection. */ @@ -16976,6 +17003,12 @@ static void test_bug20023() Check that SQL_BIG_SELECTS will be the original one. ***********************************************************************/ +#if NOT_USED + /* + max_join_size is a ulong or better. + my_snprintf() only goes up to ul. + */ + /* Restore MAX_JOIN_SIZE. */ my_snprintf(query_buffer, @@ -16984,6 +17017,11 @@ static void test_bug20023() (int) max_join_size_orig); DIE_IF(mysql_query(&con, query_buffer)); + +#else + DIE_IF(mysql_query(&con, "SET @@global.max_join_size = -1")); +#endif + DIE_IF(mysql_query(&con, "SET @@session.max_join_size = default")); /* Issue COM_CHANGE_USER. */ |