Integration tests for fetching within transaction block

Unit tests for issue #247.

Currently the first test passes, while the second fails in sqlite3 and affects all further tests (presumably because the transaction doesn't get committed or rolled back).