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

Salut Laurent_R,

Well, the thread is about MySQL, and I cannot speak about other RDBMS. But I did quote the documentation. Here's an example:

mysql> select bar, baz from foo; +------+-------+ | bar | baz | +------+-------+ | a | qux | | b | qux | | c | qux | | d | other | +------+-------+ 4 rows in set (0.00 sec) mysql> update foo set bar = 'b' where baz = 'qux'; Query OK, 2 rows affected (0.02 sec) Rows matched: 3 Changed: 2 Warnings: 0 mysql> select row_count(); +-------------+ | row_count() | +-------------+ | 2 | +-------------+ 1 row in set (0.00 sec)
But as we are discussing, you can't apparently get row_count() to return the changed rows with DBD::mysql.

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^6: [Solved]: How to get count of rows changed by MySQL UPDATE command using DBI
by Laurent_R (Canon) on Sep 09, 2015 at 16:05 UTC
    Alright, 1nickt, thank you ++, I am a bit surprised that the DB would even care, but, yes, your demonstration is very clear.