If you run something like
ODBC_TEST(test_multi_statements)
{
long num_inserted, i;
SQLRETURN rc;
for (i= 0; i < 100000; ++i)
{
OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS t1");
OK_SIMPLE_STMT(Stmt, "CREATE TABLE t1 (a int)");
OK_SIMPLE_STMT(Stmt, "INSERT INTO t1 VALUES(1);INSERT INTO t1 VALUES(2)");
SQLRowCount(Stmt, &num_inserted);
diag("inserted: %d(run #%d)", num_inserted, i);
FAIL_IF(num_inserted != 1, "Expected 1 row inserted");
rc= SQLMoreResults(Stmt);
num_inserted= 0;
rc= SQLRowCount(Stmt, &num_inserted);
FAIL_IF(num_inserted != 1, "Expected 1 row inserted");
rc= SQLMoreResults(Stmt);
FAIL_IF(rc != SQL_NO_DATA, "expected no more results");
SQLFreeStmt(Stmt, SQL_CLOSE);
}
return OK;
}
Application at some point will make server reach max_prepared_stmt_count, that will cause for sure error of application, and even a crash in some conditions.
The patch to fix the problem is in the attached odbc16.diff file