[yunqa.de] Re: Monitoring the progress of a DISQLite3UniDirQuery running a transaction?

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 27 Sep 2012 11:46:08 +0200

On 26.09.2012 17:49, H M wrote:

> I loop round processing a few thousand  rows of a table and for each one
> do a 'Update table...'
>
> Because updates are slow in SQLite I begin a transaction before the loop
> and do a commit after it.
>
> Inside the loop a progress bar is updated.
>  
> The trouble is the time taken to do the commit is quite a few seconds
> and, being outside the loop I cannot change the progress bar while it
> does it.

Are you saying that each individual commit takes a few seconds? This is
unusual except your update involves lots of data or is on a very slow drive.

> Is there a way to monitor progress of a 'commit' so I may continue to
> move the progress bar?
> 
> pseudo code is
> 
> Begin transaction (using DISQLite3UniDirQuery )
> for each row in table do
>    begin
>    move progress bar
>    do calculations
>    send calculations to database via update sql (using
> DISQLite3UniDirQuery )
>    end
> Commit transaction (using DISQLite3UniDirQuery )

The pseudo code looks fine. To receive further progress information from
within the update, you can register a progress handler:

procedure sqlite3_progress_handler(
  DB: sqlite3_ptr;
  n: Integer;
  Callback: TSQLite3_Progress_Callback;
  UserData: Pointer
  );

Details are available in the DISQLite3.chm help file. Please search the
index for sqlite3_progress_handler to look it up.

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



Other related posts: