com php-src: PDO MySQL: Use stmt_next_result with libmy sqlclient as well: ext/pdo_mysql/mysql_statement. c

From: Date: Fri, 11 Dec 2020 11:20:04 +0000
Subject: com php-src: PDO MySQL: Use stmt_next_result with libmy sqlclient as well: ext/pdo_mysql/mysql_statement. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-114412@lists.php.net to get a copy of this message
Commit: d6b4b82a386402058c0eceaec31cfd7b5da765f8 Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 11 Dec 2020 12:13:52 +0100 Parents: 4e51059d5246a42c43fc963bf9add11e985df184 Branches: PHP-8.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d6b4b82a386402058c0eceaec31cfd7b5da765f8 Log: PDO MySQL: Use stmt_next_result with libmysqlclient as well libmysqlclient added this function in version 5.5, which happens to be the minimum we support. If we have a prepared statement, we should use it on both mysqlnd and libmysqlclient, even if the handling afterwards is different. This fixes error handling with native prepared statements. Changed paths: M ext/pdo_mysql/mysql_statement.c Diff: diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 46f39c985d3..80d8747cd96 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -341,30 +341,29 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */ PDO_DBG_INF_FMT("stmt=%p", S->stmt); /* ensure that we free any previous unfetched results */ - if (S->stmt) { - mysql_stmt_free_result(S->stmt); - } pdo_mysql_free_result(S); -#ifdef PDO_USE_MYSQLND if (S->stmt) { - if (mysqlnd_stmt_next_result(S->stmt)) { + mysql_stmt_free_result(S->stmt); + if (mysql_stmt_next_result(S->stmt)) { + pdo_mysql_error_stmt(stmt); + S->done = 1; + PDO_DBG_RETURN(0); + } + } else { + if (mysql_next_result(H->server)) { pdo_mysql_error_stmt(stmt); S->done = 1; PDO_DBG_RETURN(0); } + } +#ifdef PDO_USE_MYSQLND + if (S->stmt) { PDO_DBG_RETURN(pdo_mysql_stmt_after_execute_prepared(stmt)); } #endif - - if (mysql_next_result(H->server)) { - pdo_mysql_error_stmt(stmt); - S->done = 1; - PDO_DBG_RETURN(0); - } else { - PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt)); - } + PDO_DBG_RETURN(pdo_mysql_fill_stmt_from_result(stmt)); } /* }}} */

« previous php.cvs (#114412) next »