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

Fix for CONC-217: mariadb_stmt_execute_direct: Clear error message from mysql_stmt_execute if mysql_stmt_prepare failed

This commit is contained in:
Georg Richter
2016-11-26 13:47:43 +01:00
parent 8695a17cbc
commit c89d5d38e0
2 changed files with 16 additions and 0 deletions

View File

@@ -2235,5 +2235,6 @@ fail:
stmt->state= MYSQL_STMT_INITTED;
SET_CLIENT_STMT_ERROR(stmt, mysql->net.last_errno, mysql->net.sqlstate,
mysql->net.last_error);
mysql->methods->db_stmt_flush_unbuffered(stmt);
return 1;
}

View File

@@ -4487,7 +4487,22 @@ static int test_conc205(MYSQL *mysql)
return OK;
}
static int test_conc217(MYSQL *mysql)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
int rc;
rc= mariadb_stmt_execute_direct(stmt, "SELECT 1 FROM nonexisting_table", -1);
FAIL_IF(rc==0, "Expected error\n");
rc= mysql_query(mysql, "drop table if exists t_count");
check_mysql_rc(rc, mysql);
rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_conc217", test_conc217, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc205", test_conc205, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc198", test_conc198, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc182", test_conc182, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},