[yunqa.de] Re: Progress bar for vacuum, integrity check.

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Mon, 08 Dec 2008 16:44:38 +0100

Clyde wrote:

>Thanks, however.....
>
>>function DbProgressFunc(UserData: Pointer): Integer;
>>begin
>>  TfrmMain(UserData).DoProgress;
>>  Result := 0;
>>end;
>
>Unfortunately when I try to compile that code, I get a compile error on this 
>line:
>
>   sqlite3_progress_handler(
>      Database.Handle, $400, DbProgressFunc, Self);
>
>The error is: incompatible types: regular procedure and record pointer

Did you modify the callback function to an object method? This is not possible.

To be 100% clear, I have attached a complete example project which I tested to 
compile OK with various Delphi versions. For Delphi 2009 it requires DISQLite3 
2.0.0 or later. Alternatively, remove DISystemCompat from the uses list and 
define UnicodeString = WideString for earlier Delphi versions.

>Finally, when I do get this to work it would appear that this is just going to 
>show a "Heart beat" progress (starting at min, going to max, then going back 
>to min when max is exceeded), to let us know sqlite is doing something. That 
>is, It would appear this does not give feedback on a true indication of 0 to 
>100%. Is my understanding correct? Is this not possible?

This is not possible because the information required for such predictions is 
not passed on to the callback function.

More details in the attached project's source code comments.

Ralf 

Other related posts: