I think you misunderstood TDISQLite3Database.InTransaction. The documentation is quite clear:
"Transactions started at the SQL level with "BEGIN TRANSACTION" are not considered by InTransaction."
In other words: InTransaction does not detect a transaction started with SQL. You must use TDISQLite3Database.StartTransaction and TDISQLite3Database.Commit/ TDISQLite3Database.Rolback instead.
Regarding your progress indicator I suggest you consider using sqlite3_progress_handler( DB.Handle, nInstructions, Callback, UserData); Consult the DISQLite3.chm documentation for details. Ralf On 12.12.2014 12:15, H M wrote:
Does TDISQLite3Database have an event or some other mechanism that I can use to either make a progress bar or else change the caption of a label so that I can give visual feedback of things happening while it executes a long transaction? My transaction takes about 12 seconds to run. I tried enabling a one second timer just before executing the sql. In the OnTimer event I tested the TDISQLite3Database property 'InTransaction'. If that was true I appended another dot to a label. What appeared to happen was that the timer was enabled and then the sql ran OK. But only after the sql had completely finished did the timer get to fire its OnTimer event for the very first time. It was as if DISQLite3Database1.Execute had prevented any other events being picked up, so the timer didn't fire until the sql had finished. Howard This is the relevant bits of the code I tried. The variable sql = 'Begin transaction; <lots of statements involving blobs> ; Commit;' The variable numdots is global and holds how many progress dots to show _________________________________ <other stuff> timer1.interval := 1000; //fire once every second numdots := 0; // initialise number of dots to show as progress (global) timer1.Enabled := true; //increments numdots when it fires application.processmessages; //<--just in case this was the problem DISQLite3Database1.Execute(sql); //<-- timer1 does not fire until this is finished showmessage('done'); <other stuff> _________________________________ Timer1.OnTimer looked like this, using the global var numdots : integer; _____________________________________ procedure TForm1.Timer1Timer(Sender: TObject); var i : integer; dots : string; begin if DISQLite3Database1.InTransaction then begin inc(numdots); dots := ''; for I := 0 to numdots do dots := dots+ '.'; label2.caption := 'Executing sql' + dots; label2.Repaint; application.processmessages; //just in case end end; ____________________________________ end;
_______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa