On 3/9/15, Mayank Kumar (mayankum) <mayankum at cisco.com> wrote: > Hi All > > We have some legacy code which calls sqlite3_exec with ROLLBACk every time > sqlite3_step fails irrespective what specific error occurred. I am wondering > if this is a safe behavior or should I change this. Can it cause any > sideeffects or memory leak or any other issues ?
ROLLBACK is always "safe" in the sense that it preserves the database in an intact and consistent form. The only downside is that it might undo some INSERTs, UPDATEs, or DELETEs that you have previously executed but not yet committed. If you don't mind losing all the changes that have occurred since the start of the transaction, then it is always safe to do ROLLBACK. -- D. Richard Hipp drh at sqlite.org