Jim Carroll wrote: > BEGIN; > DELETE FROM A; > INSERT INTO A VALUES(1, "goodbye"); > INSERT INTO A VALUES(1, "world"); -- fails > COMMIT; > > It would appear the DELETE was successful, and the first INSERT was > successful. But when the second INSERT failed (as it was intended to)..it > did not ROLLBACK the database.
Why should it? The statement failed, but this does not imply that the transaction failed. (Depending on the application, it might be possible to recover by updating that record, or by ignoring the error.) With the COMMIT, you told the database that the transaction succeeded (which means that the effects of all successful statements are saved permanently.) If you want the transaction to fail, execute ROLLBACK instead. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users