danieltdt/unqlite-ruby — pull request #5 by djurczak (2013-07-23 11:30:08+00:00)
Title: Data loss when fetch() fails in-between store() calls

If we store multiple values in succession (e.g. in a loop) and there is a ``fetch()`` call in-between those ``store()`` calls that fails we lose all the data that had been added so far.

This happens because in ``rb_unqlite_raise()`` (``ext/unqlite/unqlite_exception.c``) we call ``unqlite_rollback()`` unless the UnQLite error code is either ``UNQLITE_BUSY`` or ``UNQLITE_NOTIMPLEMENTED``.

Now, since fetch is a read-only operation I'd argue that we should avoid a rollback in case we fail to find an entry.

A basic fix is pretty trivial but I didn't want to submit it yet since you might instead choose to do slightly more extensive refactoring of the exception code.

I added testcases that generate the problem.