Fix stmt_free_result implementation and usage

Two bugs both affecting the bug_pecl_7976.phpt test ("works with
mysqlnd" haha):

 * We should not change the connection state in stmt_free_result.
   This makes mysql_stmt_free_result usable under mysqlnd and
   not just libmysqlclient.
 * If we call mysql_stmt_free_result, we still need to consume
   any outstanding result sets.
This commit is contained in:
Nikita Popov 2020-12-09 11:13:48 +01:00
parent 9c0712d2cd
commit 18517e7a63
3 changed files with 1 additions and 9 deletions

View file

@ -893,9 +893,7 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt) /* {{{ */
S->result = NULL;
}
if (S->stmt) {
int retval;
retval = mysql_stmt_free_result(S->stmt);
PDO_DBG_RETURN(retval ? 0 : 1);
mysql_stmt_free_result(S->stmt);
}
while (mysql_more_results(S->H->server)) {