Reputation: 341
I have one mysql table on which i created on-after and on-before trigger for insertion. Each tigger update 2 rows respectively. So once i insert a row to the table, altogether 5 rows are updated, even though the response from the DB will be as "1 row is affected". I need to find a way to know the total no of rows got updated, in this case 5.
Upvotes: 0
Views: 1065
Reputation: 5666
The problem seems to be that MySQL does not count along when you insert/update rows in a trigger. The best possible solution might be to count the manually inserted/updated rows for yourself, store the value in a variable, get it after the outer query and add the result of ROW_COUNT() to it.
Upvotes: 1
Reputation: 57716
I think it is giving one row affected because you are adding one row in table. Mysql reply gives information of row added in that table only. And not giving affected rows by triggers.
Upvotes: 0