Voting starts in March for the Drupal Association Board election.
In Drupal 8, executed update queries always return the number of rows matched by the query, including rows that didn't have to be updated because their values wouldn't have changed.
In Drupal 7, this used to be inconsistent, depending on database engine and version:
- MySQL / InnoDB: changed rows only
(except on unsupported MySQL versions 5.1.0 - 5.1.24: all rows matched by the query)
- MySQL / MyISAM: changed rows only
- PostgreSQL: all rows matched by the query
- SQLite: changed rows only
Note that this relates to all update queries whether executed from a
Database::getConnection()->update() object or its procedural wrapper
However, in most cases where you want to know the number of affected rows, a merge query might be the even better solution, see
Database::getConnection()->merge() or its procedural wrapper