[yunqa.de] Re: Error "SQLite Error 1 - cannot rollback - no transaction is active".

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 28 Jan 2011 11:42:59 +0100

On 27.01.2011 16:28, Edwin Yip wrote:

> But my problem is with the *original *database file, not a one that's
> copied to another computer by Dropbox.
> 
> Maybe this "SQLite Error 1 - cannot rollback - no transaction is active"
> error is not related to Dropbox? Since I got the same error report from
> some of my software users. What other factors might cause this problem?
> 
> And the code that caused this error is as following:
>   if FDb.InTransaction then
>     FDb.Commit; //yes, commit, not rollback, I wonder why the errr msg
> says 'rollback'.

I tried to reproduce, but could not. Can you send some code that
demonstrates your problem?

Please know that

  TDISQLite3Database.InTransaction

only works if used in pair with

  TDISQLite3Database.StartTransaction;
  TDISQLite3Database.Commit;
  TDISQLite3Database.Rollback;

This group of four maintains its own counter to mimic nested
transactions, which are not supported by SQLite. They do not work with
SQL transaction commands like BEGIN, COMMIT, or ROLLBACK.

Therefore applications must never mix SQL transaction commands with
TDISQLite3Database transaction methods. Is this something you are doing?

I can not think of how this would generate the error message you are
seeing, but since I have no other clues it might be worth checking.

Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: