From 971f06df2c9d58b8db342b95900ab1c47b989536 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 17 Jul 2019 23:45:41 -0700 Subject: [PATCH] rdbms: set MYSQLI_CLIENT_FOUND_ROWS in DatabaseMysqli 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/libs/rdbms/database/DatabaseMysqli.php b/includes/libs/rdbms/database/DatabaseMysqli.php index ddb39446b4..4c189115d2 100644 --- a/includes/libs/rdbms/database/DatabaseMysqli.php +++ b/includes/libs/rdbms/database/DatabaseMysqli.php @@ -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( -- 2.20.1