1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

more test fixes

This commit is contained in:
Georg Richter
2013-03-13 21:43:39 +01:00
parent d1b93bd17e
commit 7afc51d9aa
7 changed files with 19 additions and 9 deletions

View File

@@ -46,9 +46,9 @@ static int basic_connect(MYSQL *mysql)
check_mysql_rc(rc, my); check_mysql_rc(rc, my);
res= mysql_store_result(my); res= mysql_store_result(my);
field= mysql_fetch_fields(res);
FAIL_IF(!res, mysql_error(my)); FAIL_IF(!res, mysql_error(my));
field= mysql_fetch_fields(res);
FAIL_IF(!field, "couldn't fetch field");
while ((row= mysql_fetch_row(res)) != NULL) while ((row= mysql_fetch_row(res)) != NULL)
{ {
FAIL_IF(mysql_num_fields(res) != 1, "Got the wrong number of fields"); FAIL_IF(mysql_num_fields(res) != 1, "Got the wrong number of fields");

View File

@@ -169,7 +169,6 @@ static int test_change_user(MYSQL *mysql)
diag("Due to mysql_change_user security fix this test will not work anymore."); diag("Due to mysql_change_user security fix this test will not work anymore.");
return(SKIP); return(SKIP);
DBUG_ENTER("test_change_user");
/* Prepare environment */ /* Prepare environment */
sprintf(buff, "drop database if exists %s", db); sprintf(buff, "drop database if exists %s", db);

View File

@@ -46,6 +46,10 @@ MYSQL_STMT *open_cursor(MYSQL *mysql, const char *query)
MYSQL_STMT *stmt= mysql_stmt_init(mysql); MYSQL_STMT *stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, query, strlen(query)); rc= mysql_stmt_prepare(stmt, query, strlen(query));
if (rc) {
diag("Error: %s", mysql_stmt_error(stmt));
return NULL;
}
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type); mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type);
return stmt; return stmt;
} }

View File

@@ -51,12 +51,17 @@ static int test_bug28505(MYSQL *mysql)
int rc; int rc;
rc= mysql_query(mysql, "drop table if exists t1"); rc= mysql_query(mysql, "drop table if exists t1");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "create table t1(f1 int primary key)"); rc= mysql_query(mysql, "create table t1(f1 int primary key)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "insert into t1 values(1)"); rc= mysql_query(mysql, "insert into t1 values(1)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "insert into t1 values(1) on duplicate key update f1=1"); rc= mysql_query(mysql, "insert into t1 values(1) on duplicate key update f1=1");
check_mysql_rc(rc, mysql);
res= mysql_affected_rows(mysql); res= mysql_affected_rows(mysql);
FAIL_UNLESS(!res, "res != 0"); FAIL_UNLESS(!res, "res != 0");
rc= mysql_query(mysql, "drop table t1"); rc= mysql_query(mysql, "drop table t1");
check_mysql_rc(rc, mysql);
return OK; return OK;
} }
@@ -251,7 +256,7 @@ static int test_frm_bug(MYSQL *mysql)
char test_frm[FN_REFLEN]; char test_frm[FN_REFLEN];
int rc; int rc;
return SKIP;
mysql_autocommit(mysql, TRUE); mysql_autocommit(mysql, TRUE);
rc= mysql_query(mysql, "drop table if exists test_frm_bug"); rc= mysql_query(mysql, "drop table if exists test_frm_bug");
@@ -815,7 +820,7 @@ struct my_tests_st my_tests[] = {
{"test_bug29692", test_bug29692, TEST_CONNECTION_NEW, CLIENT_FOUND_ROWS, NULL, NULL}, {"test_bug29692", test_bug29692, TEST_CONNECTION_NEW, CLIENT_FOUND_ROWS, NULL, NULL},
{"test_bug31418", test_bug31418, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_bug31418", test_bug31418, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_bug6081", test_bug6081, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_bug6081", test_bug6081, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
// {"test_frm_bug", test_frm_bug, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_frm_bug", test_frm_bug, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_wl4166_1", test_wl4166_1, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_1", test_wl4166_1, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_wl4166_2", test_wl4166_2, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_2", test_wl4166_2, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_wl4166_3", test_wl4166_3, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_3", test_wl4166_3, TEST_CONNECTION_NEW, 0, NULL, NULL},

View File

@@ -2885,6 +2885,7 @@ static int test_bug6096(MYSQL *mysql)
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
query_result= mysql_store_result(mysql); query_result= mysql_store_result(mysql);
query_field_list= mysql_fetch_fields(query_result); query_field_list= mysql_fetch_fields(query_result);
FAIL_IF(!query_field_list, "fetch_fields faild");
query_field_count= mysql_num_fields(query_result); query_field_count= mysql_num_fields(query_result);
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
@@ -3710,6 +3711,8 @@ static int test_bug53311(MYSQL *mysql)
return OK; return OK;
} }
#define PREPARE_SQL "EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2" #define PREPARE_SQL "EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2"
#ifdef NOT_IN_USE
static int test_metadata(MYSQL *mysql) static int test_metadata(MYSQL *mysql)
{ {
int rc; int rc;
@@ -3758,6 +3761,7 @@ end2:
end: end:
return 0; return 0;
} }
#endif
static int test_conc_5(MYSQL *mysql) static int test_conc_5(MYSQL *mysql)
{ {

View File

@@ -8,7 +8,6 @@ static int test1(MYSQL *mysql)
{ {
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES *res; MYSQL_RES *res;
MYSQL_FIELD *fields;
int rc; int rc;
MYSQL *my= mysql_init(NULL); MYSQL *my= mysql_init(NULL);
@@ -47,8 +46,6 @@ static int test1(MYSQL *mysql)
res= mysql_use_result(my); res= mysql_use_result(my);
FAIL_IF(!res, mysql_error(my)); FAIL_IF(!res, mysql_error(my));
fields= mysql_fetch_fields(res);
while ((row= mysql_fetch_row(res)) != NULL) while ((row= mysql_fetch_row(res)) != NULL)
{ {
FAIL_IF(mysql_num_fields(res) != 2, "Got the wrong number of fields"); FAIL_IF(mysql_num_fields(res) != 2, "Got the wrong number of fields");

View File

@@ -20,8 +20,9 @@ static int basic_connect(MYSQL *mysql)
check_mysql_rc(rc, my); check_mysql_rc(rc, my);
res= mysql_store_result(my); res= mysql_store_result(my);
field= mysql_fetch_fields(res);
FAIL_IF(!res, mysql_error(my)); FAIL_IF(!res, mysql_error(my));
field= mysql_fetch_fields(res);
FAIL_IF(!field, "Couldn't fetch fields");
while ((row= mysql_fetch_row(res)) != NULL) while ((row= mysql_fetch_row(res)) != NULL)
{ {