aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db
diff options
context:
space:
mode:
authorYuriy Rusko <github@rusko.net>2014-05-27 21:55:40 +0200
committerYuriy Rusko <github@rusko.net>2014-05-27 21:55:40 +0200
commit1d61bcedfd1882f84d102c523a354a8c4ae69336 (patch)
treecbc3aead2546002d82fa0503eaab7f1520c515b8 /phpBB/phpbb/db
parent27f787e5e4e118b77a3e16879d6c684bdaafc303 (diff)
parent0acaa7722956635b8f17e19cddc6f02a602b7352 (diff)
downloadforums-1d61bcedfd1882f84d102c523a354a8c4ae69336.tar
forums-1d61bcedfd1882f84d102c523a354a8c4ae69336.tar.gz
forums-1d61bcedfd1882f84d102c523a354a8c4ae69336.tar.bz2
forums-1d61bcedfd1882f84d102c523a354a8c4ae69336.tar.xz
forums-1d61bcedfd1882f84d102c523a354a8c4ae69336.zip
Merge remote-tracking branch 'upstream/develop-ascraeus' into ticket/12594
Conflicts: phpBB/docs/hook_system.html
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r--phpBB/phpbb/db/driver/mysql.php21
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php3
2 files changed, 22 insertions, 2 deletions
diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
index 9b6d9962c9..569bd4f10a 100644
--- a/phpBB/phpbb/db/driver/mysql.php
+++ b/phpBB/phpbb/db/driver/mysql.php
@@ -210,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;
}
/**
diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index da6dcbc776..58361ff0f8 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -60,7 +60,8 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
}
- $this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket);
+ $this->db_connect_id = mysqli_init();
+ @mysqli_real_connect($this->db_connect_id, $this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket, MYSQLI_CLIENT_FOUND_ROWS);
if ($this->db_connect_id && $this->dbname != '')
{