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

CONC-683: Check pending results when closing statement.

Similiar to fix for CONC-667 we need to check if other
statements have a pending result set before we can close
a statement handle.
This commit is contained in:
Georg Richter
2024-03-23 12:53:24 +01:00
parent b64282a9dd
commit fef3e4ed6d
2 changed files with 53 additions and 7 deletions

View File

@@ -5780,7 +5780,37 @@ static int test_conc667(MYSQL *mysql)
return OK;
}
static int test_conc683(MYSQL *mysql)
{
MYSQL_STMT *stmt1, *stmt2;
int rc;
stmt1= mysql_stmt_init(mysql);
stmt2= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt1, "SELECT 1 UNION SELECT 2", -1);
check_stmt_rc(rc, stmt1);
rc= mysql_stmt_prepare(stmt2, "SELECT 1", -1);
check_stmt_rc(rc, stmt2);
rc= mysql_stmt_execute(stmt1);
check_stmt_rc(rc, stmt1);
rc= mysql_stmt_close(stmt2);
FAIL_IF(!rc || mysql_stmt_errno(stmt2) != CR_COMMANDS_OUT_OF_SYNC,
"Expected commands out of sync error");
rc= mysql_stmt_close(stmt1);
check_stmt_rc(rc, stmt1);
rc= mysql_stmt_close(stmt2);
check_stmt_rc(rc, stmt2);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_conc683", test_conc683, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc667", test_conc667, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc633", test_conc633, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc623", test_conc623, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},