diff options
Diffstat (limited to 'phpBB/phpbb/db/driver/mysql.php')
| -rw-r--r-- | phpBB/phpbb/db/driver/mysql.php | 32 | 
1 files changed, 27 insertions, 5 deletions
| diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php index 1a4fd364df..569bd4f10a 100644 --- a/phpBB/phpbb/db/driver/mysql.php +++ b/phpBB/phpbb/db/driver/mysql.php @@ -1,9 +1,13 @@  <?php  /**  * -* @package dbal -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file.  *  */ @@ -16,7 +20,6 @@ namespace phpbb\db\driver;  * MySQL 4.0+  * MySQL 4.1+  * MySQL 5.0+ -* @package dbal  */  class mysql extends \phpbb\db\driver\mysql_base  { @@ -207,7 +210,26 @@ class mysql extends \phpbb\db\driver\mysql_base  	*/  	function sql_affectedrows()  	{ -		return ($this->db_connect_id) ? @mysql_affected_rows($this->db_connect_id) : false; +		if ($this->db_connect_id) +		{ +			// We always want the number of matched rows +			// instead of changed rows, when running an update. +			// So when mysql_info() returns the number of matched rows +			// we return that one instead of mysql_affected_rows() +			$mysql_info = @mysql_info($this->db_connect_id); +			if ($mysql_info !== false) +			{ +				$match = array(); +				preg_match('#^Rows matched: (\d)+  Changed: (\d)+  Warnings: (\d)+$#', $mysql_info, $match); +				if (isset($match[1])) +				{ +					return $match[1]; +				} +			} + +			return @mysql_affected_rows($this->db_connect_id); +		} +		return false;  	}  	/** | 
