Re: [sqlite] Failure during Rollback statement
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
Re: [sqlite] Failure during Rollback statement
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? -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Failure during Rollback statement
On Wed, Mar 9, 2011 at 5:01 AM, pkcpkcwrote: > > 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? > Why is the ROLLBACK failing? If I/O errors or out-of-memory errors prevent a rollback from happening, SQLite abandons its changes, leaving the rollback journal (or WAL file) on the disk, with the idea that the next process to come along will fix the problem. But this is a very unusual occurrence, since rollback does not often fail. > -- > View this message in context: > http://old.nabble.com/Failure-during-Rollback-statement-tp31104890p31104890.html > Sent from the SQLite mailing list archive at Nabble.com. > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Failure during Rollback statement
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? -- View this message in context: http://old.nabble.com/Failure-during-Rollback-statement-tp31104890p31104890.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users