fix: set rowcount to the first result in executemany(..., returning=True)
Previously, _rowcount was unconditionally set to the overall number of
rows of all queries in executemany() and then reset only upon the first
call to nextset(). In the returning=True case, this lead the rowcount
attribute to be wrong for the first result (i.e. it didn't match the
number of rows that would be returned by .fetchall(), as can be seen in
updated tests).
Now we only set _rowcount to the cumulated number of rows of executed
queries *if* executemany() is not returning (so the value is still
useful, e.g., in to check the number of INSERTed rows):
>>> cur.executemany("INSERT INTO t(r) VALUES (%s)", [(1,), (2,)])
>>> cur.rowcount
2 # number of inserted rows
>>> cur.nextset()
>>> cur.executemany("INSERT INTO t(r) VALUES (%s) RETURNING r", [(1,), (2,)], returning=True)
>>> cur.rowcount
1 # number of rows in the first result set
>>> cur.fetchall()
[(1,)]
>>> cur.nextset()
True
>>> cur.rowcount
1
>>> cur.fetchall()
[(2,)]
>>> cur.nextset()
Besides, the code for processing results from executemany() in
_executemany_gen_no_pipeline() is now similar to that of
_set_results_from_pipeline().