rdbms: set MYSQLI_CLIENT_FOUND_ROWS in DatabaseMysqli
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 18 Jul 2019 06:45:41 +0000 (23:45 -0700)
committerMobrovac <mobrovac@wikimedia.org>
Thu, 8 Aug 2019 11:03:58 +0000 (11:03 +0000)
This fixing failing SQLiteBagOStuff::changeTTL() tests when the old
and new expiry column has the same value.

Bug: T229456
Change-Id: Ib7d30115e2084f43b1c195e7bfa1ad5fed9a71d4

includes/libs/rdbms/database/DatabaseMysqli.php

index ddb3944..4c18911 100644 (file)
@@ -82,8 +82,10 @@ class DatabaseMysqli extends DatabaseMysqlBase {
                }
 
                $mysqli = mysqli_init();
-
-               $connFlags = 0;
+               // Make affectedRows() for UPDATE reflect the number of matching rows, regardless
+               // of whether any column values changed. This is what callers want to know and is
+               // consistent with what Postgres, SQLite, and SQL Server return.
+               $connFlags = MYSQLI_CLIENT_FOUND_ROWS;
                if ( $this->getFlag( self::DBO_SSL ) ) {
                        $connFlags |= MYSQLI_CLIENT_SSL;
                        $mysqli->ssl_set(