When running multi-statements, the behavior of affected_rows appears to have changed in v0.5.7. The function now always returns the first statement’s affected_rows, instead of reflecting the result of the current statement.
This seems to be caused by #1383
client.query('INSERT INTO roles (store_id, type) VALUES (1, 1), (2, 3); UPDATE roles SET type = 2 WHERE id = 1', as: :array)
client.affected_rows # => 2
client.next_result # => true
client.affected_rows # before was correctly 1, now returns 2