in reply to [Solved]: How to get count of rows changed by MySQL UPDATE command using DBI

The admonition, “or -1 if the count is unavailable,” should be considered very soberly:   quite a few RDBMSes do not provide a count, even of potentially-affected lines.   Programming which assumes the existence of a useful return value in this scenario will not be transportable to other RDBMS platforms ... a very nasty application-migration “gotcha” that can blow a project-plan to hell.

The only truly reliable way that I know of to produce the count is to, within a TRANSACTION with a proper isolation level (and, in the case of MySQL, assuming a table-type that supports them), first SELECT to find out how many rows there are, then UPDATE to affect them, then COMMIT.   And this “extra select-query” is fairly expensive for the fairly meager amount of information that it produces, especially if the table structure is such that the query is not efficient.