Subject Re: [firebird-support] Using Zeos 7 and FB 2.5, how do you see in main thread changes made in background thread
Author Mark Patterson


On 9 October 2015 at 11:28, Helen Borrie helebor@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 

At 02:05 p.m. 9/10/2015, Mark Patterson mark.aurelius@... [firebird-support] wrote:

>Hi
>
>I am using Zeos 7.1.4 stable, and FB 2.5 embedded. I am processing a directory full of SQL scripts to generate a database. All the tables are getting created in a background thread, but after than if I then try to list the tables in the main thread, they don't immediately show up. I have to exit the app and rerun it.
>
>Is there some standard way to have the results of a background thread visible in the main thread?

Commit the transaction in the main thread and start a new one. Then you will see the **committed** work from other transactions. You will never see uncommitted work from other transactions, under any circumstances.


Thanks for the suggestion. I wrote this procedure, after a bit of avoiding exceptions with autocommit mode and the methods:

procedure TdFBZeos.Refresh;
begin
  ZConnection1.AutoCommit := false;
  ZConnection1.Commit;
  ZConnection1.AutoCommit := true;
  ZConnection1.StartTransaction;
end{ Refresh};

I call it as soon as the background thread has fininshed, but I still cannot see the tables I add until I rerun the program. 

Is this what you had in mind?

Regards
Mark