Rollback SQLite transaction operations in case of failure
<p>How can I rewrite my transaction to undo changes since the beginning whenever an error condition occurs before the end?</p>

<p>I see this question <a href="https://stackoverflow.com/questions/5308272/error-handling-and-rollback-transaction-in-sqlite-from-sql-statement">has already been asked</a> and I followed the link provided in that answer. It's not clear to me what the next step is. I am hoping someone can illustrate the solution with an example applied to this transaction:</p>

<pre><code>BEGIN TRANSACTION;
INSERT INTO Employee(ID, Name) VALUES(1, 'John');
...
&lt;some failure happens here&gt;
...
END TRANSACTION;
</code></pre>

<p>In this case, I would like the insert into the Employee table to be undone because a failure occurs before <code>END TRANSACTION</code>. How do I write rules that enforce this? This is for sqlite version 3.9.2.</p>