|Subject||Re: [IBO] Timers in Delphi during a DSQL execute|
> It occurred to me after posting I could write the timer in a separateThat's a possibility as well, although I do not know if it can accept
> thread ... thanks for confirmation.
messages then... I think the application usually dispatches messages
via the main message loop, but that could be incorrect...
Either way, with the TTimer in the main thread, it would work OK.
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Database development questions? Check the forum!
> --- In IBObjects@yahoogroups.com, "Martijn Tonies" <m.tonies@...>
> > Hello Russel,
> > > Not sure if this is a proper IBO question ...
> > >
> > > I run a lengthy stored procedure whose execution time I estimate
> > > during its execution would like to update a progress bar on a
> > > event. When Execute is entered the TTimer event is effectively
> > > suspended. It is not called. Is this expected? Can I do something
> > > else
> > > to achieve updating a progress bar?
> > >
> > > dm is a data module used by the form containing the code below.
> > > TTimer is in the code module.
> > >
> > > with dm.dsqlWrite do
> > > begin
> > > SQL.Text := 'execute procedure CALC_CONTACT2_RECS ' +
> > > QuotedStr(DateToIBDate( TDate(DTStart.date)))+', '+
> > > QuotedStr(DateToIBDate( TDate(DTEnd.date)));
> > > Prepare;
> > > Execute;
> > > // TTimer event not called while in Execute
> > If you use Execute, the applications main thread will wait until it
> > returns and not process any windows messages. In order for TTimer
> > to work, the application has to respond to windows messages.
> > If you want this to work, execute the procedure in a thread.
> > > contact2ID := fields.AsInteger;
> > > RecCount := fields.asInteger;
> > > end;