diff --git a/unittest/libmariadb/features-10_2.c b/unittest/libmariadb/features-10_2.c index 758b59fe..501cefe8 100644 --- a/unittest/libmariadb/features-10_2.c +++ b/unittest/libmariadb/features-10_2.c @@ -6,25 +6,56 @@ static int com_multi_1(MYSQL *mysql) { int rc; + MYSQL_RES *res; my_bool is_multi= 1; + /* TEST a simple query before COM_MULTI */ + + rc= mysql_query(mysql, "select 1"); + check_mysql_rc(rc, mysql); + FAIL_UNLESS(res, "1 simple query no result"); + res= mysql_store_result(mysql); + + mysql_free_result(res); + + /* TEST COM_MULTI */ + if (mysql_options(mysql, MARIADB_OPT_COM_MULTI, &is_multi)) { diag("COM_MULT not supported"); return SKIP; } - rc= mysql_query(mysql, "SET @a:=1"); - check_mysql_rc(rc, mysql); + rc= mysql_query(mysql, "select 1"); - rc= mysql_query(mysql, "SET @b:=2"); - check_mysql_rc(rc, mysql); - - rc= mysql_query(mysql, "select @a,@b"); - check_mysql_rc(rc, mysql); + rc= mysql_query(mysql, "select 2"); rc= mariadb_flush_multi_command(mysql); check_mysql_rc(rc, mysql); + /* 1 SELECT result */ + res= mysql_store_result(mysql); + FAIL_UNLESS(res, "1 of 2 simple query in batch no result"); + mysql_free_result(res); + /* 2 SELECT result */ + rc= mysql_next_result(mysql); + FAIL_UNLESS(rc == 0, "no second result in the batch"); + res= mysql_store_result(mysql); + FAIL_UNLESS(res, "2 of 2 simple query in batch no result"); + mysql_free_result(res); + /* WHOLE batch result (OK) */ + rc= mysql_next_result(mysql); + res= mysql_store_result(mysql); + FAIL_UNLESS(res == NULL, "rows instead of batch OK"); + rc= mysql_next_result(mysql); + FAIL_UNLESS(rc == -1, "more then 2 results"); + + /* TEST a simple query after COM_MULTI */ + + rc= mysql_query(mysql, "select 1"); + check_mysql_rc(rc, mysql); + res= mysql_store_result(mysql); + FAIL_UNLESS(res, "2 simple query no result"); + mysql_free_result(res); /* question: how will result sets look like ? */ diag("error: %s", mysql_error(mysql));