Hello,
That is a little bit different than #1313 actually.
https://github.com/mybatis/mybatis-3/issues/1313#issuecomment-770539572When you put multiple statements separated by semicolon, the result depends on the driver implementation.
In fact, mysql-connector-java also returns the result for the first statement.
If you want to know the number of affected rows, you need to execute them separately and sum up the results [1].
People usually do it for efficiency, but it is not very efficient especially when the list contains a lot of items.
What it does in JDBC level, basically, is something like this:
String sql = "update ...;" + "update ...;" + "update ...;";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1, "john");
ps.setInt(2, 124);
...
ps.setString(981, "foo");
ps.execute();
int c = ps.getUpdateCount();
Compared to executing each UPDATE separately, it leaves a bigger memory footprint.
[1] When all statements are the same, JDBC provides an efficient way that reuses the same PreparedStatement (see
https://stackoverflow.com/a/58914577 ), but this is not applicable to your case (because of `<if />`s, PreparedStatement cannot be reused).
Regards,
Iwao