php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #76742
Patch patch.79914 revision 2020-08-08 00:53 UTC by houxiaoxian1111 at 163 dot com
revision 2020-08-05 02:31 UTC by houxiaoxian1111 at 163 dot com
Patch patch.76742 revision 2020-07-30 03:25 UTC by houxiaoxian1111 at 163 dot com

Patch patch.79914 for PDO MySQL Bug #76742

Patch version 2020-08-08 00:53 UTC

Return to Bug #76742 | Download this patch
Patch Revisions: 2020-08-08 00:53 UTC | 2020-08-05 02:31 UTC

Developer: houxiaoxian1111@163.com



  diff -up origin/php-7.1.11/ext/pdo_mysql/mysql_driver.c new/php-7.1.11/ext/pdo_mysql/mysql_driver.c
  --- origin/php-7.1.11/ext/pdo_mysql/mysql_driver.c	2017-10-25 15:04:36.000000000 +0800
 +++ new/php-7.1.11/ext/pdo_mysql/mysql_driver.c	2020-07-30 11:10:49.000000000 +0800
 @@ -42,6 +42,54 @@
 +++ new/php-7.1.11/ext/pdo_mysql/mysql_driver.c	2020-08-08 08:44:30.000000000 +0800
 @@ -42,6 +42,55 @@
   #	define pdo_mysql_init(persistent) mysql_init(NULL)
   #endif
   
  +/* {{{ _pdo_mysql_stmt_error */
 +
  +int _pdo_mysql_stmt_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line)
  +{
  +        pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
  +        pdo_error_type *pdo_err;
  +        pdo_mysql_error_info *einfo;
  +        pdo_mysql_stmt *S = NULL;
  +
  +
 +        PDO_DBG_ENTER("_pdo_mysql_error");
 +        PDO_DBG_ENTER("_pdo_mysql_stmt_error");
  +        PDO_DBG_INF_FMT("file=%s line=%d", file, line);
  +        S = (pdo_mysql_stmt*)stmt->driver_data;
  +        pdo_err = &stmt->error_code;
  +        einfo   = &S->einfo;


   int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line)
   {
  diff -up origin/php-7.1.11/ext/pdo_mysql/mysql_statement.c new/php-7.1.11/ext/pdo_mysql/mysql_statement.c
  --- origin/php-7.1.11/ext/pdo_mysql/mysql_statement.c	2017-10-25 15:04:36.000000000 +0800
 +++ new/php-7.1.11/ext/pdo_mysql/mysql_statement.c	2020-08-05 10:13:17.000000000 +0800
 +++ new/php-7.1.11/ext/pdo_mysql/mysql_statement.c	2020-08-08 08:45:15.000000000 +0800
  @@ -119,10 +119,19 @@ static void pdo_mysql_stmt_set_row_count
   {
   	zend_long row_count;
   	pdo_mysql_stmt *S = stmt->driver_data;


   	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);
 +                }
 +                pdo_mysql_error_stmt_emulate_false(stmt);                
 +                PDO_DBG_VOID_RETURN;
 +        }
 +        	if (!H->buffered) {
 +                	S->result = mysql_use_result(H->server);
 +        	} else {
 +                	S->result = mysql_store_result(H->server);
 +        	}
 +        	pdo_mysql_error_stmt_emulate_false(stmt);                
 +        	PDO_DBG_VOID_RETURN;
 +    	}
   }
   /* }}} */
   
  diff -up origin/php-7.1.11/ext/pdo_mysql/php_pdo_mysql_int.h new/php-7.1.11/ext/pdo_mysql/php_pdo_mysql_int.h
  --- origin/php-7.1.11/ext/pdo_mysql/php_pdo_mysql_int.h	2017-10-25 15:04:36.000000000 +0800
 +++ new/php-7.1.11/ext/pdo_mysql/php_pdo_mysql_int.h	2020-07-30 11:09:53.000000000 +0800
 @@ -154,6 +154,7 @@ extern pdo_driver_t pdo_mysql_driver;
 +++ new/php-7.1.11/ext/pdo_mysql/php_pdo_mysql_int.h	2020-08-08 08:43:59.000000000 +0800
 @@ -150,10 +150,12 @@ typedef struct {
  } pdo_mysql_stmt;
  
  extern pdo_driver_t pdo_mysql_driver;
 +extern int _pdo_mysql_stmt_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line);
  
   extern int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line);
   #define pdo_mysql_error(s) _pdo_mysql_error(s, NULL, __FILE__, __LINE__)
   #define pdo_mysql_error_stmt(s) _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__)
  +#define pdo_mysql_error_stmt_emulate_false(s) _pdo_mysql_stmt_error(stmt->dbh, stmt, __FILE__, __LINE__)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC