On 9 Mar 2011, at 1:34pm, Jay A. Kreibich wrote: > On Wed, Mar 09, 2011 at 02:01:14AM -0800, pkcpkc scratched on the wall: >> > >> What would happen if the following situation occurs: >> I begin a transaction and then do multiple sqlite execute statements. One of >> the execute statements fails and I try doing a rollback. Now when I try the >> rollback the rollback also fails. Does it mean database is corrupted? >> Or will it be rolled back automatically? > > There are situations when a statement error can cause a rollback. It > is possible SQLite automatically rolled back the transaction on the > first error. This would cause the ROLLBACK to return an error. > > What is the error code returned by the ROLLBACK?
Right. Although the larger picture is that you continue to get error codes from perfectly normal legal statements. I can imagine this problem happening by failure of underlying hardware. For example, that the disk is full. So for the original poster 'pkcpkc' the answer is this: we would say that the database it not corrupt, but that it is in a state where SQLite knows that things must be done before the database can be used further. So anything that tries to sqlite3_open() that database will trigger another attempt to restore to the ROLLBACK point, and if it fails to do that it will just keep issuing error messages rather than accepting new SQL statements. What is important is that you don't mess with the files in the meantime. A common mistake appears to be deleting one more more journal files, then trying to use a database manager or the command-line tool to open the database. The second bit is okay, but messing with the journal files will lose you data. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users