praeclarum/sqlite-net — pull request #74 by mlzg4 (2012-07-10 03:36:00+00:00)
Title: Added reentrancy to transactions.

I added the method SaveTransactionPoint, Release, RollbackTo, and a few helping functions to support those to SQLiteConnection. I also modified the implementation of BeginTransaction to throw an exception immediately in situations where the sql db will throw an exception anyway.

I intended for the code to be 99% thread safe, but there are a few places where it falls short of complete safety. You'll notice that there is a small race condition in _doSavePointExecute. Also in some error situations, the transaction depth can be thrown off by an indeterminate amount. Correcting for such errors precisely would only be possibly if all SQLiteExceptions were thrown from the same method, so right now these corrections will only occur in calls to BeginTransaction and SaveTransactionPoint.

Let me know what you think of the additions. If you like this, I hope to help out more over the next few weeks.