diff --git a/NEWS b/NEWS index e2cb05e949509..cb115eba1a93b 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,9 @@ PHP NEWS - PDO: . Fixed bug #80027 (Terrible performance using $query->fetch on queries with - many bind parameters (Matteo) + many bind parameters) (Matteo) + . Fixed bug #79914 (PHP PDO mysqlnd ignores InnoDB deadlock errors). + (houxiaoxian) - Standard: . Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb) diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 9b880ea1fa016..0e055f52f89e9 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -117,9 +117,21 @@ static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt) /* {{{ */ { zend_long row_count; pdo_mysql_stmt *S = stmt->driver_data; + pdo_mysql_db_handle *H = S->H; row_count = (zend_long) mysql_stmt_affected_rows(S->stmt); if (row_count != (zend_long)-1) { stmt->row_count = row_count; + } else { + if (!H->buffered) { + S->result = mysql_use_result(H->server); + } else { + S->result = mysql_store_result(H->server); + } + + S->stmt = NULL; + stmt->dbh->methods = NULL; + pdo_mysql_error_stmt(stmt); + PDO_DBG_VOID_RETURN; } } /* }}} */