Factor out committing scan cursors

There were three similar versions, none of them straightforwardly integrated with the main path of cursor creation. This still does not expose the capability to ordinary queries, but does centralize the implementation and expose the API further up.

A new class holds options for the various ways in which a *scan* cursor might commit. Although conceptually similar, it does not handle the case of committing a transaction between statements, because that's also based on the amount *written*, which will be forbidden by the new isolation modes.

Include a simple smoke test that just iterates over a group committing in various ways along the way.

There will be a minor conflict with #1562, which I will deal with once that is in master. 
Does `count` need reset here? If the option is row count based it will start committing every row, right?