[yunqa.de] Re: DiSqlite - Intransaction bug?

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 05 Jan 2010 13:59:23 +0100

At 08:16 05.01.2010, Clyde England wrote:

>function TDISQLite3Database.GetInTransaction: Boolean;
>begin
>  Result := sqlite3_get_autocommit(Handle) = 0;
>end;
>
>This fixed my problem, and has worked well. However, I have just recently 
>upgraded from Disqlite3 1.6.0 to DiSqlite3 2.1.1 and the code reverted back to 
>the original (faulty?)
>
>Is there any reason why this fix was not committed?

Two reasons:

1. From reading our past conversation on TDISQLite3Database.InTransaction, the 
fix provides a way to work around your practice of mixing 
TDISQLite3Database.Execute("BEGIN") with TDISQLite3Database.InTransaction. I 
pointed out that both are, by design, not intended to be mixed and that 
TDISQLite3Database.StartTransaction should be used. I am glad to read that the 
above works well in your setting. However, it also affects 
TDISQLite3Database.Commit and TDISQLite3Database.Rollback and we are no longer 
guaranteed that StartTransaction and Commit will always come in pairs. This is 
a behaviour other users might rely upon.

2. To complicate things further, SQLite added the concept of SAFEPOINT as 
nested transaction some time ago. I was looking forward to using safepoints to 
support fully nested transaction via TDISQLite3Database.StartTransaction etc. 
However, safepoints are not fully compatible to BEGIN TRANSACTION. They lack 
the deferred, immediate, or exclusive specifieres, for example. In addition, 
safepoints must be named which can cause naming conflicts with safepoints 
created outside of TDISQLite3Database (just like you did with transactions 
calling Execute("BEGIN");).

I am still undecided how to cover both concepts with one method call without 
causing confusion to users if problems result from mixing transactions with 
safepoints. Suggestions are welcome!

Ralf  

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



Other related posts: